wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Components duplicates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Components duplicates " Watch "Components duplicates " New topic
Author

Components duplicates

Zonera Javed
Greenhorn

Joined: Oct 01, 2013
Posts: 3
I've been working on this GUI for a while now and I am unable to resolve this bug. I have a grid of buttons where each button represents a location. Each location has a set of properties which I want to display in a "Properties" window. This window consists of 5 labels and fields, two radio buttons, two buttons and a "notes" area. The user can access the properties by right clicking on a button and then clicking on "Properties" from the popup menu. So while the main GUI is running, the user can view the properties of any location, any number of times. The issue I'm having is that when you first click on the properties option and the Jframe is displayed, the layout looks as desired. But when you close it and then open another properties window (of that same location or another location), the JPanel containing the textfields and labels disappear. When you resize the frame though, those fields appear but the two radio buttons and the "notes" area are duplicated. I'm not sure what is going on here. I've manipulated the layouts as well as used SwingUtilities.invokeLater() to see if that'll fix the issue with no luck. Any help will be greatly appreciated!





[Thumbnail for Bug in pool.jpg]

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2152
    
    7


Based on the first line of code in your program is looks like you are reusing the existing JFrame and are just adding more components to the frame so you get a weird layout.

I would suggest you should be using:



Also, instead of using a JFrame you should be using a JDialog. As a general guideline, an application should only contain a single JFrame.
Zonera Javed
Greenhorn

Joined: Oct 01, 2013
Posts: 3
Thank you! That worked!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Components duplicates
 
Similar Threads
JRadioButton w/a JButton
JTextArea scroll bar
Arrays Won't Work
Window Size
radiobuttons changing background color