use of course_generator.dialogs.FrmCalcSunriseSunset.ResCalcSunriseSunset 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);
}
Aggregations