use of course_generator.utils.CgSpinner in project Course_Generator by patrovite.
the class FrmMiniroadbook method initComponents.
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(bundle.getString("FrmMiniroadbook.title"));
setAlwaysOnTop(true);
setPreferredSize(new Dimension(1000, 700));
setType(java.awt.Window.Type.NORMAL);
// -- Layout
// ------------------------------------------------------------
Container paneGlobal = getContentPane();
paneGlobal.setLayout(new BorderLayout());
// -- Toolbar
Create_Toolbar();
paneGlobal.add(ToolBarMRB, BorderLayout.NORTH);
// -- Split bar (vertical)
// -----------------------------------------
SplitPane = new javax.swing.JSplitPane();
SplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
paneGlobal.add(SplitPane, BorderLayout.CENTER);
// -- Top panel
pnlTop = new JPanel();
pnlTop.setLayout(new GridBagLayout());
SplitPane.setTopComponent(pnlTop);
// -- Bottom panel
pnlBottom = new JPanel();
pnlBottom.setLayout(new GridBagLayout());
SplitPane.setBottomComponent(pnlBottom);
// == Panel properties
pnlProperties = new JPanel();
pnlProperties.setLayout(new GridBagLayout());
Utils.addComponent(pnlTop, pnlProperties, 0, 0, 1, 1, 0, 1, 5, 10, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Selection
lbSelect = new javax.swing.JLabel(bundle.getString("FrmMiniroadbook.lbSelect.Text"));
lbSelect.setMinimumSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, lbSelect, 0, 0, 1, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
chkSelect = new javax.swing.JCheckBox();
chkSelect.setMinimumSize(new Dimension(100, 25));
chkSelect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
if (line > track.data.size())
return;
if (chkSelect.isSelected()) {
track.data.get(line).OptionMiniRoadbook = Utils.Set(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_SEL);
datalist.data.get(row).OptionMiniRoadbook = Utils.Set(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_SEL);
} else {
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_SEL);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_SEL);
}
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, chkSelect, 1, 0, GridBagConstraints.REMAINDER, 1, 1, 0, 10, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Position
lbPosition = new javax.swing.JLabel(bundle.getString("FrmMiniroadbook.lbPosition.Text"));
lbPosition.setPreferredSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, lbPosition, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
spinPosition = new CgSpinner(0, 0, 1000, 1);
spinPosition.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent arg0) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
if (line > track.data.size())
return;
track.data.get(line).VPosMiniRoadbook = spinPosition.getValueAsInt();
datalist.data.get(row).VPosMiniRoadbook = spinPosition.getValueAsInt();
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, spinPosition, 1, 1, GridBagConstraints.REMAINDER, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Alignement
lbAlignement = new javax.swing.JLabel(bundle.getString("FrmMiniroadbook.lbAlignement.Text"));
lbAlignement.setPreferredSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, lbAlignement, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btAlignLeft = new javax.swing.JButton();
btAlignLeft = new javax.swing.JButton("|<");
btAlignLeft.setToolTipText(bundle.getString("FrmMiniroadbook.btAlignLeft.toolTipText"));
btAlignLeft.setFocusable(false);
btAlignLeft.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
track.data.get(line).OptionMiniRoadbook = Utils.Set(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_LEFT);
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_CENTER);
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_RIGHT);
datalist.data.get(row).OptionMiniRoadbook = Utils.Set(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_LEFT);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_CENTER);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_RIGHT);
RefreshAligmentBt(row);
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, btAlignLeft, 1, 2, 1, 1, 0.33, 0, 0, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btAlignCenter = new javax.swing.JButton();
btAlignCenter = new javax.swing.JButton("|");
btAlignCenter.setToolTipText(bundle.getString("FrmMiniroadbook.btAlignCenter.toolTipText"));
btAlignCenter.setFocusable(false);
btAlignCenter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_LEFT);
track.data.get(line).OptionMiniRoadbook = Utils.Set(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_CENTER);
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_RIGHT);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_LEFT);
datalist.data.get(row).OptionMiniRoadbook = Utils.Set(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_CENTER);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_RIGHT);
RefreshAligmentBt(row);
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, btAlignCenter, 2, 2, 1, 1, 0.33, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btAlignRight = new javax.swing.JButton();
btAlignRight = new javax.swing.JButton(">|");
btAlignRight.setToolTipText(bundle.getString("FrmMiniroadbook.btAlignRight.toolTipText"));
btAlignRight.setFocusable(false);
btAlignRight.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_LEFT);
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_CENTER);
track.data.get(line).OptionMiniRoadbook = Utils.Set(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_RIGHT);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_LEFT);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_CENTER);
datalist.data.get(row).OptionMiniRoadbook = Utils.Set(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_RIGHT);
RefreshAligmentBt(row);
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, btAlignRight, 3, 2, 1, 1, 0.33, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Format
lbFormat = new javax.swing.JLabel(bundle.getString("FrmMiniroadbook.lbFormat.Text"));
lbFormat.setPreferredSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, lbFormat, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
tfFormat = new JTextFieldLimit(200);
tfFormat.addFocusListener(this);
tfFormat.setToolTipText(bundle.getString("FrmMiniroadbook.tfFormat.toolTipText"));
tfFormat.setPreferredSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, tfFormat, 1, 3, 2, 1, 1, 0, 0, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btFormat = new javax.swing.JButton("...");
btFormat.setPreferredSize(new Dimension(100, 25));
btFormat.setToolTipText(bundle.getString("FrmMiniroadbook.btFormat.toolTipText"));
btFormat.setFocusable(false);
btFormat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
FrmEditMrbFormat frm = new FrmEditMrbFormat(settings);
tfFormat.setText(frm.showDialog(track.data.get(line), track, tfFormat.getText()));
track.data.get(line).FmtLbMiniRoadbook = tfFormat.getText();
datalist.data.get(row).FmtLbMiniRoadbook = tfFormat.getText();
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, btFormat, 3, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Size
lbSize = new javax.swing.JLabel(bundle.getString("FrmMiniroadbook.lbSize.Text"));
lbSize.setPreferredSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, lbSize, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
spinSize = new CgSpinner(10, 7, 72, 1);
spinSize.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent arg0) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
track.data.get(line).FontSizeMiniRoadbook = spinSize.getValueAsInt();
datalist.data.get(row).FontSizeMiniRoadbook = spinSize.getValueAsInt();
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, spinSize, 1, 4, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Tags
lbTags = new javax.swing.JLabel(bundle.getString("FrmMiniroadbook.Tags.Text"));
lbTags.setMinimumSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, lbTags, 0, 5, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
chkTags = new javax.swing.JCheckBox();
chkTags.setMinimumSize(new Dimension(100, 25));
chkTags.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (datalist.data.isEmpty())
return;
int row = TableData.getSelectedRow();
if (row < 0)
return;
int line = (int) datalist.data.get(row).getNum() - 1;
if (line > track.data.size())
return;
if (chkTags.isSelected()) {
track.data.get(line).OptionMiniRoadbook = Utils.Set(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_SHOWTAGS);
datalist.data.get(row).OptionMiniRoadbook = Utils.Set(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_SHOWTAGS);
} else {
track.data.get(line).OptionMiniRoadbook = Utils.Reset(track.data.get(line).OptionMiniRoadbook, CgConst.MRBOPT_SHOWTAGS);
datalist.data.get(row).OptionMiniRoadbook = Utils.Reset(datalist.data.get(row).OptionMiniRoadbook, CgConst.MRBOPT_SHOWTAGS);
}
track.isModified = true;
pnlProfil.Refresh();
}
});
Utils.addComponent(pnlProperties, chkTags, 1, 5, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Comment
lbComment = new javax.swing.JLabel(bundle.getString("FrmMiniroadbook.lbComment.Text"));
lbComment.setMinimumSize(new Dimension(100, 25));
Utils.addComponent(pnlProperties, lbComment, 0, 6, 1, 1, 0, 1, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
tfComment = new JTextFieldLimit(200);
tfComment.addFocusListener(this);
Utils.addComponent(pnlProperties, tfComment, 1, 6, GridBagConstraints.REMAINDER, 1, 1, 1, 0, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Panel data
TableData = new javax.swing.JTable();
// new ParamPointsModel(param));
TableData.setModel(modelTableData);
TableData.getTableHeader().setReorderingAllowed(false);
TableData.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
RefreshProperties();
pnlProfil.setSelLine(TableData.getSelectedRow());
}
});
TableData.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
RefreshProperties();
pnlProfil.setSelLine(TableData.getSelectedRow());
}
});
jScrollPaneData = new javax.swing.JScrollPane();
jScrollPaneData.setViewportView(TableData);
Utils.addComponent(pnlTop, jScrollPaneData, 1, 0, 1, 1, 1, 1, 10, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
pnlProfil = new PanelProfilMRB(640, 480);
jScrollPaneProfil = new javax.swing.JScrollPane();
jScrollPaneProfil.setViewportView(pnlProfil);
Utils.addComponent(pnlBottom, jScrollPaneProfil, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
pack();
setLocationRelativeTo(null);
}
use of course_generator.utils.CgSpinner in project Course_Generator by patrovite.
the class frmEditPosition method initComponents.
private void initComponents() {
int line = 0;
// jPanelMainWindowsColor = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(bundle.getString("frmEditPosition.title"));
setAlwaysOnTop(true);
setResizable(false);
setMinimumSize(new Dimension(1000, 400));
setType(java.awt.Window.Type.UTILITY);
// -- Layout
// ------------------------------------------------------------
Container paneGlobal = getContentPane();
paneGlobal.setLayout(new GridBagLayout());
// == Left panel
panelLeft = new JPanel();
panelLeft.setBorder(BorderFactory.createLineBorder(Color.GRAY));
panelLeft.setBackground(Color.WHITE);
panelLeft.setOpaque(true);
panelLeft.setLayout(new GridBagLayout());
Utils.addComponent(paneGlobal, panelLeft, 0, 0, 1, 1, 0, 1, 10, 10, 20, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Line
line = 0;
lbLine = new javax.swing.JLabel();
Font font = lbLine.getFont();
font = font.deriveFont(Collections.singletonMap(TextAttribute.WEIGHT, TextAttribute.WEIGHT_EXTRABOLD));
lbLine.setFont(font);
// "Line"
lbLine.setText(bundle.getString("frmEditPosition.lbLine.Text"));
Utils.addComponent(panelLeft, lbLine, 0, line, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbLineVal = new javax.swing.JLabel();
Utils.addComponent(panelLeft, lbLineVal, 1, line++, 1, 1, 1, 0, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// ======================================================================
// -- Latitude
lbLatitude = new javax.swing.JLabel();
lbLatitude.setFont(font);
// "Latitude"
lbLatitude.setText(bundle.getString("frmEditPosition.lbLatitude.Text"));
Utils.addComponent(panelLeft, lbLatitude, 0, line, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbLatitudeVal = new javax.swing.JLabel();
Utils.addComponent(panelLeft, lbLatitudeVal, 1, line++, 1, 1, 0, 0, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Longitude
lbLongitude = new javax.swing.JLabel();
lbLongitude.setFont(font);
// "Longitude"
lbLongitude.setText(bundle.getString("frmEditPosition.lbLongitude.Text"));
Utils.addComponent(panelLeft, lbLongitude, 0, line, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbLongitudeVal = new javax.swing.JLabel();
Utils.addComponent(panelLeft, lbLongitudeVal, 1, line++, 1, 1, 1, 0, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// ======================================================================
// -- Distance
lbDistance = new javax.swing.JLabel();
lbDistance.setFont(font);
// "Distance"
lbDistance.setText(bundle.getString("frmEditPosition.lbDistance.Text"));
Utils.addComponent(panelLeft, lbDistance, 0, line, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbDistanceVal = new javax.swing.JLabel();
Utils.addComponent(panelLeft, lbDistanceVal, 1, line++, 1, 1, 0, 0, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Total
lbTotal = new javax.swing.JLabel();
lbTotal.setFont(font);
// "Total distance"
lbTotal.setText(bundle.getString("frmEditPosition.lbTotal.Text"));
Utils.addComponent(panelLeft, lbTotal, 0, line, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbTotalVal = new javax.swing.JLabel();
Utils.addComponent(panelLeft, lbTotalVal, 1, line++, 1, 1, 1, 0, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// ======================================================================
// -- Time
lbTime = new javax.swing.JLabel();
lbTime.setFont(font);
// "Time"
lbTime.setText(bundle.getString("frmEditPosition.lbTime.Text"));
Utils.addComponent(panelLeft, lbTime, 0, line, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbTimeVal = new javax.swing.JLabel();
Utils.addComponent(panelLeft, lbTimeVal, 1, line++, 1, 1, 0, 0, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Hour
lbHour = new javax.swing.JLabel();
lbHour.setFont(font);
// "Hour"
lbHour.setText(bundle.getString("frmEditPosition.lbHout.Text"));
Utils.addComponent(panelLeft, lbHour, 0, line, 1, 1, 0, 1, 5, 10, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbHourVal = new javax.swing.JLabel();
Utils.addComponent(panelLeft, lbHourVal, 1, line++, 1, 1, 1, 1, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// == Right panel
line = 0;
panelRight = new JPanel();
panelRight.setLayout(new GridBagLayout());
Utils.addComponent(paneGlobal, panelRight, 1, 0, 1, 1, 1, 1, 10, 10, 20, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Name
lbName = new javax.swing.JLabel();
lbName.setFont(font);
// "Name"
lbName.setText(bundle.getString("frmEditPosition.lbName.Text"));
Utils.addComponent(panelRight, lbName, 0, line, 1, 1, 0, 0, 0, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// tfName = new javax.swing.JTextField(16);
tfName = new JTextFieldLimit(40);
Utils.addComponent(panelRight, tfName, 1, line, 10, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
lbNameHelp = new javax.swing.JLabel("", new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/help_dialog.png")), JLabel.LEFT);
lbNameHelp.setToolTipText(bundle.getString("frmEditPosition.lbNameHelp.toolTipText"));
Utils.addComponent(panelRight, lbNameHelp, 11, line++, 1, 1, 0, 0, 0, 5, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Elevation
lbElevation = new javax.swing.JLabel();
lbElevation.setFont(font);
// "Elevation"
lbElevation.setText(bundle.getString("frmEditPosition.lbElevation.Text"));
Utils.addComponent(panelRight, lbElevation, 0, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
spinElevation = new CgSpinner(0, 0, 100000, 1);
Utils.addComponent(panelRight, spinElevation, 1, line, 3, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
lbElevationHelp = new javax.swing.JLabel("", new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/attention.png")), JLabel.LEFT);
lbElevationHelp.setToolTipText(bundle.getString("frmEditPosition.lbElevationHelp.toolTipText"));
Utils.addComponent(panelRight, lbElevationHelp, 4, line++, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Tags
lbTags = new javax.swing.JLabel();
lbTags.setFont(font);
// "Tags"
lbTags.setText(bundle.getString("frmEditPosition.lbTags.Text"));
Utils.addComponent(panelRight, lbTags, 0, line, 1, 1, 0, 0, 0, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Tag : Mark
lbMark = new javax.swing.JLabel(// "Mark position",
bundle.getString("frmEditPosition.lbMark.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/flag.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbMark, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkMark = new javax.swing.JCheckBox();
Utils.addComponent(panelRight, chkMark, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : High point
lbHighPoint = new javax.swing.JLabel(// "High point",
bundle.getString("frmEditPosition.lbHighPoint.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/high_point.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbHighPoint, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkHighPoint = new javax.swing.JCheckBox();
chkHighPoint.setBackground(Color.GREEN);
chkHighPoint.setOpaque(true);
chkHighPoint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (chkHighPoint.isSelected() && chkLowPoint.isSelected()) {
chkLowPoint.setSelected(false);
}
}
});
Utils.addComponent(panelRight, chkHighPoint, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : Low point
lbLowPoint = new javax.swing.JLabel(// "Low point",
bundle.getString("frmEditPosition.lbLowPoint.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/low_point.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbLowPoint, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkLowPoint = new javax.swing.JCheckBox();
chkLowPoint.setBackground(Color.GREEN);
chkLowPoint.setOpaque(true);
chkLowPoint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (chkLowPoint.isSelected() && chkHighPoint.isSelected()) {
chkHighPoint.setSelected(false);
}
}
});
Utils.addComponent(panelRight, chkLowPoint, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : eat station
lbEat = new javax.swing.JLabel(// "Eat station",
bundle.getString("frmEditPosition.lbEat.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/eat.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbEat, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkEat = new javax.swing.JCheckBox();
chkEat.setBackground(Color.YELLOW);
chkEat.setOpaque(true);
chkEat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (chkEat.isSelected() && chkDrink.isSelected()) {
chkDrink.setSelected(false);
}
}
});
Utils.addComponent(panelRight, chkEat, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : drink station
lbDrink = new javax.swing.JLabel(// "Drink station",
bundle.getString("frmEditPosition.lbDrink.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/drink.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbDrink, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkDrink = new javax.swing.JCheckBox();
chkDrink.setBackground(Color.YELLOW);
chkDrink.setOpaque(true);
chkDrink.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (chkDrink.isSelected() && chkEat.isSelected()) {
chkEat.setSelected(false);
}
}
});
Utils.addComponent(panelRight, chkDrink, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : Place to see
lbPhoto = new javax.swing.JLabel(// "Place to see",
bundle.getString("frmEditPosition.lbPhoto.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/photo.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbPhoto, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkPhoto = new javax.swing.JCheckBox();
Utils.addComponent(panelRight, chkPhoto, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : note
lbNote = new javax.swing.JLabel(// "Note",
bundle.getString("frmEditPosition.lbNote.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/note.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbNote, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkNote = new javax.swing.JCheckBox();
Utils.addComponent(panelRight, chkNote, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : info
lbInfo = new javax.swing.JLabel(// "Information",
bundle.getString("frmEditPosition.lbInfo.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/info.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbInfo, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkInfo = new javax.swing.JCheckBox();
Utils.addComponent(panelRight, chkInfo, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Tag : Roadbook
lbRoadbook = new javax.swing.JLabel(// "Roadbook",
bundle.getString("frmEditPosition.lbRoadbook.Text"), new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/roadbook.png")), JLabel.LEFT);
Utils.addComponent(panelRight, lbRoadbook, 1, line, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
chkRoadbook = new javax.swing.JCheckBox();
Utils.addComponent(panelRight, chkRoadbook, 2, line++, 1, 1, 0, 0, 5, 5, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
// -- Diff
lbDiff = new javax.swing.JLabel();
lbDiff.setFont(font);
// "Difficulty"
lbDiff.setText(bundle.getString("frmEditPosition.lbDiff.Text"));
Utils.addComponent(panelRight, lbDiff, 0, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
spinDiff = new CgSpinner(100, 1, 100, 1);
Utils.addComponent(panelRight, spinDiff, 1, line, 3, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
lbDiffHelp = new javax.swing.JLabel("", new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/help_dialog.png")), JLabel.LEFT);
lbDiffHelp.setToolTipText(bundle.getString("frmEditPosition.lbDiffHelp.toolTipText"));
Utils.addComponent(panelRight, lbDiffHelp, 4, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btVeryEasy = new javax.swing.JButton();
btVeryEasy.setOpaque(true);
btVeryEasy.setBackground(Color.WHITE);
btVeryEasy.setToolTipText(bundle.getString("frmEditPosition.btVeryEasy.toolTipText"));
btVeryEasy.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
spinDiff.setValue(100);
}
});
Utils.addComponent(panelRight, btVeryEasy, 5, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btEasy = new javax.swing.JButton();
btEasy.setOpaque(true);
btEasy.setBackground(Color.GREEN);
btEasy.setToolTipText(bundle.getString("frmEditPosition.btEasy.toolTipText"));
btEasy.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
spinDiff.setValue(98);
}
});
Utils.addComponent(panelRight, btEasy, 6, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btAverage = new javax.swing.JButton();
btAverage.setOpaque(true);
btAverage.setBackground(Color.BLUE);
btAverage.setToolTipText(bundle.getString("frmEditPosition.btAverage.toolTipText"));
btAverage.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
spinDiff.setValue(95);
}
});
Utils.addComponent(panelRight, btAverage, 7, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btHard = new javax.swing.JButton();
btHard.setOpaque(true);
btHard.setBackground(Color.RED);
btHard.setToolTipText(bundle.getString("frmEditPosition.btHard.toolTipText"));
btHard.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
spinDiff.setValue(88);
}
});
Utils.addComponent(panelRight, btHard, 8, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
btVeryHard = new javax.swing.JButton();
btVeryHard.setOpaque(true);
btVeryHard.setBackground(Color.BLACK);
btVeryHard.setToolTipText(bundle.getString("frmEditPosition.btVeryHard.toolTipText"));
btVeryHard.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
spinDiff.setValue(80);
}
});
Utils.addComponent(panelRight, btVeryHard, 9, line++, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Coeff
lbCoeff = new javax.swing.JLabel();
lbCoeff.setFont(font);
// "Health coefficient"
lbCoeff.setText(bundle.getString("frmEditPosition.lbCoeff.Text"));
Utils.addComponent(panelRight, lbCoeff, 0, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
spinCoeff = new CgSpinnerDouble(100.0, 0.1, 200.0, 0.1);
Utils.addComponent(panelRight, spinCoeff, 1, line, 3, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
lbCoeffHelp = new javax.swing.JLabel("", new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/help_dialog.png")), JLabel.LEFT);
lbCoeffHelp.setToolTipText(bundle.getString("frmEditPosition.lbCoeffHelp.toolTipText"));
Utils.addComponent(panelRight, lbCoeffHelp, 4, line++, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Recup
lbRecovery = new javax.swing.JLabel();
lbRecovery.setFont(font);
// "Recovery"
lbRecovery.setText(bundle.getString("frmEditPosition.lbRecovery.Text"));
Utils.addComponent(panelRight, lbRecovery, 0, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
spinRecovery = new CgSpinnerDouble(0.0, 0.0, 100.0, 0.1);
Utils.addComponent(panelRight, spinRecovery, 1, line, 3, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
lbRecoveryHelp = new javax.swing.JLabel("", new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/help_dialog.png")), JLabel.LEFT);
lbRecoveryHelp.setToolTipText(bundle.getString("frmEditPosition.lbRecoveryHelp.toolTipText"));
Utils.addComponent(panelRight, lbRecoveryHelp, 4, line++, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Time limit
lbTimelimit = new javax.swing.JLabel();
lbTimelimit.setFont(font);
// "Time limit"
lbTimelimit.setText(bundle.getString("frmEditPosition.lbTimelimit.Text"));
Utils.addComponent(panelRight, lbTimelimit, 0, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.WEST, GridBagConstraints.BOTH);
hsTimelimit = new JTimeSetting(999);
Utils.addComponent(panelRight, hsTimelimit, 1, line, 3, 1, 0, 0, 5, 0, 0, 10, GridBagConstraints.WEST, GridBagConstraints.VERTICAL);
lbTimelimitHelp = new javax.swing.JLabel("", new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/help_dialog.png")), JLabel.LEFT);
lbTimelimitHelp.setToolTipText(bundle.getString("frmEditPosition.lbTimelimitHelp.toolTipText"));
Utils.addComponent(panelRight, lbTimelimitHelp, 4, line++, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Station
lbStation = new javax.swing.JLabel();
lbStation.setFont(font);
// "Station time"
lbStation.setText(bundle.getString("frmEditPosition.lbStation.Text"));
Utils.addComponent(panelRight, lbStation, 0, line, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.WEST, GridBagConstraints.BOTH);
// new JHourSetting();
hsStation = new JTimeSetting(999);
Utils.addComponent(panelRight, hsStation, 1, line, 3, 1, 0, 0, 5, 0, 0, 10, GridBagConstraints.WEST, GridBagConstraints.VERTICAL);
lbStationHelp = new javax.swing.JLabel("", new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/help_dialog.png")), JLabel.LEFT);
lbStationHelp.setToolTipText(bundle.getString("frmEditPosition.lbStationHelp.toolTipText"));
Utils.addComponent(panelRight, lbStationHelp, 4, line++, 1, 1, 0, 0, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// -- Comment
lbComment = new javax.swing.JLabel();
lbComment.setFont(font);
// "Comment"
lbComment.setText(bundle.getString("frmEditPosition.lbComment.Text"));
Utils.addComponent(panelRight, lbComment, 0, line, 1, 1, 0, 1, 5, 0, 0, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
tfComment = new javax.swing.JTextField();
Utils.addComponent(panelRight, tfComment, 1, line++, GridBagConstraints.REMAINDER, 1, 1, 1, 5, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
// == BUTTONS
// ===========================================================
jPanelButtons = new javax.swing.JPanel();
jPanelButtons.setLayout(new FlowLayout());
Utils.addComponent(paneGlobal, jPanelButtons, 0, 1, GridBagConstraints.REMAINDER, 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