• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Drawing in Graphic-Context of a JPanel in a JPanel

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Panel that has a Panel inside (to get some inset in my Panel.)
The problem is, that it just works, if I draw into the main Panel.
If I try to get the Graphic context of my other JPanel and write into it,
I just see my drawing for breaks of seconds when I rezise the Frame (where the JPanelis inside).
If I don't resize, I see nothing, if I finish resizing, the same.

Here ist my Code.
Maybe the paint-Method is just called when resizing now?

Can anyone help ?
Is there another possibility to get some inset for my drawing Area?

Here is my Code:




[ July 29, 2004: Message edited by: Raschin Ghanad ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you didn't override screenPanel's paint method, it is probably painting itself over your own paint efforts. Have a gander at the Custom Painting chapter of the Java Tutorial for some more detail.
 
Raschin Ghanad
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, thats what I was thinking about, too.
But how can I override it without creating a new class that extends a JPanel and then adding it?

Can't I use my actual paint-Method to write into the Graphic-Context of the the component using the getGraphcis() method?


Sorry, I haven't time to read the tut, but I will do so in a while.

thanx for fast response
[ July 29, 2004: Message edited by: Raschin Ghanad ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic