Re: GUI Only Works Sometimes
Couple of comments.
build the GUI first and then display it. Add full panels to the frame vs empty ones.
What layout manager are you using?
What location do you want the panels to appear on the frame?
Re: GUI Only Works Sometimes
Quote:
Originally Posted by
Norm
Couple of comments.
build the GUI first and then display it. Add full panels to the frame vs empty ones.
What layout manager are you using?
What location do you want the panels to appear on the frame?
I am using Eclipse, want the panels topleft except I only want one visible at a time (which is what im trying to do with the buttons), and I dont know what you mean by empty vs full panels.
Re: GUI Only Works Sometimes
Quote:
empty vs full panels
Panel pnl = new panel(); // create a panel. It is now empty
pnl.add(someComp1);
pnl.add(someComp2);
...
frame. add(pnl); // add the panel after it has been filled with some components
What layout manager are you using? Where do you expect the components to be positioned when they are added to the frame? The default positions can be the new one on top of the previous.
Re: GUI Only Works Sometimes
Quote:
Originally Posted by
Norm
Panel pnl = new panel(); // create a panel. It is now empty
pnl.add(someComp1);
pnl.add(someComp2);
...
frame. add(pnl); // add the panel after it has been filled with some components
What layout manager are you using? Where do you expect the components to be positioned when they are added to the frame? The default positions can be the new one on top of the previous.
The only program I am using is Eclipse, should I be using something else too? Also, I thought that I put buttons in both of the panels.
Re: GUI Only Works Sometimes
Eclipse is an IDE. A tool to help write code.
What I'm talking about is what goes in the code, not the tools used to create it.
If you don't know what a layout manager, you should read up on them.
Go to this site and Search for layout for much info:
The Really Big Index
Re: GUI Only Works Sometimes
Quote:
Originally Posted by
Norm
Eclipse is an IDE. A tool to help write code.
What I'm talking about is what goes in the code, not the tools used to create it.
If you don't know what a layout manager, you should read up on them.
Go to this site and Search for layout for much info:
The Really Big Index
I was going to use gridbag layout but I hadnt gotten that far yet. I was just wondering why sometimes the panels show in the frame and sometimes they dont.
Re: GUI Only Works Sometimes
Where are the components being displayed when you add them to the frame?
Can they overlap/hide one another? Do something to each panel so you can see if it is the one being shown.
Set the back ground color for all the panels and the frame and content pane to different colors to see which one is showing when.