This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Fiiled Rectangle  RSS feed

 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I am currently trying to draw a black filled rectangle around a rectangular JComponent but i can't seem to get it right.
The fille rectangle will actually be 6 pixels wider and higher than the actual JComponent so making it seem that the JComponent is drawn within the rectangle like the below figure

*******************************
* *
* ********************* *
* * * *
* * * *
* ********************* *
* *
*******************************

From the on top figure the outer rectangle is what i need to be a filled rectangle while the inner rectangle is actually the JComponent itself.

The problem is i get the top part correct but the JComponent seems to shift and i can't seem to get it correctly

This is what i have done



please assume that the variable component is the JComponent that i want to be in the inner rectangle.

I hope someone can help me with this

Thank You

Yours Sincerely

Richard West
 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Can you use that?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!