multiple panes problem
hi guys and gals,
what i have so far are three tabs containing different things. what i want to do is instead of a user having to press the tab i would like to use three large buttons, which when pressed brings up the chosen content in a central window, without the use of tabbed panels. how would i go about this what swing component would be best for this?
i tried with layered panes but it ended up getting quite messy.
Again, posting a small compilable example of what you're trying to do would help us to help you.
Originally Posted by grease_monkey1986
Anyway, if you want to activate one of your three tabs when a button is pressed (although I don't see a reason to do that, the tab will be activated if the user clicks on it, but whatever...), the solution is again the same: create three ActionListeners, and add each one to one of the buttons. Each of the three ActionListeners will activate one of the tabs (so for example, create FirstTabActionListener that activates the first tab and add it to the button that the user should click to activate the first tab; do the equivalent for the remaining two listeners, buttons and tabs).
Alternatively, if you're not using tabs, do the same but instead of activating a tab, each of the ActionListeners should create a JPanel that holds all the GUI components that you want to show when the button associated to the ActionListener is pressed, and set that JPanel as the ContentPane of your JFrame.