Search in sources :

Example 1 with CgSpinnerDouble

use of course_generator.utils.CgSpinnerDouble 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);
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) JButton(javax.swing.JButton) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) ActionEvent(java.awt.event.ActionEvent) Container(java.awt.Container) CgSpinner(course_generator.utils.CgSpinner) ButtonGroup(javax.swing.ButtonGroup) JPanel(javax.swing.JPanel) CgSpinnerDouble(course_generator.utils.CgSpinnerDouble)

Example 2 with CgSpinnerDouble

use of course_generator.utils.CgSpinnerDouble in project Course_Generator by patrovite.

the class frmTrackSettings method initComponents.

private void initComponents() {
    int line = 0;
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(bundle.getString("frmTrackSettings.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 Track name
    panelTrackName = new JPanel();
    panelTrackName.setLayout(new GridBagLayout());
    // Start
    panelTrackName.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmTrackSettings.panelTrackName.Title")));
    panelTrackName.setLayout(new GridBagLayout());
    Utils.addComponent(paneGlobal, panelTrackName, 0, 0, 1, 1, 0, 0, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
    tfTrackName = new JTextFieldLimit(15);
    Utils.addComponent(panelTrackName, tfTrackName, 0, 0, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
    // == Panel description
    panelDescription = new JPanel();
    panelDescription.setLayout(new GridBagLayout());
    // End
    panelDescription.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmTrackSettings.panelDescription.Title")));
    panelDescription.setLayout(new GridBagLayout());
    Utils.addComponent(paneGlobal, panelDescription, 0, 1, 1, 1, 0, 0, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
    tfDescription = new JTextField();
    Utils.addComponent(panelDescription, tfDescription, 0, 0, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);
    // == Panel Date & time
    panelDateTime = new JPanel();
    panelDateTime.setLayout(new GridBagLayout());
    // Difficulty
    panelDateTime.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmTrackSettings.panelDateTime.Title")));
    Utils.addComponent(paneGlobal, panelDateTime, 0, 2, 1, 1, 1, 1, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
    jMonthView = new org.jdesktop.swingx.JXMonthView();
    jMonthView.setBackground(new java.awt.Color(255, 255, 255));
    jMonthView.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
    jMonthView.setBoxPaddingX(1);
    jMonthView.setBoxPaddingY(1);
    jMonthView.setShowingWeekNumber(true);
    jMonthView.setTraversable(true);
    Utils.addComponent(panelDateTime, jMonthView, 0, 0, 1, 1, 0, 0, 5, 5, 5, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    spinStartTimeModel = new SpinnerDateModel(new Date(), null, null, Calendar.HOUR_OF_DAY);
    spinStartTime = new javax.swing.JSpinner(spinStartTimeModel);
    JSpinner.DateEditor deStartTime = new JSpinner.DateEditor(spinStartTime, "HH:mm");
    spinStartTime.setEditor(deStartTime);
    Utils.addComponent(panelDateTime, spinStartTime, 1, 0, 1, 1, 1, 0, 5, 10, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    // -- Panel elevation effect
    panelElevationEffect = new JPanel();
    panelElevationEffect.setLayout(new GridBagLayout());
    panelElevationEffect.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmTrackSettings.panelElevationEffect.Title")));
    panelElevationEffect.setLayout(new GridBagLayout());
    Utils.addComponent(paneGlobal, panelElevationEffect, 0, 3, 1, 1, 1, 1, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
    chkElevationEffect = new JCheckBox(bundle.getString("frmTrackSettings.rbElevationEffect.Text"));
    Utils.addComponent(panelElevationEffect, chkElevationEffect, 0, 1, 1, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    // -- Panel night effect
    panelNightEffect = new JPanel();
    panelNightEffect.setLayout(new GridBagLayout());
    panelNightEffect.setBorder(BorderFactory.createTitledBorder(bundle.getString("frmTrackSettings.panelNightEffect.Title")));
    Utils.addComponent(paneGlobal, panelNightEffect, 0, 4, 1, 1, 1, 1, 10, 10, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
    chkNightEffect = new JCheckBox(bundle.getString("frmTrackSettings.rbNightEffect.Text"));
    chkNightEffect.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            Refresh();
        }
    });
    Utils.addComponent(panelNightEffect, chkNightEffect, 0, 0, GridBagConstraints.REMAINDER, 1, 1, 0, 5, 5, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    lbStartNight = new JLabel(bundle.getString("frmTrackSettings.lbStartNight.Text"));
    Utils.addComponent(panelNightEffect, lbStartNight, 0, 1, 1, 1, 0, 0, 5, 5, 5, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    spinStartNightModel = new SpinnerDateModel(new Date(), null, null, Calendar.HOUR_OF_DAY);
    spinStartNight = new javax.swing.JSpinner(spinStartNightModel);
    JSpinner.DateEditor deStartNight = new JSpinner.DateEditor(spinStartNight, "HH:mm");
    spinStartNight.setEditor(deStartNight);
    Utils.addComponent(panelNightEffect, spinStartNight, 1, 1, 1, 1, 0, 0, 5, 5, 5, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    lbEndNight = new JLabel(bundle.getString("frmTrackSettings.lbEndNight.Text"));
    Utils.addComponent(panelNightEffect, lbEndNight, 2, 1, 1, 1, 0, 0, 5, 10, 5, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    spinEndNightModel = new SpinnerDateModel(new Date(), null, null, Calendar.HOUR_OF_DAY);
    spinEndNight = new javax.swing.JSpinner(spinEndNightModel);
    JSpinner.DateEditor deEndNight = new JSpinner.DateEditor(spinEndNight, "HH:mm");
    spinEndNight.setEditor(deEndNight);
    Utils.addComponent(panelNightEffect, spinEndNight, 3, 1, 1, 1, 0, 0, 5, 5, 5, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    btCalc = new JButton(bundle.getString("frmTrackSettings.btCalc.text"));
    btCalc.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            FrmCalcSunriseSunset frm = new FrmCalcSunriseSunset();
            ResCalcSunriseSunset res = frm.showDialog(track.data.get(0).getLongitude(), track.data.get(0).getLatitude(), track.StartTime, track.TrackTimeZone.intValue(), track.TrackUseSumerTime);
            if (res.valid) {
                timezone = Double.valueOf(res.TimeZone);
                summertime = res.SummerTime;
                spinEndNightModel.setValue(res.Sunrise.toDate());
                spinStartNightModel.setValue(res.Sunset.toDate());
            }
        }
    });
    Utils.addComponent(panelNightEffect, btCalc, 4, 1, 1, 1, 1, 0, 5, 10, 5, 5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    panelCoeff = new JPanel();
    Utils.addComponent(panelNightEffect, panelCoeff, 0, 2, GridBagConstraints.REMAINDER, 1, 1, 0, 5, 5, 5, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE);
    lbAscCoeff = new JLabel(bundle.getString("frmTrackSettings.lbAscCoeff.Text"));
    panelCoeff.add(lbAscCoeff);
    spinAscCoeff = new CgSpinnerDouble(100, 0, 100, 1);
    panelCoeff.add(spinAscCoeff);
    lbDescCoeff = new JLabel(bundle.getString("frmTrackSettings.lbDescCoeff.Text"));
    panelCoeff.add(lbDescCoeff);
    spinDescCoeff = new CgSpinnerDouble(100, 0, 100, 1);
    panelCoeff.add(spinDescCoeff);
    // == BUTTONS
    // ===========================================================
    jPanelButtons = new javax.swing.JPanel();
    jPanelButtons.setLayout(new FlowLayout());
    Utils.addComponent(paneGlobal, jPanelButtons, 0, 5, 1, 1, 0, 0, 10, 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);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JXMonthView(org.jdesktop.swingx.JXMonthView) JButton(javax.swing.JButton) JTextField(javax.swing.JTextField) SpinnerDateModel(javax.swing.SpinnerDateModel) Container(java.awt.Container) JSpinner(javax.swing.JSpinner) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) ActionEvent(java.awt.event.ActionEvent) Date(java.util.Date) JCheckBox(javax.swing.JCheckBox) JTextFieldLimit(course_generator.utils.JTextFieldLimit) ResCalcSunriseSunset(course_generator.dialogs.FrmCalcSunriseSunset.ResCalcSunriseSunset) JSpinner(javax.swing.JSpinner) JPanel(javax.swing.JPanel) CgSpinnerDouble(course_generator.utils.CgSpinnerDouble)

Example 3 with CgSpinnerDouble

use of course_generator.utils.CgSpinnerDouble 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);
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JTextField(javax.swing.JTextField) Dimension(java.awt.Dimension) JTimeSetting(course_generator.utils.JTimeSetting) ActionEvent(java.awt.event.ActionEvent) Font(java.awt.Font) Container(java.awt.Container) CgSpinner(course_generator.utils.CgSpinner) JLabel(javax.swing.JLabel) JTextFieldLimit(course_generator.utils.JTextFieldLimit) JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) CgSpinnerDouble(course_generator.utils.CgSpinnerDouble)

Aggregations

CgSpinnerDouble (course_generator.utils.CgSpinnerDouble)3 Container (java.awt.Container)3 Dimension (java.awt.Dimension)3 FlowLayout (java.awt.FlowLayout)3 GridBagLayout (java.awt.GridBagLayout)3 ActionEvent (java.awt.event.ActionEvent)3 JButton (javax.swing.JButton)3 JLabel (javax.swing.JLabel)3 JPanel (javax.swing.JPanel)3 CgSpinner (course_generator.utils.CgSpinner)2 JTextFieldLimit (course_generator.utils.JTextFieldLimit)2 JCheckBox (javax.swing.JCheckBox)2 JTextField (javax.swing.JTextField)2 ResCalcSunriseSunset (course_generator.dialogs.FrmCalcSunriseSunset.ResCalcSunriseSunset)1 JTimeSetting (course_generator.utils.JTimeSetting)1 Font (java.awt.Font)1 Date (java.util.Date)1 ButtonGroup (javax.swing.ButtonGroup)1 JRadioButton (javax.swing.JRadioButton)1 JSpinner (javax.swing.JSpinner)1