Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to persist rectangle?  RSS feed

 
shahidrasul shahid
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i draw a rectangle in lable with mouse. when i minize window or use scroll bar rectangle is disappered, i want to show rectangle.


please help me?
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two ways:
-- Assign a reference to the rectangle to an instance field and use that instance field in a paintComponent override to draw the rectangle

-- Draw the rectangle to a BufferedImage and draw the BufferedImage to the JLabel in a paintComponent override.

It might be easier to give you a more specific answer if you post a SSCCE showing what you have tried so far.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prathyusha Tummepalli,
Your post was moved to a new topic.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!