File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes grid bag panels overlap : please HELP if you can Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "grid bag panels overlap : please HELP if you can" Watch "grid bag panels overlap : please HELP if you can" New topic
Author

grid bag panels overlap : please HELP if you can

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi.
I have been working this grid bag panels the last 3 days. Keep overlapping won't budge move or anything - nothing I do will stop it from overlapping. I am missing something here, I cannot se the wood for the trees. Can some HELP ?
must be some minor thing ???

[ December 17, 2002: Message edited by: achana chan ]

humanum errare est.
Bhagya Tangutur
Ranch Hand

Joined: Oct 21, 2002
Posts: 88
I just glanced your code...It looks like you are not using JFC and AWT Components in the same application.If your doing this so this would problem i see.Another one is I see your using BorderLayout .Whea your using BorderLayout,Make sure that you remove OLD component which is been added to Center and add New One.This was one of the problem what i observed very Long back.I don't know whetehr that been fixed or not yet.
I don't know how much i am helpful the above info is.


Sun Certified Java Programmer
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
Have you forgotten to set the constraints here, or I have I missed where you are setting them?

Just on the side: you can add components this way as well:

works fine and reduces the lines - which might help you to check the constraint settings.
Why have you commented out the setLayout(gridBag) in the ClientInfo constructor?
You seem to have just missed to add all components together with their GridBagConstraints. The consequence is, that they get added with FlowLayout - which mixes up everything, of course.
Chantal
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Additional comments in this thread.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi All.
I use j2sdk1.4.0_01 on Linux RedHat7.1 (kernel 2.4.2) and Apache2/Tomcat1.4.0
I have been advised not to use SWING if I can help it because it slows things down.
Thru jiggling around with the <APPLET...width height> tag I managed to put together a half-way workable solution, but very messy and unstable.
I need 2rows x 2columns : a column of data on the NORTHWEST, image in NORTHEAST and the botton row has a text area with GridWidth=2 ie spanning both columns .

This is the code that goes with it, a tat messy, but getting there...


By the way, for all of you who helped me so much in the past : anyone of you living in NY ?
[ December 17, 2002: Message edited by: achana chan ]
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Why not just do it like this... it's so much more readable :



And, if you are doing this as an Applet... why not generate the GUI as a HTML form instead? I see nothing in the applet that could not be generated using standard HTML widgets...
 
GeeCON Prague 2014
 
subject: grid bag panels overlap : please HELP if you can