As part of our exam project we need to write a GUI in java, the problem is that the structure has got us stumped.
I'm not asking you to do our work, but if someone could nod us of in the right direction it would really be appreciated.
We want to make a GUI with a JTabbedPane in a JFrame.
The tab pane will have three tabs, all of which will have a list/grapchical rendering of a list in the top, and some input fields at the bottom.
So we thought we'd make a sub-class structure looking something like this:
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.LayoutManager;
import javax.swing.JComponent;
public class TabContent extends Container {
public TabContent(JComponent tc, JComponent bc) {
setLayout(new BorderLayout(6, 6));
add(tc, BorderLayout.CENTER);
add(bc, BorderLayout.SOUTH);
}
}
import javax.swing.JButton;
import javax.swing.JLabel;
public class ReservationTab extends TabContent {
public ReservationTab() {
super(new JButton("Here goes a graph/list component."), new JLabel("Here goes the \"add reservation\" fields."));
}
}
Then make two more *Tab classes for the other two tabs and add them to the tabbedpane in the same class that makes the JFrame.
Problem is that the text/input fields are depending on data/status from the list.
With this structure the calls between the different components seem rather clumsy.
Any advise on how to structure this?