use of javax.swing.ButtonGroup in project knime-core by knime.
the class ParallelCoordinatesViewPanel method createViewTypeMenu.
/**
* @return - a JMenu entry handling the view type.
*/
public JMenu createViewTypeMenu() {
JMenu menu = new JMenu("View Type");
menu.setMnemonic('V');
ActionListener actL = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (e.getActionCommand().equals(POPUP_ALL_VISIBLE)) {
// set view to ALL VISIBLE
setViewType(ALL_VISIBLE);
((JRadioButtonMenuItem) e.getSource()).firePropertyChange(POPUP_ALL_VISIBLE, false, true);
repaint();
} else if (e.getActionCommand().equals(POPUP_HIDE_UNHILITED)) {
// set view to HIDE_UNHILITED
setViewType(HIDE_UNHILITED);
unselectUnhilited();
((JRadioButtonMenuItem) e.getSource()).firePropertyChange(POPUP_HIDE_UNHILITED, false, true);
repaint();
} else if (e.getActionCommand().equals(POPUP_FADE_UNHILITED)) {
// set view to FADE_UNHILITED
setViewType(FADE_UNHILITED);
unselectUnhilited();
((JRadioButtonMenuItem) e.getSource()).firePropertyChange(POPUP_FADE_UNHILITED, false, true);
repaint();
}
}
};
ButtonGroup group = new ButtonGroup();
// JMenuItem item
JMenuItem item = new JRadioButtonMenuItem(POPUP_ALL_VISIBLE);
item.setSelected(m_viewType == ALL_VISIBLE);
item.addActionListener(actL);
item.setMnemonic('A');
item.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent e) {
((JRadioButtonMenuItem) e.getSource()).setSelected(m_viewType == ALL_VISIBLE);
}
});
group.add(item);
menu.add(item);
item = new JRadioButtonMenuItem(POPUP_HIDE_UNHILITED);
item.setSelected(m_viewType == HIDE_UNHILITED);
item.addActionListener(actL);
item.setMnemonic('H');
item.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent e) {
((JRadioButtonMenuItem) e.getSource()).setSelected(m_viewType == HIDE_UNHILITED);
}
});
group.add(item);
menu.add(item);
item = new JRadioButtonMenuItem(POPUP_FADE_UNHILITED);
item.setSelected(m_viewType == FADE_UNHILITED);
item.addActionListener(actL);
item.setMnemonic('F');
item.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent e) {
((JRadioButtonMenuItem) e.getSource()).setSelected(m_viewType == FADE_UNHILITED);
}
});
group.add(item);
menu.add(item);
return menu;
}
use of javax.swing.ButtonGroup in project knime-core by knime.
the class ScatterPlotter method fillPopupMenu.
/**
* {@inheritDoc}
*/
@Override
protected void fillPopupMenu(final JPopupMenu menu) {
if (m_hiliteMenu == null) {
m_hiliteMenu = getHiLiteMenu();
}
boolean dotsSelected;
if ((getScatterPlotterDrawingPane().getSelectedSet() != null) && (getScatterPlotterDrawingPane().getSelectedSet().size() > 0)) {
dotsSelected = true;
} else {
dotsSelected = false;
}
String selCnt = "Selected: " + getScatterPlotterDrawingPane().getSelectedSet().size();
boolean clearPossible = m_hiliteHdlr.getHiLitKeys().size() > 0;
String hilite = POPUP_HILITE_SELECTED;
if (m_hiliteHdlr == null) {
hilite = "<no hilit hdl>";
dotsSelected = false;
}
String unhilite = POPUP_UNHILITE_SELECTED;
if (m_hiliteHdlr == null) {
unhilite = "<no hilit hdl>";
dotsSelected = false;
}
String clearhilite = POPUP_CLEAR_HILITED;
JMenuItem item;
/* --- "Selected: xxx" --- */
item = new JMenuItem(selCnt);
item.setEnabled(false);
menu.add(item);
menu.addSeparator();
/* --- "hilite selected" --- */
item = new JMenuItem(hilite);
item.setEnabled(dotsSelected);
item.addActionListener(this);
menu.add(item);
/* --- "unhilite selected" --- */
item = new JMenuItem(unhilite);
item.setEnabled(dotsSelected && clearPossible);
item.addActionListener(this);
menu.add(item);
/* --- "clear hilite" --- */
item = new JMenuItem(clearhilite);
item.setEnabled(clearPossible);
item.addActionListener(this);
menu.add(item);
/* ------------------------------ */
menu.addSeparator();
ButtonGroup group = new ButtonGroup();
/* --- "[ ] show unhilited" --- */
item = new JRadioButtonMenuItem(POPUP_SHOW, (!getFadeUnHiLited() && !isHideUnHiLited()));
item.addActionListener(this);
group.add(item);
menu.add(item);
/* --- "[ ] fade unhilited" --- */
item = new JRadioButtonMenuItem(POPUP_FADE, getFadeUnHiLited());
item.addActionListener(this);
group.add(item);
menu.add(item);
/* --- "[ ] hide unhilited" --- */
item = new JRadioButtonMenuItem(POPUP_HIDE, isHideUnHiLited());
item.addActionListener(this);
group.add(item);
menu.add(item);
}
use of javax.swing.ButtonGroup in project vcell by virtualcell.
the class PDEDataViewer method sendTimeSeriesImageJ.
// private Hashtable<String, JLabel> sendTimeSeriesLabels = new Hashtable<>();
// @Override
// public void exportMessage(ExportEvent event) {
// super.exportMessage(event);
// if(sendTimeSeriesLabels.size() > 0){
// JLabel messgLabel = sendTimeSeriesLabels.values().iterator().next();
// SwingUtilities.invokeLater(new Runnable() {
// @Override
// public void run() {
// messgLabel.setText(event.getMessageData().toString());
// }
// });
// }
// }
private void sendTimeSeriesImageJ() {
final JPanel mainJPanel = new JPanel();
BoxLayout mainBL = new BoxLayout(mainJPanel, BoxLayout.Y_AXIS);
mainJPanel.setLayout(mainBL);
final boolean[] response = new boolean[] { false };
MiniTimePanel timeJPanel = new MiniTimePanel();
final JLabel messgLabel = new JLabel("time points to export:" + (timeJPanel.jcb_time_end.getSelectedIndex() - timeJPanel.jcb_time_begin.getSelectedIndex() + 1));
JRadioButton slicebtn = new JRadioButton("Slice " + getPDEDataContextPanel1().getSlice() + " only");
slicebtn.setSelected(true);
JPanel messageAndSlicePanel = null;
if (getPdeDataContext().getCartesianMesh().getGeometryDimension() == 3) {
messageAndSlicePanel = new JPanel();
((FlowLayout) messageAndSlicePanel.getLayout()).setAlignment(FlowLayout.LEFT);
ButtonGroup buttonGroup = new ButtonGroup();
JRadioButton allslicebtn = new JRadioButton("All slices");
buttonGroup.add(slicebtn);
buttonGroup.add(allslicebtn);
messageAndSlicePanel.add(messgLabel);
messageAndSlicePanel.add(slicebtn);
messageAndSlicePanel.add(allslicebtn);
}
ActionListener okAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (((Double) timeJPanel.jcb_time_begin.getSelectedItem()).compareTo((Double) timeJPanel.jcb_time_end.getSelectedItem()) > 0) {
PopupGenerator.showErrorDialog(PDEDataViewer.this, "Selected 'Begin Time' must be less than or equal to 'End Time'");
return;
}
response[0] = true;
BeanUtils.disposeParentWindow(mainJPanel);
}
};
ActionListener cancelAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
BeanUtils.disposeParentWindow(mainJPanel);
}
};
final OkCancelSubPanel okCancelJPanel = new OkCancelSubPanel(okAction, cancelAction);
ActionListener rangeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int range = timeJPanel.jcb_time_end.getSelectedIndex() - timeJPanel.jcb_time_begin.getSelectedIndex() + 1;
okCancelJPanel.okButton.setEnabled(range > 0);
messgLabel.setText((range < 0 ? "Error: begin time must be < end time" : "time points to export:" + (range)));
}
};
timeJPanel.jcb_time_end.addActionListener(rangeListener);
timeJPanel.jcb_time_begin.addActionListener(rangeListener);
okCancelJPanel.okButton.setEnabled(true);
mainJPanel.add(timeJPanel);
mainJPanel.add((messageAndSlicePanel == null ? messgLabel : messageAndSlicePanel));
mainJPanel.add(okCancelJPanel);
Frame dialogOwner = JOptionPane.getFrameForComponent(this);
JOptionPane inputDialog = new JOptionPane(mainJPanel, JOptionPane.PLAIN_MESSAGE, 0, null, new Object[0]);
final JDialog d = inputDialog.createDialog(dialogOwner, "'" + getSimulationModelInfo().getContextName() + "':'" + getSimulationModelInfo().getSimulationName() + "':'" + getPdeDataContext().getVariableName() + "'");
d.setResizable(true);
d.setModal(true);
d.pack();
d.setVisible(true);
// }
if (!response[0]) {
return;
}
ExportSpecs exportSpecs = new ExportSpecs(getPdeDataContext().getVCDataIdentifier(), ExportFormat.IMAGEJ, new VariableSpecs(new String[] { getPdeDataContext().getDataIdentifier().getName() }, ExportConstants.VARIABLE_MULTI), new TimeSpecs(timeJPanel.jcb_time_begin.getSelectedIndex(), timeJPanel.jcb_time_end.getSelectedIndex(), getPdeDataContext().getTimePoints(), ExportConstants.TIME_RANGE), new GeometrySpecs(null, getPDEDataContextPanel1().getNormalAxis(), getPDEDataContextPanel1().getSlice(), (slicebtn.isSelected() ? ExportConstants.GEOMETRY_SLICE : ExportConstants.GEOMETRY_FULL)), new RasterSpecs(ExportConstants.NRRD_BY_VARIABLE, false), getSimulationModelInfo().getSimulationName(), getSimulationModelInfo().getContextName());
getDataViewerManager().startExport(this, ((ClientPDEDataContext) getPdeDataContext()).getDataManager().getOutputContext(), exportSpecs);
}
use of javax.swing.ButtonGroup in project Course_Generator by patrovite.
the class frmFillCoeff method initComponents.
private void initComponents() {
int line = 0;
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(bundle.getString("frmFillCoeff.title"));
setAlwaysOnTop(true);
setResizable(false);
setMinimumSize(new Dimension(300, 400));
setType(java.awt.Window.Type.UTILITY);
// -- Layout
// ------------------------------------------------------------
Container paneGlobal = getContentPane();
paneGlobal.setLayout(new GridBagLayout());
// == Panel start
panelStart = new JPanel();
panelStart.setLayout(new GridBagLayout());
// Start
panelStart.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmFillCoeff.panelStart.Title")));
panelStart.setLayout(new GridBagLayout());
Utils.addComponent(paneGlobal, panelStart, 0, 0, 1, 1, 0, 0, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// From the start
rbFromStart = new JRadioButton(bundle.getString("frmFillCoeff.rbFromStart.Text"));
rbFromStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelStart, rbFromStart, 0, 0, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// From line
rbFromLine = new JRadioButton(bundle.getString("frmFillCoeff.rbFromLine.Text"));
rbFromLine.setSelected(true);
rbFromLine.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelStart, rbFromLine, 0, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
groupStart = new ButtonGroup();
groupStart.add(rbFromStart);
groupStart.add(rbFromLine);
spinFromLine = new CgSpinner(100, 1, 100, 1);
Utils.addComponent(panelStart, spinFromLine, 1, 1, 1, 1, 1, 0, 5, 5, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbFromValue = new JLabel(bundle.getString("frmFillCoeff.lbFromValue.Text"));
Utils.addComponent(panelStart, lbFromValue, 0, 2, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
spinFromValue = new CgSpinnerDouble(100.0, 0.1, 200.0, 0.1);
Utils.addComponent(panelStart, spinFromValue, 1, 2, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// == Panel end
panelEnd = new JPanel();
panelEnd.setLayout(new GridBagLayout());
// End
panelEnd.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmFillCoeff.panelEnd.Title")));
panelEnd.setLayout(new GridBagLayout());
Utils.addComponent(paneGlobal, panelEnd, 0, 1, 1, 1, 0, 0, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// To the end
rbToEnd = new JRadioButton(bundle.getString("frmFillCoeff.rbToEnd.Text"));
rbToEnd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelEnd, rbToEnd, 0, 0, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// To line
rbToLine = new JRadioButton(bundle.getString("frmFillCoeff.rbToLine.Text"));
rbToLine.setSelected(true);
rbToLine.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelEnd, rbToLine, 0, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
groupEnd = new ButtonGroup();
groupEnd.add(rbToEnd);
groupEnd.add(rbToLine);
spinToLine = new CgSpinner(100, 1, 100, 1);
Utils.addComponent(panelEnd, spinToLine, 1, 1, 1, 1, 1, 0, 5, 5, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbToValue = new JLabel(bundle.getString("frmFillCoeff.lbToValue.Text"));
Utils.addComponent(panelEnd, lbToValue, 0, 2, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
spinToValue = new CgSpinnerDouble(100.0, 0.1, 200.0, 0.1);
Utils.addComponent(panelEnd, spinToValue, 1, 2, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// == Panel help
panelHelp = new JPanel();
panelHelp.setLayout(new GridBagLayout());
// Difficulty
panelHelp.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmFillCoeff.panelHelp.Title")));
Utils.addComponent(paneGlobal, panelHelp, 0, 2, 1, 1, 1, 1, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
panelEstimateTime = new JPanel();
panelEstimateTime.setLayout(new GridBagLayout());
Utils.addComponent(panelHelp, panelEstimateTime, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
lbEstimateTime = new JLabel(bundle.getString("frmFillCoeff.lbEstimateTime.Text"));
Utils.addComponent(panelEstimateTime, lbEstimateTime, 0, 0, GridBagConstraints.REMAINDER, 1, 1, 0, 5, 5, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
lbHour = new JLabel(bundle.getString("frmFillCoeff.lbHour.Text"));
Utils.addComponent(panelEstimateTime, lbHour, 0, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
spinHour = new CgSpinner(0, 0, 999, 1);
Utils.addComponent(panelEstimateTime, spinHour, 1, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbMinute = new JLabel(bundle.getString("frmFillCoeff.lbMinute.Text"));
Utils.addComponent(panelEstimateTime, lbMinute, 2, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
spinMinute = new CgSpinner(0, 0, 59, 1);
Utils.addComponent(panelEstimateTime, spinMinute, 3, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
btCalc = new javax.swing.JButton(bundle.getString("frmFillCoeff.btCalc.text"));
btCalc.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Calc();
Refresh();
}
});
Utils.addComponent(panelEstimateTime, btCalc, 4, 1, 1, 1, 1, 0, 5, 5, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
// --
panelResult = new JPanel();
panelResult.setLayout(new GridBagLayout());
Utils.addComponent(panelHelp, panelResult, 0, 1, 1, 1, 1, 1, 10, 0, 10, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
lbResultCoeff = new JLabel(bundle.getString("frmFillCoeff.lbResultCoeff.Text"));
Utils.addComponent(panelResult, lbResultCoeff, 0, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
lbResultCoeffVal = new JLabel("0.0", JLabel.CENTER);
lbResultCoeffVal.setBorder(BorderFactory.createLineBorder(Color.GRAY));
lbResultCoeffVal.setOpaque(true);
lbResultCoeffVal.setBackground(Color.WHITE);
lbResultCoeffVal.setPreferredSize(new Dimension(60, 20));
Utils.addComponent(panelResult, lbResultCoeffVal, 1, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
btCopyToStart = new javax.swing.JButton(bundle.getString("frmFillCoeff.btCopyToStart.text"));
btCopyToStart.setToolTipText(bundle.getString("frmFillCoeff.btCopyToStart.toolTipText"));
btCopyToStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
spinFromValue.setValue(estimatedCoeff);
}
});
Utils.addComponent(panelResult, btCopyToStart, 2, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
btCopyToEnd = new javax.swing.JButton(bundle.getString("frmFillCoeff.btCopyToEnd.text"));
btCopyToEnd.setToolTipText(bundle.getString("frmFillCoeff.btCopyToEnd.toolTipText"));
btCopyToEnd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
spinToValue.setValue(estimatedCoeff);
}
});
Utils.addComponent(panelResult, btCopyToEnd, 3, 1, 1, 1, 0, 0, 5, 5, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// == BUTTONS
// ===========================================================
jPanelButtons = new javax.swing.JPanel();
jPanelButtons.setLayout(new FlowLayout());
Utils.addComponent(paneGlobal, jPanelButtons, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL);
btCancel = new javax.swing.JButton();
btCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/cancel.png")));
btCancel.setText(bundle.getString("Global.btCancel.text"));
btCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
setVisible(false);
}
});
btOk = new javax.swing.JButton();
btOk.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/valid.png")));
btOk.setText(bundle.getString("Global.btOk.text"));
btOk.setMinimumSize(btCancel.getMinimumSize());
btOk.setPreferredSize(btCancel.getPreferredSize());
btOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RequestToClose();
}
});
// -- Add buttons
jPanelButtons.add(btOk);
jPanelButtons.add(btCancel);
// --
pack();
setLocationRelativeTo(null);
}
use of javax.swing.ButtonGroup in project Course_Generator by patrovite.
the class frmFillDiff method initComponents.
private void initComponents() {
int line = 0;
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(bundle.getString("frmFillDiff.title"));
setAlwaysOnTop(true);
setResizable(false);
setMinimumSize(new Dimension(300, 400));
setType(java.awt.Window.Type.UTILITY);
// -- Layout
// ------------------------------------------------------------
Container paneGlobal = getContentPane();
paneGlobal.setLayout(new GridBagLayout());
// == Panel start
panelStart = new JPanel();
panelStart.setLayout(new GridBagLayout());
// Start
panelStart.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmFillDiff.panelStart.Title")));
panelStart.setLayout(new GridBagLayout());
Utils.addComponent(paneGlobal, panelStart, 0, 0, 1, 1, 0, 0, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// From the start
rbFromStart = new JRadioButton(bundle.getString("frmFillDiff.rbFromStart.Text"));
rbFromStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelStart, rbFromStart, 0, 0, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// From line
rbFromLine = new JRadioButton(bundle.getString("frmFillDiff.rbFromLine.Text"));
rbFromLine.setSelected(true);
rbFromLine.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelStart, rbFromLine, 0, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
groupStart = new ButtonGroup();
groupStart.add(rbFromStart);
groupStart.add(rbFromLine);
spinFromLine = new CgSpinner(100, 1, 100, 1);
Utils.addComponent(panelStart, spinFromLine, 1, 1, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.EAST, GridBagConstraints.NONE);
// == Panel end
panelEnd = new JPanel();
panelEnd.setLayout(new GridBagLayout());
// End
panelEnd.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmFillDiff.panelEnd.Title")));
panelEnd.setLayout(new GridBagLayout());
Utils.addComponent(paneGlobal, panelEnd, 0, 1, 1, 1, 0, 0, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// To the end
rbToEnd = new JRadioButton(bundle.getString("frmFillDiff.rbToEnd.Text"));
rbToEnd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelEnd, rbToEnd, 0, 0, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// To line
rbToLine = new JRadioButton(bundle.getString("frmFillDiff.rbToLine.Text"));
rbToLine.setSelected(true);
rbToLine.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelEnd, rbToLine, 0, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
groupEnd = new ButtonGroup();
groupEnd.add(rbToEnd);
groupEnd.add(rbToLine);
spinToLine = new CgSpinner(100, 1, 100, 1);
Utils.addComponent(panelEnd, spinToLine, 1, 1, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.EAST, GridBagConstraints.NONE);
// == Panel difficulty
panelDiff = new JPanel();
panelDiff.setLayout(new GridBagLayout());
// Difficulty
panelDiff.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmFillDiff.panelDiff.Title")));
panelDiff.setLayout(new GridBagLayout());
Utils.addComponent(paneGlobal, panelDiff, 0, 2, 1, 1, 1, 1, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// Very easy
rbVeryEasy = new JRadioButton(bundle.getString("frmFillDiff.rbVeryEasy.Text"));
rbVeryEasy.setOpaque(true);
rbVeryEasy.setBackground(CgConst.CL_DIFF_VERYEASY);
rbVeryEasy.setSelected(true);
rbVeryEasy.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelDiff, rbVeryEasy, 0, 0, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// Easy
rbEasy = new JRadioButton(bundle.getString("frmFillDiff.rbEasy.Text"));
rbEasy.setOpaque(true);
rbEasy.setBackground(CgConst.CL_DIFF_EASY);
rbEasy.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelDiff, rbEasy, 0, 1, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// Average
rbAverage = new JRadioButton(bundle.getString("frmFillDiff.rbAverage.Text"));
rbAverage.setOpaque(true);
rbAverage.setBackground(CgConst.CL_DIFF_AVERAGE);
rbAverage.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelDiff, rbAverage, 0, 2, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// Hard
rbHard = new JRadioButton(bundle.getString("frmFillDiff.rbHard.Text"));
rbHard.setOpaque(true);
rbHard.setBackground(CgConst.CL_DIFF_HARD);
rbHard.setForeground(Color.WHITE);
rbHard.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelDiff, rbHard, 0, 3, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// Very hard
rbVeryHard = new JRadioButton(bundle.getString("frmFillDiff.rbVeryHard.Text"));
rbVeryHard.setOpaque(true);
rbVeryHard.setBackground(CgConst.CL_DIFF_VERYHARD);
rbVeryHard.setForeground(Color.WHITE);
rbVeryHard.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelDiff, rbVeryHard, 0, 4, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// Other
rbOther = new JRadioButton(bundle.getString("frmFillDiff.rbOther.Text"));
rbOther.setOpaque(true);
rbOther.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Refresh();
}
});
Utils.addComponent(panelDiff, rbOther, 0, 5, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
groupDiff = new ButtonGroup();
groupDiff.add(rbVeryEasy);
groupDiff.add(rbEasy);
groupDiff.add(rbAverage);
groupDiff.add(rbHard);
groupDiff.add(rbVeryHard);
groupDiff.add(rbOther);
spinDiff = new CgSpinner(100, 1, 100, 1);
Utils.addComponent(panelDiff, spinDiff, 1, 5, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.EAST, GridBagConstraints.NONE);
// == BUTTONS
// ===========================================================
jPanelButtons = new javax.swing.JPanel();
jPanelButtons.setLayout(new FlowLayout());
Utils.addComponent(paneGlobal, jPanelButtons, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL);
btCancel = new javax.swing.JButton();
btCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/cancel.png")));
btCancel.setText(bundle.getString("Global.btCancel.text"));
btCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
setVisible(false);
}
});
btOk = new javax.swing.JButton();
btOk.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/valid.png")));
btOk.setText(bundle.getString("Global.btOk.text"));
btOk.setMinimumSize(btCancel.getMinimumSize());
btOk.setPreferredSize(btCancel.getPreferredSize());
btOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RequestToClose();
}
});
// -- Add buttons
jPanelButtons.add(btOk);
jPanelButtons.add(btCancel);
// --
pack();
setLocationRelativeTo(null);
}
Aggregations