GTabbedPane
Aller à la navigation
Aller à la recherche
<fc #556B2F>GENIUS</fc> allows of course to display data inside tabbed panes via the GTabbedPane class:
GTabbedPane tabs = new GTabbedPane();
GLabel lab1 = new GLabel("Tab 1 ..."); // Label to be set in the first pane (rank #0)
GLabel lab2 = new GLabel("Tab 2 ..."); // Label to be set in the second pane (rank #1)
GLabel lab3 = new GLabel("Tab 3 ..."); // Label to be set in the third pane (rank #2)
tabs.addTab("Tab 1", new GPanel() {
public void display() throws GException { generic(); }
public void generic() throws GException { put(lab1); }
});
tabs.addTab("Tab 2", new GPanel() {
public void display() throws GException { generic(); }
public void generic() throws GException { put(lab2); }
});
tabs.addTab("Tab 3", new GPanel() {
public void display() throws GException { generic(); }
public void generic() throws GException { put(lab2); }
});
tabs.getJTabbedPane().setSelectedIndex(1); // The pane to be displayed first will be the #1 one.
tabs.getJTabbedPane().setEnabledAt(0, false); // The pane #0 will not be modifiable
…
public void display() throws GException { put(tabs); }