use of javax.swing.JRadioButton in project JMRI by JMRI.
the class PreferencesPane method throttleTab.
private JPanel throttleTab() {
throttletabpanel.setLayout(new BoxLayout(throttletabpanel, BoxLayout.Y_AXIS));
JLabel _throttleLabel = new JLabel("This option control what happens to a loco on the ECoS Database that has been specifically created to enable a throttle to be used");
_throttleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
throttletabpanel.add(_throttleLabel);
/*_throttleLabel = new JLabel("specifically created to enable a throttle to be used");
throttletabpanel.add(_throttleLabel);*/
_throttleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
_adhocLocoEcosAsk = new JRadioButton("Always ask when quiting JMRI");
_adhocLocoEcosLeave = new JRadioButton("Always leave the Loco in the Ecos Database");
_adhocLocoEcosRemove = new JRadioButton("Always remove the Loco from the Ecos Database");
switch(ep.getAdhocLocoFromEcos()) {
case 0:
_adhocLocoEcosAsk.setSelected(true);
break;
case 1:
_adhocLocoEcosLeave.setSelected(true);
break;
case 2:
_adhocLocoEcosRemove.setSelected(true);
break;
default:
_adhocLocoEcosAsk.setSelected(true);
break;
}
_adhocLocoEcos = new ButtonGroup();
_adhocLocoEcos.add(_adhocLocoEcosAsk);
_adhocLocoEcos.add(_adhocLocoEcosLeave);
_adhocLocoEcos.add(_adhocLocoEcosRemove);
JPanel adhocEcosGroup = new JPanel();
adhocEcosGroup.setLayout(new BoxLayout(adhocEcosGroup, BoxLayout.Y_AXIS));
adhocEcosGroup.add(_adhocLocoEcosAsk);
adhocEcosGroup.add(_adhocLocoEcosLeave);
adhocEcosGroup.add(_adhocLocoEcosRemove);
adhocEcosGroup.setAlignmentX(Component.CENTER_ALIGNMENT);
throttletabpanel.add(adhocEcosGroup);
/*throttletabpanel.add(_adhocLocoEcosAsk);
throttletabpanel.add(_adhocLocoEcosLeave);
throttletabpanel.add(_adhocLocoEcosRemove);*/
throttletabpanel.add(new JSeparator(SwingConstants.HORIZONTAL));
_throttleLabel = new JLabel("If JMRI can not get control of a loco, this sets how JMRI should react.");
_throttleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
throttletabpanel.add(_throttleLabel);
_forceControlLocoEcosAsk = new JRadioButton("Always ask when attempting to take control of a loco");
_forceControlLocoEcosNever = new JRadioButton("Never force control of a Loco");
_forceControlLocoEcosAlways = new JRadioButton("Always force control of a Loco");
switch(ep.getForceControlFromEcos()) {
case 0x00:
_forceControlLocoEcosAsk.setSelected(true);
break;
case 0x01:
_forceControlLocoEcosNever.setSelected(true);
break;
case 0x02:
_forceControlLocoEcosAlways.setSelected(true);
break;
default:
_forceControlLocoEcosAsk.setSelected(true);
break;
}
_locoEcosControl = new ButtonGroup();
_locoEcosControl.add(_forceControlLocoEcosAsk);
_locoEcosControl.add(_forceControlLocoEcosNever);
_locoEcosControl.add(_forceControlLocoEcosAlways);
JPanel locoEcosControlGroup = new JPanel();
locoEcosControlGroup.setLayout(new BoxLayout(locoEcosControlGroup, BoxLayout.Y_AXIS));
locoEcosControlGroup.add(_forceControlLocoEcosAsk);
locoEcosControlGroup.add(_forceControlLocoEcosNever);
locoEcosControlGroup.add(_forceControlLocoEcosAlways);
locoEcosControlGroup.setAlignmentX(Component.CENTER_ALIGNMENT);
throttletabpanel.add(locoEcosControlGroup);
/*throttletabpanel.add(new JSeparator(SwingConstants.HORIZONTAL));
JPanel _defaultprotocolpanel = new JPanel();
JLabel _defaultprotocolLabel = new JLabel("Sets the Default protocol to use for an Adhoc Loco");
_defaultprotocolpanel.add(_defaultprotocolLabel);
_defaultProtocol = new JComboBox<String>();
initializeEcosProtocolCombo(_defaultProtocol);
if (ep.getLocoMaster()!=0x00)
setEcosProtocolType(_defaultProtocol, ep.getDefaultEcosProtocol());
defaultprotocolpanel.add(_defaultProtocol);
throttletabpanel.add(_defaultprotocolpanel);*/
throttletabpanel.add(new JSeparator(SwingConstants.HORIZONTAL));
_locoControl = new ButtonGroup();
_locoControlNormal = new JRadioButton("Always gracefully gain control");
_locoControlForce = new JRadioButton("Always force loco control");
_locoControl.add(_locoControlNormal);
_locoControl.add(_locoControlForce);
if (ep.getLocoControl()) {
_locoControlForce.setSelected(true);
} else {
_locoControlNormal.setSelected(true);
}
JLabel _locoControlLabel = new JLabel("How should JMRI attempt to take contol of a loco?");
JPanel locoControlGroup = new JPanel();
locoControlGroup.add(_locoControlLabel);
locoControlGroup.setLayout(new BoxLayout(locoControlGroup, BoxLayout.Y_AXIS));
locoControlGroup.add(_locoControlNormal);
locoControlGroup.add(_locoControlForce);
locoControlGroup.setAlignmentX(Component.CENTER_ALIGNMENT);
throttletabpanel.add(locoControlGroup);
return throttletabpanel;
}
use of javax.swing.JRadioButton in project JMRI by JMRI.
the class NcePacketMonitorPanel method initComponents.
@Override
public void initComponents(NceSystemConnectionMemo m) throws Exception {
this.memo = m;
// populate the GUI, invoked as part of startup
// load the port selection part
portBox.setToolTipText("Select the port to use");
portBox.setAlignmentX(JLabel.LEFT_ALIGNMENT);
Vector<String> v = getPortNames();
for (int i = 0; i < v.size(); i++) {
portBox.addItem(v.elementAt(i));
}
openPortButton.setText("Open");
openPortButton.setToolTipText("Configure program to use selected port");
openPortButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
openPortButtonActionPerformed(evt);
//} catch (jmri.jmrix.SerialConfigException ex) {
// log.error("Error while opening port. Did you select the right one?\n"+ex);
} catch (java.lang.UnsatisfiedLinkError ex) {
log.error("Error while opening port. Did you select the right one?\n" + ex);
}
}
});
{
JSeparator js = new JSeparator();
js.setMaximumSize(new Dimension(10000, 10));
add(js);
}
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JLabel("Serial port: "));
p1.add(portBox);
p1.add(openPortButton);
p1.setMaximumSize(p1.getPreferredSize());
add(p1);
// add user part of GUI
{
JSeparator js = new JSeparator();
js.setMaximumSize(new Dimension(10000, 10));
add(js);
}
JPanel p2 = new JPanel();
{
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
checkButton.setToolTipText("?");
checkButton.setEnabled(false);
p.add(checkButton);
checkButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (checkButton.isSelected()) {
sendBytes(new byte[] { (byte) '?' });
checkButton.setText("Res.");
checkButton.setToolTipText("Resume packet monitoring");
} else {
sendBytes(new byte[] { (byte) ' ' });
checkButton.setText("Info");
checkButton.setToolTipText("?");
}
}
});
truncateCheckBox.setToolTipText("Check this box to suppress identical packets");
p.add(truncateCheckBox);
p2.add(p);
}
{
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
ButtonGroup g = new ButtonGroup();
JRadioButton b;
b = new JRadioButton("Verbose");
b.setToolTipText("V");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'V' });
}
});
b = new JRadioButton("Hex with preamble symbol");
b.setToolTipText("H0");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'H', (byte) '0' });
}
});
p2.add(p);
b = new JRadioButton("(as above with spaces)");
b.setToolTipText("H1");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'H', (byte) '1' });
}
});
p2.add(p);
b = new JRadioButton("Hex without preamble symbol");
b.setToolTipText("H2");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'H', (byte) '2' });
}
});
p2.add(p);
b = new JRadioButton("(as above with spaces)");
b.setToolTipText("H3");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'H', (byte) '3' });
}
});
p2.add(p);
b = new JRadioButton("Hex with preamble count in hex");
b.setToolTipText("H4");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'H', (byte) '4' });
}
});
p2.add(p);
b = new JRadioButton("(as above with spaces)");
b.setToolTipText("H5");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'H', (byte) '5' });
}
});
p2.add(p);
}
// end hex/verbose group
{
// start acc off/on
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
ButtonGroup g = new ButtonGroup();
JRadioButton b;
b = new JRadioButton("Hide acc packets");
b.setToolTipText("A-");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'A', (byte) '-' });
}
});
b = new JRadioButton("Show acc packets");
b.setToolTipText("A+");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'A', (byte) '+' });
}
});
p2.add(p);
}
// end acc off/on
{
// start idle off/on
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
ButtonGroup g = new ButtonGroup();
JRadioButton b;
b = new JRadioButton("Hide idle packets");
b.setToolTipText("I-");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'I', (byte) '-' });
}
});
b = new JRadioButton("Show idle packets");
b.setToolTipText("I+");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'I', (byte) '+' });
}
});
p2.add(p);
}
// end idle off/on
{
// start loco off/on
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
ButtonGroup g = new ButtonGroup();
JRadioButton b;
locoSpeedButton.setToolTipText("L-");
g.add(locoSpeedButton);
p.add(locoSpeedButton);
locoSpeedButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'L', (byte) '-' });
}
});
b = new JRadioButton("Show loco packets");
b.setToolTipText("L+");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'L', (byte) '+' });
}
});
p2.add(p);
}
// end loco off/on
{
// start reset off/on
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
ButtonGroup g = new ButtonGroup();
JRadioButton b;
b = new JRadioButton("Hide reset packets");
b.setToolTipText("R-");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'R', (byte) '-' });
}
});
b = new JRadioButton("Show reset packets");
b.setToolTipText("R+");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'R', (byte) '+' });
}
});
p2.add(p);
}
// end reset off/on
{
// start signal on/off
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
ButtonGroup g = new ButtonGroup();
JRadioButton b;
b = new JRadioButton("Hide signal packets");
b.setToolTipText("S-");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'S', (byte) '-' });
}
});
b = new JRadioButton("Show signal packets");
b.setToolTipText("S+");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'S', (byte) '+' });
}
});
p2.add(p);
}
// end signal off/on
{
// Monitor command acc single/double
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
JLabel t = new JLabel("Monitor Command");
p.add(t);
ButtonGroup g = new ButtonGroup();
JRadioButton b;
b = new JRadioButton("Acc addresses single");
b.setToolTipText("AS");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'A', (byte) 'S' });
}
});
b = new JRadioButton("Acc addresses paired");
b.setToolTipText("AP");
g.add(b);
p.add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendBytes(new byte[] { (byte) 'A', (byte) 'P' });
}
});
p2.add(p);
}
// end acc single/double
p2.setMaximumSize(p2.getPreferredSize());
JScrollPane ps = new JScrollPane(p2);
ps.setMaximumSize(ps.getPreferredSize());
ps.setVisible(true);
add(ps);
}
use of javax.swing.JRadioButton in project processdash by dtuma.
the class UserGroupEditor method promptForName.
private Object[] promptForName(String resKey, String resArg, String defaultName, boolean isCustom, boolean showCustom) {
String title = resources.getString(resKey + "_Title");
String prompt;
if (resArg == null)
prompt = resources.getString(resKey + "_Prompt");
else
prompt = resources.format(resKey + "_Prompt_FMT", resArg);
JTextField nameField = new JTextField(defaultName);
Object[] typePanel = null;
JRadioButton sharedOption, customOption = null;
if (showCustom) {
String typePrompt = resources.getString("Type_Prompt");
Border indent = BorderFactory.createEmptyBorder(0, 20, 0, 0);
sharedOption = new JRadioButton(resources.getString("Type_Shared"));
sharedOption.setBorder(indent);
customOption = new JRadioButton(resources.getString("Type_Custom"));
customOption.setBorder(indent);
if (readOnlyCode != null) {
sharedOption.setEnabled(false);
sharedOption.setToolTipText("<html><div style='width:250px'>" + resources.getHTML(resKey + "_Error." + readOnlyCode) + "</div></html>");
new ToolTipTimingCustomizer().install(sharedOption);
isCustom = true;
}
ButtonGroup bg = new ButtonGroup();
bg.add(sharedOption);
bg.add(customOption);
(isCustom ? customOption : sharedOption).setSelected(true);
typePanel = new Object[] { " ", typePrompt, sharedOption, customOption };
}
Object message = new Object[] { prompt, nameField, typePanel, new JOptionPaneTweaker.GrabFocus(nameField) };
PROMPT: while (true) {
// prompt the user for the new name
nameField.selectAll();
int userChoice = JOptionPane.showConfirmDialog(userInterface, message, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (userChoice != JOptionPane.OK_OPTION)
return null;
// if they did not enter a name, display an error
String name = nameField.getText().trim();
if (!StringUtils.hasValue(name)) {
JOptionPane.showMessageDialog(userInterface, resources.getString("Name_Missing"), resources.getString("Name_Error_Title"), JOptionPane.ERROR_MESSAGE);
continue PROMPT;
}
// when renaming, if they did not alter the value, abort.
if (defaultName != null && name.equals(defaultName))
return null;
// make a note of whether this is a custom group.
boolean custom = showCustom ? customOption.isSelected() : isCustom;
// if they entered a duplicate name, display an error
for (int i = groups.size(); i-- > 0; ) {
UserGroup g = (UserGroup) groups.get(i);
if (g.isCustom() == custom && g.getDisplayName().equals(name)) {
JOptionPane.showMessageDialog(userInterface, resources.format("Name_Duplicate_FMT", name), resources.getString("Name_Error_Title"), JOptionPane.ERROR_MESSAGE);
continue PROMPT;
}
}
// all seems OK. Return the values the user selected.
return new Object[] { name, custom };
}
}
use of javax.swing.JRadioButton in project MassBank-web by MassBank.
the class SearchPage method createWindow.
/**
* �E�C���h�E����
*/
private void createWindow() {
// �c�[���`�b�v�}�l�[�W���[�ݒ�
ToolTipManager ttm = ToolTipManager.sharedInstance();
ttm.setInitialDelay(50);
ttm.setDismissDelay(8000);
// Search�p�l��
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
Border border = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(1, 1, 1, 1));
mainPanel.setBorder(border);
// *********************************************************************
// User File Query�^�u
// *********************************************************************
DefaultTableModel fileDm = new DefaultTableModel();
fileSorter = new TableSorter(fileDm, TABLE_QUERY_FILE);
queryFileTable = new JTable(fileSorter) {
@Override
public boolean isCellEditable(int row, int column) {
// �I�[�o�[���C�h�ŃZ���ҏW��s�Ƃ���
return false;
}
};
queryFileTable.addMouseListener(new TblMouseListener());
fileSorter.setTableHeader(queryFileTable.getTableHeader());
queryFileTable.setRowSelectionAllowed(true);
queryFileTable.setColumnSelectionAllowed(false);
queryFileTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
String[] col = { COL_LABEL_NO, COL_LABEL_NAME, COL_LABEL_ID };
((DefaultTableModel) fileSorter.getTableModel()).setColumnIdentifiers(col);
(queryFileTable.getColumn(queryFileTable.getColumnName(0))).setPreferredWidth(44);
(queryFileTable.getColumn(queryFileTable.getColumnName(1))).setPreferredWidth(LEFT_PANEL_WIDTH - 44);
(queryFileTable.getColumn(queryFileTable.getColumnName(2))).setPreferredWidth(70);
ListSelectionModel lm = queryFileTable.getSelectionModel();
lm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
lm.addListSelectionListener(new LmFileListener());
queryFilePane = new JScrollPane(queryFileTable);
queryFilePane.addMouseListener(new PaneMouseListener());
queryFilePane.setPreferredSize(new Dimension(300, 300));
// *********************************************************************
// Result�^�u
// *********************************************************************
DefaultTableModel resultDm = new DefaultTableModel();
resultSorter = new TableSorter(resultDm, TABLE_RESULT);
resultTable = new JTable(resultSorter) {
@Override
public String getToolTipText(MouseEvent me) {
// super.getToolTipText(me);
// �I�[�o�[���C�h�Ńc�[���`�b�v�̕������Ԃ�
Point pt = me.getPoint();
int row = rowAtPoint(pt);
if (row < 0) {
return null;
} else {
int nameCol = getColumnModel().getColumnIndex(COL_LABEL_NAME);
return " " + getValueAt(row, nameCol) + " ";
}
}
@Override
public boolean isCellEditable(int row, int column) {
// �I�[�o�[���C�h�ŃZ���ҏW��s�Ƃ���
return false;
}
};
resultTable.addMouseListener(new TblMouseListener());
resultSorter.setTableHeader(resultTable.getTableHeader());
JPanel dbPanel = new JPanel();
dbPanel.setLayout(new BorderLayout());
resultPane = new JScrollPane(resultTable);
resultPane.addMouseListener(new PaneMouseListener());
resultTable.setRowSelectionAllowed(true);
resultTable.setColumnSelectionAllowed(false);
resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
String[] col2 = { COL_LABEL_NAME, COL_LABEL_SCORE, COL_LABEL_HIT, COL_LABEL_ID, COL_LABEL_ION, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO };
resultDm.setColumnIdentifiers(col2);
(resultTable.getColumn(resultTable.getColumnName(0))).setPreferredWidth(LEFT_PANEL_WIDTH - 180);
(resultTable.getColumn(resultTable.getColumnName(1))).setPreferredWidth(70);
(resultTable.getColumn(resultTable.getColumnName(2))).setPreferredWidth(20);
(resultTable.getColumn(resultTable.getColumnName(3))).setPreferredWidth(70);
(resultTable.getColumn(resultTable.getColumnName(4))).setPreferredWidth(20);
(resultTable.getColumn(resultTable.getColumnName(5))).setPreferredWidth(70);
(resultTable.getColumn(resultTable.getColumnName(6))).setPreferredWidth(50);
ListSelectionModel lm2 = resultTable.getSelectionModel();
lm2.addListSelectionListener(new LmResultListener());
resultPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, 200));
dbPanel.add(resultPane, BorderLayout.CENTER);
// *********************************************************************
// DB Query�^�u
// *********************************************************************
DefaultTableModel dbDm = new DefaultTableModel();
querySorter = new TableSorter(dbDm, TABLE_QUERY_DB);
queryDbTable = new JTable(querySorter) {
@Override
public boolean isCellEditable(int row, int column) {
// �I�[�o�[���C�h�ŃZ���ҏW��s�Ƃ���
return false;
}
};
queryDbTable.addMouseListener(new TblMouseListener());
querySorter.setTableHeader(queryDbTable.getTableHeader());
queryDbPane = new JScrollPane(queryDbTable);
queryDbPane.addMouseListener(new PaneMouseListener());
int h = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
queryDbPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, h));
queryDbTable.setRowSelectionAllowed(true);
queryDbTable.setColumnSelectionAllowed(false);
queryDbTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
String[] col3 = { COL_LABEL_ID, COL_LABEL_NAME, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO };
DefaultTableModel model = (DefaultTableModel) querySorter.getTableModel();
model.setColumnIdentifiers(col3);
// �Z�b�g
queryDbTable.getColumn(queryDbTable.getColumnName(0)).setPreferredWidth(70);
queryDbTable.getColumn(queryDbTable.getColumnName(1)).setPreferredWidth(LEFT_PANEL_WIDTH - 70);
queryDbTable.getColumn(queryDbTable.getColumnName(2)).setPreferredWidth(70);
queryDbTable.getColumn(queryDbTable.getColumnName(3)).setPreferredWidth(50);
ListSelectionModel lm3 = queryDbTable.getSelectionModel();
lm3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
lm3.addListSelectionListener(new LmQueryDbListener());
// �{�^���p�l��
JPanel btnPanel = new JPanel();
btnName.addActionListener(new BtnSearchNameListener());
btnAll.addActionListener(new BtnAllListener());
btnPanel.add(btnName);
btnPanel.add(btnAll);
parentPanel2 = new JPanel();
parentPanel2.setLayout(new BoxLayout(parentPanel2, BoxLayout.PAGE_AXIS));
parentPanel2.add(btnPanel);
parentPanel2.add(queryDbPane);
// �I�v�V�����p�l��
JPanel dispModePanel = new JPanel();
isDispSelected = dispSelected.isSelected();
isDispRelated = dispRelated.isSelected();
if (isDispSelected) {
resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
} else if (isDispRelated) {
resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
Object[] retRadio = new Object[] { dispSelected, dispRelated };
for (int i = 0; i < retRadio.length; i++) {
((JRadioButton) retRadio[i]).addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (isDispSelected != dispSelected.isSelected() || isDispRelated != dispRelated.isSelected()) {
isDispSelected = dispSelected.isSelected();
isDispRelated = dispRelated.isSelected();
// ���ʃ��R�[�h�I����Ԃ�����
resultTable.clearSelection();
resultPlot.clear();
compPlot.setPeaks(null, 1);
resultPlot.setPeaks(null, 0);
setAllPlotAreaRange();
pkgView.initResultRecInfo();
if (isDispSelected) {
resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
} else if (isDispRelated) {
resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
}
}
});
}
ButtonGroup disGroup = new ButtonGroup();
disGroup.add(dispSelected);
disGroup.add(dispRelated);
dispModePanel.add(lbl2);
dispModePanel.add(dispSelected);
dispModePanel.add(dispRelated);
JPanel paramPanel = new JPanel();
paramPanel.add(etcPropertyButton);
etcPropertyButton.setMargin(new Insets(0, 10, 0, 10));
etcPropertyButton.addActionListener(new ActionListener() {
private ParameterSetWindow ps = null;
public void actionPerformed(ActionEvent e) {
// �q��ʂ��J���Ă��Ȃ���ΐ���
if (!isSubWindow) {
ps = new ParameterSetWindow();
} else {
ps.requestFocus();
}
}
});
JPanel optionPanel = new JPanel();
optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS));
optionPanel.add(dispModePanel);
optionPanel.add(paramPanel);
// PackageView�����y�сA������
pkgView = new PackageViewPanel();
pkgView.initAllRecInfo();
queryTabPane.addTab("DB", parentPanel2);
queryTabPane.setToolTipTextAt(TAB_ORDER_DB, "Query from DB.");
queryTabPane.addTab("File", queryFilePane);
queryTabPane.setToolTipTextAt(TAB_ORDER_FILE, "Query from user file.");
queryTabPane.setSelectedIndex(TAB_ORDER_DB);
queryTabPane.setFocusable(false);
queryTabPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
// �v���b�g�y�C��������
queryPlot.clear();
compPlot.clear();
resultPlot.clear();
queryPlot.setPeaks(null, 0);
compPlot.setPeaks(null, 1);
resultPlot.setPeaks(null, 0);
// PackageView������
pkgView.initAllRecInfo();
// DB Hit�^�u�֘A������
if (resultTabPane.getTabCount() > 0) {
resultTabPane.setSelectedIndex(0);
}
DefaultTableModel dataModel = (DefaultTableModel) resultSorter.getTableModel();
dataModel.setRowCount(0);
hitLabel.setText(" ");
// DB�^�u�AUser File�^�u�̑I���ς݃��R�[�h���f����
queryTabPane.update(queryTabPane.getGraphics());
if (queryTabPane.getSelectedIndex() == TAB_ORDER_DB) {
parentPanel2.update(parentPanel2.getGraphics());
updateSelectQueryTable(queryDbTable);
} else if (queryTabPane.getSelectedIndex() == TAB_ORDER_FILE) {
queryFilePane.update(queryFilePane.getGraphics());
updateSelectQueryTable(queryFileTable);
}
}
});
// ���C�A�E�g
JPanel queryPanel = new JPanel();
queryPanel.setLayout(new BorderLayout());
queryPanel.add(queryTabPane, BorderLayout.CENTER);
queryPanel.add(optionPanel, BorderLayout.SOUTH);
queryPanel.setMinimumSize(new Dimension(0, 170));
JPanel jtp2Panel = new JPanel();
jtp2Panel.setLayout(new BorderLayout());
jtp2Panel.add(dbPanel, BorderLayout.CENTER);
jtp2Panel.add(hitLabel, BorderLayout.SOUTH);
jtp2Panel.setMinimumSize(new Dimension(0, 70));
Color colorGreen = new Color(0, 128, 0);
hitLabel.setForeground(colorGreen);
resultTabPane.addTab("Result", jtp2Panel);
resultTabPane.setToolTipTextAt(TAB_RESULT_DB, "Result of DB hit.");
resultTabPane.setFocusable(false);
queryPlot.setMinimumSize(new Dimension(0, 100));
compPlot.setMinimumSize(new Dimension(0, 120));
resultPlot.setMinimumSize(new Dimension(0, 100));
int height = initAppletHight / 3;
JSplitPane jsp_cmp2db = new JSplitPane(JSplitPane.VERTICAL_SPLIT, compPlot, resultPlot);
JSplitPane jsp_qry2cmp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPlot, jsp_cmp2db);
jsp_cmp2db.setDividerLocation(height);
jsp_qry2cmp.setDividerLocation(height - 25);
jsp_qry2cmp.setMinimumSize(new Dimension(190, 0));
viewTabPane.addTab("Compare View", jsp_qry2cmp);
viewTabPane.addTab("Package View", pkgView);
viewTabPane.setToolTipTextAt(TAB_VIEW_COMPARE, "Comparison of query and result spectrum.");
viewTabPane.setToolTipTextAt(TAB_VIEW_PACKAGE, "Package comparison of query and result spectrum.");
viewTabPane.setSelectedIndex(TAB_VIEW_COMPARE);
viewTabPane.setFocusable(false);
JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPanel, resultTabPane);
jsp.setDividerLocation(310);
jsp.setMinimumSize(new Dimension(180, 0));
jsp.setOneTouchExpandable(true);
JSplitPane jsp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jsp, viewTabPane);
int divideSize = (int) (initAppletWidth * 0.4);
divideSize = (divideSize >= 180) ? divideSize : 180;
jsp2.setDividerLocation(divideSize);
jsp2.setOneTouchExpandable(true);
mainPanel.add(jsp2, BorderLayout.CENTER);
add(mainPanel);
queryPlot.setSearchPage(this);
compPlot.setSearchPage(this);
resultPlot.setSearchPage(this);
}
use of javax.swing.JRadioButton in project knime-core by knime.
the class RuleEngineFilter2PortsNodeDialog method addAppendOrReplace.
/**
* {@inheritDoc}
* Adds radio buttons for selecting the output content.
*/
@Override
protected void addAppendOrReplace(final JPanel panel, final GridBagConstraints gbc) {
m_top = new JRadioButton(m_ruleType.topText());
m_bottom = new JRadioButton(m_ruleType.bottomText());
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(m_top);
buttonGroup.add(m_bottom);
gbc.gridx = 0;
gbc.gridwidth = 1;
gbc.weightx = 0;
if (m_ruleType == RuleNodeSettings.RuleSplitter) {
panel.add(new JLabel("TRUE matches go to:"), gbc);
}
gbc.gridx++;
panel.add(m_top, gbc);
gbc.gridx++;
gbc.gridx++;
panel.add(m_bottom, gbc);
gbc.gridy++;
}
Aggregations