help with setVisible()
publicvoid actionPerformed(ActionEvent e)
{
String arg = e.getActionCommand();
if (e.getSource() == introButton);
{
introPane.setVisible(false);
fieldPanel.setVisible(true);
}
}
i have this and i think i need something else in maybe my constructor to get these to accually work. What i have is aApplet that i'm trying to basically swap screens. They are on the same container but in different panels so i'm trying to set the intro to visible then have a 'enter' button on it which makes the intro panel set to false and the next panel set to true so that it looks like they are swapped. I 'm doing this for a class andi think one of my classmates did it but used the renew method or something like that. This is my first 'big' java code so i'm still kinda new to it. Thanx for thehelp in advance
[1142 byte] By [
H_Ca] at [2007-11-27 4:52:55]

You can do this by using the CardLayout layout.Follow this link to learn how to implement it http://java.sun.com/docs/books/tutorial/uiswing/layout/card.htmlRegards
that would probably work but we never really used card layouts, also i'm trying to make it so you can't see the other frames when they are not visible. Its supposed to be like a new window or something
H_Ca at 2007-7-12 10:07:06 >

Oh i remember now... it used the Validate method. Can somebody explain to me how this would work?
H_Ca at 2007-7-12 10:07:06 >

There's some confusion here. You started off saying "They are on the same container but in different panels" then switched to "i'm trying to make it so you can't see the other frames when they are not visible. Its supposed to be like a new window". These terms - frame, window, screen, panel and the rest - are all very precisely defined.
If your GUI is indeed an Applet (as in the OP), there are no frames involved. There's a container which acts as a content pane and multiple components (including panels) can be placed in this container. The container can be given a card layout so only one panel at a time is visible as suggested before.
Applications (applets or not) can also use dialogs (java.awt.Dialog/javax.swing.JDialog) to create new top level windows.
It might clarify things if you step back from the layout managers and consider the options outlined in http://java.sun.com/docs/books/tutorial/uiswing/TOC.html - "Using Top Level Containers" and "How To Make Dialogs" as well as the information on layout managers.
when i said frames i ment panels... it is a applet not an aplication.
I just want to swap through the panels by changing there visible to false or true. I don't want to use card layout as i am not familiar with it. I know it is possible because i've seen it before. It changes the visibility and then uses validate to update it on the applet. I just need some help on the coding
H_Ca at 2007-7-12 10:07:06 >

i guess i'll have to 'bump' this topic to the top cuz i still dont' have an answer
H_Ca at 2007-7-12 10:07:06 >

why dont you post your code?
> i guess i'll have to 'bump' this topic to the top cuz> i still dont' have an answerYes you have - CardLayout.
unfortunately he's allergic to CardLayout
ok i figured it out on my own... and i said i couldn't use card layouts cuz we never learned how to in the class i'm in. It would be kinda weird for me to turn in my final with a whole bunch of stuff we never even learned in the class. And thankfully i will never take a java class again so i won't ever have to ask for help from you guys again, which is a good thing cuz these forums suck ballz
H_Ca at 2007-7-12 10:07:06 >

> ok i figured it out on my own... and i said i
> couldn't use card layouts cuz we never learned how to
> in the class i'm in. It would be kinda weird for me
> to turn in my final with a whole bunch of stuff we
> never even learned in the class. And thankfully i
> will never take a java class again
Gods forbid you branch out to something the instructor didn't teach. Why, the instructor would probably think you were resourceful or actually willing to go to some effort.
> so i won't ever have to ask for help from you guys again,
> which is a good thing cuz these forums suck ballz
Way to build a bridge, there, buddy. Hope you're right.
> And thankfully i will never take a java class again so i won't ever have to ask for help from you guys again, which is a good thing cuz these forums suck ballz
Damn! The IT industry has lost another valuable asset. Someone who is open to criticism and is able to think for themselves. Pity.