use of javax.swing.JTabbedPane in project jgnash by ccavanaugh.
the class OptionDialog method initComponents.
private void initComponents() {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle(rb.getString("Title.Options"));
tabbedPane = new JTabbedPane();
tabbedPane.addTab(rb.getString("Tab.Accounts"), new AccountOptions());
tabbedPane.addTab(rb.getString("Tab.General"), new GeneralOptions(this));
tabbedPane.addTab(rb.getString("Tab.Network"), new NetworkOptions());
tabbedPane.addTab(rb.getString("Tab.Register"), new RegisterOptions());
tabbedPane.addTab(rb.getString("Tab.Reminders"), new ReminderOptions());
tabbedPane.addTab(rb.getString("Tab.Report"), new ReportOptions());
tabbedPane.addTab(rb.getString("Tab.StartupShutdown"), new StartupOptions());
for (final Plugin plugin : PluginFactory.getPlugins()) {
final JPanel optionsPanel = ((SwingPlugin) plugin).getOptionsPanel();
if (optionsPanel != null) {
Object name = optionsPanel.getClientProperty(Plugin.OPTIONS_NAME);
if (name != null) {
tabbedPane.addTab((String) name, optionsPanel);
}
}
}
closeButton = new JButton(rb.getString("Button.Close"));
closeButton.addActionListener(this);
}
use of javax.swing.JTabbedPane in project JMRI by JMRI.
the class PositionablePropertiesUtil method display.
public void display() {
propertiesPanel = new JTabbedPane();
getCurrentValues();
JPanel exampleHolder = new JPanel();
for (int i = 0; i < txtList.size(); i++) {
JPanel p = new JPanel();
p.setBorder(BorderFactory.createTitledBorder(txtList.get(i).getDescription()));
// add a visual example for each
p.add(txtList.get(i).getLabel());
exampleHolder.add(p);
}
//exampleHolder.add(example);
JPanel tmp = new JPanel();
JButton cancel = new JButton(Bundle.getMessage("ButtonCancel"));
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
undoChanges();
mFrame.dispose();
}
});
tmp.setLayout(new BoxLayout(tmp, BoxLayout.Y_AXIS));
tmp.add(propertiesPanel);
tmp.add(detailpanel);
tmp.add(exampleHolder);
textPanel();
editText();
borderPanel();
sizePosition();
JPanel _buttonArea = new JPanel();
_buttonArea.add(cancel);
JButton applyButton = new JButton(Bundle.getMessage("ButtonApply"));
_buttonArea.add(applyButton);
applyButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fontApply();
}
});
JButton okButton = new JButton(Bundle.getMessage("ButtonOK"));
_buttonArea.add(okButton);
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fontApply();
mFrame.dispose();
}
});
tmp.add(_buttonArea);
exampleHolder.setBackground(_parent.getParent().getBackground());
mFrame = new JFrame(_parent.getNameString());
mFrame.add(tmp);
mFrame.pack();
mFrame.setVisible(true);
preview();
}
use of javax.swing.JTabbedPane in project JMRI by JMRI.
the class WarrantFrame method init.
private void init() {
_commandModel = new ThrottleTableModel();
JPanel contentPane = new JPanel();
contentPane.setLayout(new BorderLayout(5, 5));
contentPane.add(makeTopPanel(), BorderLayout.NORTH);
_tabbedPane = new JTabbedPane();
_tabbedPane.addTab(Bundle.getMessage("MakeRoute"), makeFindRouteTabPanel());
_tabbedPane.addTab(Bundle.getMessage("RecordPlay"), makeSetPowerTabPanel());
contentPane.add(_tabbedPane, BorderLayout.CENTER);
contentPane.add(makeEditableButtonPanel(), BorderLayout.SOUTH);
if (getOrders().size() > 0) {
_tabbedPane.setSelectedIndex(1);
}
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
close();
}
});
makeMenus();
setTitle(_warrant.getDisplayName());
setContentPane(contentPane);
setLocation(0, 100);
setVisible(true);
pack();
}
use of javax.swing.JTabbedPane in project JMRI by JMRI.
the class ManageLocationsFrame method initGui.
private void initGui() {
this.setTitle(Bundle.getMessage("FieldManageLocationsFrameTitle"));
this.buildMenu();
// Panel for managing listeners
listenerPanel = new JPanel();
listenerPanel.setLayout(new BoxLayout(listenerPanel, BoxLayout.Y_AXIS));
// Audio Mode Buttons
JRadioButton b1 = new JRadioButton(Bundle.getMessage("ButtonAudioModeRoom"));
b1.setToolTipText(Bundle.getMessage("ToolTipButtonAudioModeRoom"));
// NOI18N
b1.setMnemonic(Mnemonics.get("RoomMode"));
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
modeRadioButtonPressed(e);
}
});
JRadioButton b2 = new JRadioButton(Bundle.getMessage("ButtonAudioModeHeadphone"));
// NOI18N
b2.setMnemonic(Mnemonics.get("HeadphoneMode"));
b2.setToolTipText(Bundle.getMessage("ToolTipButtonAudioModeHeadphone"));
b2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
modeRadioButtonPressed(e);
}
});
b2.setEnabled(false);
ButtonGroup bg = new ButtonGroup();
bg.add(b1);
bg.add(b2);
b1.setSelected(true);
JPanel modePanel = new JPanel();
modePanel.setLayout(new BoxLayout(modePanel, BoxLayout.LINE_AXIS));
modePanel.add(new JLabel(Bundle.getMessage("FieldAudioMode")));
modePanel.add(b1);
modePanel.add(b2);
// Build Listener Locations Table
locData = new Object[1][7];
locData[0][0] = listenerLoc.getName();
locData[0][1] = true;
locData[0][2] = listenerLoc.getLocation().x;
locData[0][3] = listenerLoc.getLocation().y;
locData[0][4] = listenerLoc.getLocation().z;
locData[0][5] = listenerLoc.getBearing();
locData[0][6] = listenerLoc.getAzimuth();
log.debug("Listener:" + listenerLoc.toString());
log.debug("locData:");
for (int i = 0; i < 7; i++) {
log.debug("" + locData[0][i]);
}
JPanel locPanel = new JPanel();
locPanel.setLayout(new BoxLayout(locPanel, BoxLayout.LINE_AXIS));
JScrollPane locScrollPanel = new JScrollPane();
locModel = new ListenerTableModel(locData);
JTable locTable = new JTable(locModel);
locTable.setFillsViewportHeight(true);
locTable.setPreferredScrollableViewportSize(new Dimension(520, 200));
locScrollPanel.getViewport().add(locTable);
listenerPanel.add(modePanel);
listenerPanel.add(locScrollPanel);
reporterPanel = new JPanel();
reporterPanel.setLayout(new GridBagLayout());
JScrollPane reporterScrollPanel = new JScrollPane();
reporterModel = new LocationTableModel(reporterData);
JTable reporterTable = new JTable(reporterModel);
reporterTable.setFillsViewportHeight(true);
reporterScrollPanel.getViewport().add(reporterTable);
reporterTable.setPreferredScrollableViewportSize(new Dimension(520, 200));
blockPanel = new JPanel();
blockPanel.setLayout(new GridBagLayout());
JScrollPane blockScrollPanel = new JScrollPane();
blockModel = new LocationTableModel(blockData);
JTable blockTable = new JTable(blockModel);
blockTable.setFillsViewportHeight(true);
blockScrollPanel.getViewport().add(blockTable);
blockTable.setPreferredScrollableViewportSize(new Dimension(520, 200));
opsPanel = new JPanel();
opsPanel.setLayout(new GridBagLayout());
opsPanel.revalidate();
JScrollPane opsScrollPanel = new JScrollPane();
opsModel = new LocationTableModel(opsData);
JTable opsTable = new JTable(opsModel);
opsTable.setFillsViewportHeight(true);
opsTable.setPreferredScrollableViewportSize(new Dimension(520, 200));
opsScrollPanel.getViewport().add(opsTable);
tabbedPane = new JTabbedPane();
// Reporters Tab Title
tabbedPane.addTab(Bundle.getMessage("Reporters"), reporterScrollPanel);
tabbedPane.setToolTipTextAt(0, Bundle.getMessage("ToolTipReporterTab"));
// NOI18N
tabbedPane.setMnemonicAt(0, Mnemonics.get("ReporterTab"));
tabbedPane.addTab(Bundle.getMessage("Blocks"), blockScrollPanel);
tabbedPane.setToolTipTextAt(0, Bundle.getMessage("ToolTipBlockTab"));
// NOI18N
tabbedPane.setMnemonicAt(0, Mnemonics.get("BlockTab"));
tabbedPane.addTab(Bundle.getMessage("FieldOpsTabTitle"), opsScrollPanel);
tabbedPane.setToolTipTextAt(1, Bundle.getMessage("ToolTipOpsTab"));
// NOI18N
tabbedPane.setMnemonicAt(1, Mnemonics.get("OpsTab"));
tabbedPane.addTab(Bundle.getMessage("FieldListenersTabTitle"), listenerPanel);
tabbedPane.setToolTipTextAt(2, Bundle.getMessage("ToolTipListenerTab"));
// NOI18N
tabbedPane.setMnemonicAt(2, Mnemonics.get("ListenerTab"));
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
JButton closeButton = new JButton(Bundle.getMessage("ButtonCancel"));
closeButton.setToolTipText(Bundle.getMessage("ToolTipButtonMLFClose"));
// NOI18N
closeButton.setMnemonic(Mnemonics.get("CloseButton"));
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeButtonPressed(e);
}
});
JButton saveButton = new JButton(Bundle.getMessage("ButtonSave"));
saveButton.setToolTipText(Bundle.getMessage("ToolTipButtonMLFSave"));
// NOI18N
saveButton.setMnemonic(Mnemonics.get("SaveButton"));
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
saveButtonPressed(e);
}
});
buttonPane.add(closeButton);
buttonPane.add(saveButton);
this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
this.getContentPane().add(tabbedPane);
this.getContentPane().add(buttonPane);
this.pack();
this.setVisible(true);
}
use of javax.swing.JTabbedPane in project JMRI by JMRI.
the class ConfigBaseStationFrame method initGui.
private void initGui() {
// NOTE: Look at jmri.jmrit.vsdecoder.swing.ManageLocationsFrame
// for how to add a tab for turnouts and other things.
this.setTitle(Bundle.getMessage("FieldManageBaseStationFrameTitle"));
this.buildMenu();
// Panel for managing sensors
sensorPanel = new JPanel();
sensorPanel.setLayout(new GridBagLayout());
JButton addButton = new JButton(Bundle.getMessage("ButtonAddSensor"));
addButton.setToolTipText(Bundle.getMessage("ToolTipButtonMSFAdd"));
// NOI18N
addButton.setMnemonic(Mnemonics.get("AddButton"));
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addButtonPressed(e);
}
});
JButton closeButton = new JButton(Bundle.getMessage("ButtonClose"));
closeButton.setToolTipText(Bundle.getMessage("ToolTipButtonMSFClose"));
// NOI18N
closeButton.setMnemonic(Mnemonics.get("CloseButton"));
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeButtonPressed(e);
}
});
JButton saveButton = new JButton(Bundle.getMessage("ButtonSaveSensors"));
saveButton.setToolTipText(Bundle.getMessage("ToolTipButtonMSFSave"));
// NOI18N
saveButton.setMnemonic(Mnemonics.get("SaveButton"));
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
saveButtonPressed(e);
}
});
JScrollPane sensorScrollPanel = new JScrollPane();
sensorModel = new SensorTableModel();
sensorTable = new JTable(sensorModel);
sensorTable.setFillsViewportHeight(true);
sensorScrollPanel.getViewport().add(sensorTable);
sensorTable.setPreferredScrollableViewportSize(new Dimension(520, 200));
sensorTable.getColumn(Bundle.getMessage("FieldTableDeleteColumn")).setCellRenderer(new ButtonRenderer());
sensorTable.removeColumn(sensorTable.getColumn("isNew"));
sensorTable.removeColumn(sensorTable.getColumn("isDirty"));
sensorTable.removeColumn(sensorTable.getColumn("isDelete"));
sensorTable.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent evt) {
handleTableMouseClick(sensorTable, evt);
}
});
sensorTable.setAutoCreateRowSorter(true);
sensorSorter = new TableRowSorter<>(sensorTable.getModel());
sensorTable.setRowSorter(sensorSorter);
List<RowSorter.SortKey> sensorSortKeys = new ArrayList<>();
//int columnIndexToSort = 1;
sensorSortKeys.add(new RowSorter.SortKey(sensorTable.getColumn(Bundle.getMessage("FieldTableIndexColumn")).getModelIndex(), SortOrder.ASCENDING));
sensorSorter.setSortKeys(sensorSortKeys);
sensorSorter.sort();
sensorSorter.setSortable(sensorTable.getColumn(Bundle.getMessage("FieldTableDeleteColumn")).getModelIndex(), false);
JScrollPane turnoutScrollPanel = new JScrollPane();
turnoutModel = new TurnoutTableModel();
turnoutTable = new JTable(turnoutModel);
turnoutTable.setFillsViewportHeight(true);
turnoutScrollPanel.getViewport().add(turnoutTable);
turnoutTable.setPreferredScrollableViewportSize(new Dimension(520, 200));
turnoutTable.getColumn(Bundle.getMessage("FieldTableDeleteColumn")).setCellRenderer(new ButtonRenderer());
turnoutTable.removeColumn(turnoutTable.getColumn("isNew"));
turnoutTable.removeColumn(turnoutTable.getColumn("isDirty"));
turnoutTable.removeColumn(turnoutTable.getColumn("isDelete"));
turnoutTable.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent evt) {
handleTableMouseClick(turnoutTable, evt);
}
});
turnoutTable.setAutoCreateRowSorter(true);
turnoutSorter = new TableRowSorter<>(turnoutTable.getModel());
turnoutTable.setRowSorter(turnoutSorter);
List<RowSorter.SortKey> turnoutSortKeys = new ArrayList<>();
//int columnIndexToSort = 1;
turnoutSortKeys.add(new RowSorter.SortKey(sensorTable.getColumn(Bundle.getMessage("FieldTableIndexColumn")).getModelIndex(), SortOrder.ASCENDING));
turnoutSorter.setSortKeys(turnoutSortKeys);
turnoutSorter.setSortable(sensorTable.getColumn(Bundle.getMessage("FieldTableDeleteColumn")).getModelIndex(), false);
turnoutSorter.sort();
JScrollPane outputScrollPanel = new JScrollPane();
outputModel = new OutputTableModel();
outputTable = new JTable(outputModel);
outputTable.setFillsViewportHeight(true);
outputScrollPanel.getViewport().add(outputTable);
outputTable.setPreferredScrollableViewportSize(new Dimension(520, 200));
outputTable.getColumn(Bundle.getMessage("FieldTableDeleteColumn")).setCellRenderer(new ButtonRenderer());
outputTable.removeColumn(outputTable.getColumn("isNew"));
outputTable.removeColumn(outputTable.getColumn("isDirty"));
outputTable.removeColumn(outputTable.getColumn("isDelete"));
outputTable.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent evt) {
handleTableMouseClick(outputTable, evt);
}
});
outputTable.setAutoCreateRowSorter(true);
outputSorter = new TableRowSorter<>(outputTable.getModel());
outputTable.setRowSorter(outputSorter);
List<RowSorter.SortKey> outputSortKeys = new ArrayList<>();
//int columnIndexToSort = 1;
outputSortKeys.add(new RowSorter.SortKey(sensorTable.getColumn(Bundle.getMessage("FieldTableIndexColumn")).getModelIndex(), SortOrder.ASCENDING));
outputSorter.setSortKeys(outputSortKeys);
outputSorter.setSortable(sensorTable.getColumn(Bundle.getMessage("FieldTableDeleteColumn")).getModelIndex(), false);
outputSorter.sort();
tabbedPane = new JTabbedPane();
tabbedPane.addTab(Bundle.getMessage("FieldSensorsTabTitle"), sensorScrollPanel);
tabbedPane.setToolTipTextAt(0, Bundle.getMessage("ToolTipSensorTab"));
// NOI18N
tabbedPane.setMnemonicAt(0, Mnemonics.get("SensorTab"));
tabbedPane.addTab(Bundle.getMessage("FieldTurnoutsTabTitle"), turnoutScrollPanel);
tabbedPane.setToolTipTextAt(0, Bundle.getMessage("ToolTipTurnoutTab"));
// NOI18N
tabbedPane.setMnemonicAt(0, Mnemonics.get("TurnoutTab"));
tabbedPane.addTab(Bundle.getMessage("FieldOutputsTabTitle"), outputScrollPanel);
tabbedPane.setToolTipTextAt(0, Bundle.getMessage("ToolTipOutputTab"));
// NOI18N
tabbedPane.setMnemonicAt(0, Mnemonics.get("OutputTab"));
cTab = CurrentTab.SENSOR;
tabbedPane.setSelectedIndex(0);
tabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
switch(tabbedPane.getSelectedIndex()) {
case 2:
// Set Add to "Add Output"
cTab = CurrentTab.OUTPUT;
addButton.setText(Bundle.getMessage("ButtonAddOutput"));
saveButton.setText(Bundle.getMessage("ButtonSaveOutputs"));
log.debug("Current Tab is: {}", tabbedPane.getSelectedIndex());
break;
case 1:
// Set Add to "Add Turnout"
cTab = CurrentTab.TURNOUT;
addButton.setText(Bundle.getMessage("ButtonAddTurnout"));
saveButton.setText(Bundle.getMessage("ButtonSaveTurnouts"));
log.debug("Current Tab is: {}", tabbedPane.getSelectedIndex());
break;
case 0:
default:
// Set Add to "Add Sensor"
cTab = CurrentTab.SENSOR;
addButton.setText(Bundle.getMessage("ButtonAddSensor"));
saveButton.setText(Bundle.getMessage("ButtonSaveSensors"));
log.debug("Current Tab is: {}", tabbedPane.getSelectedIndex());
}
}
});
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel buttonPane2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPane.add(addButton);
buttonPane.add(saveButton);
buttonPane2.add(closeButton);
this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
this.getContentPane().add(tabbedPane);
this.getContentPane().add(buttonPane);
this.getContentPane().add(buttonPane2);
this.pack();
this.setVisible(true);
}
Aggregations