• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Repaint() does not function unless i modify the size of the frame by mouse......

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to drawing something on the panel when i click the button. But now Repaint() does not function unless i modify the size of the frame by mouse......
how should i do?
 
Rancher
Posts: 3324
32
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you add components to a visible GUI you need to invoke the layout manager so the size and location of the component can be determined, otherwise the size is (0, 0) so there is nothing to paint.

The basic code is:



In your case you are adding the component to the content pane of the frame so you can use frame.revalidate().
 
Forman Smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Camick wrote:

In your case you are adding the component to the content pane of the frame so you can use frame.revalidate().



I add the

it does work!
Thank you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic