| A TabSheet is a Panel that can be layered, so that a user can switch between
tab sheets.
Example:
Dialog dlg = new Dialog("TabFolder Test");
dlg.setBounds(25, 25, 600, 400);
TabSheet tSheet1 = new TabSheet("Sheet 1");
TabSheet tSheet2 = new TabSheet("Sheet 2");
TabFolder tFolder = new TabFolder();
tFolder.setBounds(50, 25, 500, 300);
tFolder.getChildren().add(tSheet1);
tFolder.getChildren().add(tSheet2);
TextField tf = new TextField();
tf.setBounds(25, 25, 150, 20);
tSheet2.getChildren().add(tf);
Button firstButton = new Button("Change Tab Title 1");
firstButton.setBounds(50, 50, 150, 30);
firstButton.addActionListener(Button.ACTION_CLICK, new ActionListener() {
public void actionPerformed(ActionEvent ev) {
((TabSheet) ((Button) ev.getSource()).getParent()).setText("New Title 1");
}
});
tSheet1.getChildren().add(firstButton);
dlg.getChildren().add(tFolder);
dlg.setVisible(true);
Keyboard Navigation:
author: Joshua J. Gertzen |