This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Components duplicates

 
Zonera Javed
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!


Bug in pool.jpg
Top frame is when you first click on the "Properties" option and bottom is after you close and click again.
[Thumbnail for Bug in pool.jpg]
 
Rob Camick
Ranch Hand
Posts: 2475
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! That worked!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic