2

I have 3 separate GUIs that perform independent functions:

  • ConverterGUI
  • TransformerGUI
  • GenerationGUI

How can I combine them together in such a way that they would look like tabs?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Abiodun
  • 959
  • 6
  • 17
  • 38

1 Answers1

6

Use a JTabbedPane See How to Use Tabbed Panes for details.

tabbed pane

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • maybe CardLayout and with JMenu could be an alternative – mKorbel Aug 24 '12 at 08:16
  • @mKorbel Mmmm.. not convinced when the question states *"look like tabs"*, but maybe I am presuming too much. It is me that expanded the tags from just `java` ( which might show how much presuming I did on that answer ;). – Andrew Thompson Aug 24 '12 at 08:23
  • 1
    @lee yes no problem, no issue with that, [Cardlayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) and [JTabbedPane](http://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html) – mKorbel Aug 24 '12 at 08:30
  • @Andrew Thompson :-), :-), :-) – mKorbel Aug 24 '12 at 08:30
  • @Andrew Thompson your bluntness is not required,all that is required is good directions in solving the problem. – Abiodun Aug 24 '12 at 09:13
  • 1
    @lee: I find Andrew's [advice](http://sscce.org/) helpful, and I frequently post the results here, for [example](http://stackoverflow.com/a/5655843/230513). See also this [Q&A](http://meta.stackexchange.com/q/2686/163188). – trashgod Aug 24 '12 at 09:43
  • @lee Andrew's answer and comments are correct, clear and excellent describe, your comment could be childish :-) – mKorbel Aug 24 '12 at 09:51
  • Am sorry guys i've just being trying hard to get it and it seems to get more complicated. thank you for your time. – Abiodun Aug 24 '12 at 10:10
  • If there were any evidence of how hard you had tried (e.g. a code sample with a specific question as to how to achieve the next step) you might find all 3 of the people who have so far commented, willing to help further. Please think it over. – Andrew Thompson Aug 24 '12 at 10:18
  • what i can produce are my 3 gui codes, how to join them together seem like magic to me..but as u have adviced, i would try harder – Abiodun Aug 24 '12 at 10:27
  • OK... If you can do it for 2, it should be easy for 3, right? So first start thinking about trimming the problem down to just combining **2** GUIs. Then thinking about it, `ConverterGUI` might have an input field for a number, a combo box for the units to convert, and a label for the output. But again, if you can work out how to add a label to one tab, and a combo to another, the bigger task should be easy. Or at least much easier. The idea is, start small, and the first moment you strike a problem, post the code as it is and ask a specific question. – Andrew Thompson Aug 24 '12 at 10:33
  • You're welcome. Hope it goes well, and if it doesn't, please ask a new question. – Andrew Thompson Aug 24 '12 at 10:45