• 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

strange problem

 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a JFrame with a border layout with a JPanel containing JRadioButtons in north and a class DrawingArea that extends JPanel in the center. DrawingArea implements MouseListener. mouseReleased() has two lines of code one of which calls repaint(). for some reason it causes a second row of RadioButtons to appear below the first ones. when i override paintComponent() it also creates a second border around the DrawingArea. if i overide paint() instead it erases the original border. it only does this the first time after that it just draws rectangles like it is supposed to. i dont have a clue how this is happening. i implemented all the methods of Mouse Listener and i even implemeted MouseMotionListener also to no avail. here is some of the code.
in Jframe

in DrawingArea

[ February 05, 2004: Message edited by: Randall Twede ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you override paintComponent(), be sure to call super.paintComponent(). That ought to fix this problem, actually.
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok thanks ill try that. yeah that was it thanks again.
[ February 05, 2004: Message edited by: Randall Twede ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic