Results 1 to 4 of 4
- 12-29-2007, 01:24 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 2
- Rep Power
- 0
Selecting a JMenu paints over the JPanel on the content pane
Hi.
As the title says, every time I select a JMenu from the menu bar and menu items drop down, the space taken over by the menu items gets painted over.
An example of it happening can be seen here:
where the gray area is where the Input menu has dropped down.
Does anybody know how to stop this from happening?
Thanks.
:).
- 12-29-2007, 02:43 AM #2
Possible areas of trouble may include:
1 — Mixing AWT and Swing (J-prefix) components
2 — improper implementation of paint/paintComponent method overrides.
Need more information to go farther.
- 12-29-2007, 06:29 PM #3
Member
- Join Date
- Dec 2007
- Posts
- 2
- Rep Power
- 0
Hi.
Cheers for replying.
I'll try and go into a bit more detail.
I've got a class which extends a JPanel.
I've got some boolean variables which can be set by calling methods (e.g. blankScreen). The JPanel's repaint() method is then called.
I've overriden the paintComponent() method to call certain methods dependent on the value of the booleans.
The appropriate method is called using the paingComponent's Graphics object as a parameter.
When the JPanel is painted for the first time when the GUI is created, the painting over effect does not occur. It only seems to happen once it has been repainted.
Thanks for any help people can give.
:)
- 01-06-2008, 12:13 AM #4
Similar Threads
-
JFileChooser example (selecting a directory)
By Java Tip in forum Java TipReplies: 0Last Post: 03-14-2008, 01:02 PM -
Selecting parts of an image
By shaungoater in forum Java 2DReplies: 1Last Post: 12-15-2007, 11:06 PM -
JMenu calling another Forms/Panels
By plodos in forum New To JavaReplies: 2Last Post: 12-10-2007, 09:02 AM -
selecting a record in database
By ramachandran in forum New To JavaReplies: 0Last Post: 10-25-2007, 08:06 AM -
JMenu and JRadioButtonMenuItem
By doron70 in forum AWT / SwingReplies: 3Last Post: 07-18-2007, 07:13 PM
Bookmarks