List of usage examples for javax.swing SpinnerNumberModel SpinnerNumberModel
public SpinnerNumberModel(double value, double minimum, double maximum, double stepSize)
SpinnerNumberModel
with the specified value
, minimum
/maximum
bounds, and stepSize
. From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JSpinner getTypeB_deltaRawMaximumSpinner() { if (typeB_deltaRawMaximumSpinner == null) { typeB_deltaRawMaximumSpinner = new JSpinner(new SpinnerNumberModel( TypeBEvaluationOptions.getDeltaRawDatasetMaximum(), Integer.MIN_VALUE, Integer.MAX_VALUE, 10)); typeB_deltaRawMaximumSpinner.setEnabled(!TypeBEvaluationOptions.isDeltaRawAutoscale()); }/* w w w. j a va 2s . co m*/ return typeB_deltaRawMaximumSpinner; }
From source file:org.glotaran.core.datadisplayers.common.ImageSVDPanel.java
public void createSVDPlots() { int maxSpinnerNumberModel = Math.min(MAX_NUMBER_SINGULAR_VALUES, (int) svdResult[1].getRowCount()); jTFtotalNumSV/*from w w w. ja v a 2 s . c om*/ .setText("Max " + maxSpinnerNumberModel + " of " + String.valueOf(svdResult[1].getRowCount())); jSnumSV.setModel(new SpinnerNumberModel((int) 1, (int) 0, maxSpinnerNumberModel, (int) 1)); //creare collection with first 2 LSV XYSeriesCollection lSVCollection = new XYSeriesCollection(); XYSeries seria; seria = new XYSeries("LSV1"); for (int i = 0; i < timeSteps; i++) { seria.add(timeAxe[i], svdResult[0].getAsDouble((long) i, 0)); } lSVCollection.addSeries(seria); //creare chart for 2 LSV leftSVChart = ChartFactory.createXYLineChart("Left singular vectors", "Time (~s)", null, lSVCollection, PlotOrientation.VERTICAL, false, false, false); //leftSVChart.getTitle().setFont(new Font(leftSVChart.getTitle().getFont().getFontName(), Font.PLAIN, 12)); leftSVChart.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT); GraphPanel chpan = new GraphPanel(leftSVChart); jPLeftSingVectors.removeAll(); jPLeftSingVectors.add(chpan); //creare collection with first RSV double[] tempRsingVec = null; double minVal = 0; double maxVal = 0; // seria = new XYSeries("RSV" + (j + 1)); tempRsingVec = new double[imageWitdth * imageHeight]; double tempValue; for (int i = 0; i < imageWitdth * imageHeight; i++) { tempValue = svdResult[2].getAsDouble(i, 0); tempRsingVec[i] = tempValue; minVal = minVal > tempValue ? tempValue : minVal; maxVal = maxVal < tempValue ? tempValue : maxVal; } IntensImageDataset rSingVec = new IntensImageDataset(imageWitdth, imageHeight, tempRsingVec); PaintScale ps = new RedGreenPaintScale(minVal, maxVal); JFreeChart rSingVect = CommonDataDispTools .createScatChart(ImageUtilities.createColorCodedImage(rSingVec, ps), ps, imageWitdth, imageHeight); // rSingVect.setTitle("R Singular vector " + String.valueOf(j + 1)); //rSingVect.getTitle().setFont(new Font(tracechart.getTitle().getFont().getFontName(), Font.PLAIN, 12)); ChartPanel rSingVectPanel = new ChartPanel(rSingVect); rSingVectPanel.setFillZoomRectangle(true); rSingVectPanel.setMouseWheelEnabled(true); jPRightSingVectors.removeAll(); jPRightSingVectors.add(rSingVectPanel); //creare collection with singular values XYSeriesCollection sVCollection = new XYSeriesCollection(); seria = new XYSeries("SV"); for (int i = 0; i < maxSpinnerNumberModel; i++) { seria.add(i + 1, svdResult[1].getAsDouble((long) i, (long) i)); } sVCollection.addSeries(seria); //create chart for singular values JFreeChart tracechart = ChartFactory.createXYLineChart("Screeplot", "Singular Value index (n)", null, sVCollection, PlotOrientation.VERTICAL, false, false, false); LogAxis logAxe = new LogAxis("Log(SVn)"); final NumberAxis domainAxis = (NumberAxis) tracechart.getXYPlot().getDomainAxis(); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); tracechart.getXYPlot().setRangeAxis(logAxe); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) tracechart.getXYPlot().getRenderer(); renderer.setBaseShapesVisible(true); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseFillPaint(Color.white); renderer.setSeriesStroke(0, new BasicStroke(1.0f)); renderer.setSeriesOutlineStroke(0, new BasicStroke(1.0f)); renderer.setSeriesShape(0, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0)); //tracechart.getTitle().setFont(new Font(tracechart.getTitle().getFont().getFontName(), Font.PLAIN, 12)); tracechart.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT); chpan = new GraphPanel(tracechart); //add chart with 2 RSV to JPannel jPSingValues.removeAll(); jPSingValues.add(chpan); }
From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JSpinner getTypeB_deltaRawMinimumSpinner() { if (typeB_deltaRawMinimumSpinner == null) { typeB_deltaRawMinimumSpinner = new JSpinner(new SpinnerNumberModel( TypeBEvaluationOptions.getDeltaRawDatasetMinimum(), Integer.MIN_VALUE, Integer.MAX_VALUE, 10)); typeB_deltaRawMinimumSpinner.setEnabled(!TypeBEvaluationOptions.isDeltaRawAutoscale()); }//w w w . j a va 2 s. com return typeB_deltaRawMinimumSpinner; }
From source file:edu.ku.brc.af.ui.forms.formatters.UIFormatterEditorDlg.java
@Override public void createUI() { super.createUI(); CellConstraints cc = new CellConstraints(); orderUpBtn = createIconBtn("ReorderUp", "TCGD_MOVE_UP", new ActionListener() { public void actionPerformed(ActionEvent ae) { int inx = fieldsTbl.getSelectedRow(); UIFieldFormatterField item = (UIFieldFormatterField) fields.get(inx); fields.remove(inx);/*from w w w .ja v a2 s . c om*/ fields.insertElementAt(item, inx - 1); fieldsTbl.getSelectionModel().setSelectionInterval(inx - 1, inx - 1); selectedFormat.resetLength(); updateEnabledState(); updateUIEnabled(); } }); orderDwnBtn = createIconBtn("ReorderDown", "TCGD_MOVE_DOWN", new ActionListener() { public void actionPerformed(ActionEvent ae) { int inx = fieldsTbl.getSelectedRow(); UIFieldFormatterField item = (UIFieldFormatterField) fields.get(inx); fields.remove(inx); fields.insertElementAt(item, inx + 1); fieldsTbl.getSelectionModel().setSelectionInterval(inx + 1, inx + 1); selectedFormat.resetLength(); updateEnabledState(); updateUIEnabled(); } }); // get formatters for field List<UIFieldFormatterIFace> fmtrs = new Vector<UIFieldFormatterIFace>(uiFieldFormatterMgrCache .getFormatterList(fieldInfo.getTableInfo().getClassObj(), fieldInfo.getName())); Collections.sort(fmtrs, new Comparator<UIFieldFormatterIFace>() { public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) { return o1.toPattern().compareTo(o2.toPattern()); } }); // table and field titles PanelBuilder tblInfoPB = new PanelBuilder( new FormLayout("r:p,2px,f:p:g", "p,2px,p,2px,p,10px")/*, new FormDebugPanel()*/); String typeStr = fieldInfo.getType(); typeStr = typeStr.indexOf('.') > -1 ? StringUtils.substringAfterLast(fieldInfo.getType(), ".") : typeStr; JLabel tableTitleLbl = createI18NFormLabel("FFE_TABLE"); JLabel tableTitleValueLbl = createLabel(fieldInfo.getTableInfo().getTitle()); tableTitleValueLbl.setBackground(Color.WHITE); tableTitleValueLbl.setOpaque(true); JLabel fieldTitleLbl = createI18NFormLabel("FFE_FIELD"); JLabel fieldTitleValueLbl = createLabel(fieldInfo.getTitle()); fieldTitleValueLbl.setBackground(Color.WHITE); fieldTitleValueLbl.setOpaque(true); JLabel fieldLengthLbl = createI18NFormLabel("FFE_LENGTH"); JLabel fieldLengthValueLbl = createLabel(Integer.toString(fieldInfo.getLength())); fieldLengthValueLbl.setBackground(Color.WHITE); fieldLengthValueLbl.setOpaque(true); int y = 1; tblInfoPB.add(tableTitleLbl, cc.xy(1, y)); tblInfoPB.add(tableTitleValueLbl, cc.xy(3, y)); y += 2; tblInfoPB.add(fieldTitleLbl, cc.xy(1, y)); tblInfoPB.add(fieldTitleValueLbl, cc.xy(3, y)); y += 2; tblInfoPB.add(fieldLengthLbl, cc.xy(1, y)); tblInfoPB.add(fieldLengthValueLbl, cc.xy(3, y)); y += 2; // sample panel sampleLabel = createLabel("", SwingConstants.LEFT); JPanel samplePanel = new JPanel(); samplePanel.setBorder(BorderFactory.createTitledBorder(getResourceString("FFE_SAMPLE"))); //$NON-NLS-1$ samplePanel.add(sampleLabel); // name text field nameTF = createTextField(20); // title text field titleTF = createTextField(20); byYearCB = createCheckBox(getResourceString("FFE_BY_YEAR_CHECKBOX")); //$NON-NLS-1$ hookByYearCheckBoxListener(); fieldsPanel = new EditDeleteAddPanel(getSaveAL(), getDelAL(), getAddAL()); fieldsTbl = new JTable(fieldsModel = new FieldsTableModel()); fieldTypeCbx = new JComboBox(FieldType.values()); // I18N fieldTxt = createTextField(20); fieldsPanel.getAddBtn().setEnabled(true); fieldsPanel.getEditBtn().setIcon(IconManager.getIcon("Green Arrow Up", IconManager.IconSize.Std16)); UIHelper.makeTableHeadersCentered(fieldsTbl, true); fieldTxt.setDocument(new FieldDocument()); fieldsTbl.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); int width = fieldTypeCbx.getPreferredSize().width; y = 1; PanelBuilder subPB = new PanelBuilder(new FormLayout("r:p,2px,p", "p,4px, p,4px, p,4px, p,4px")); subPB.add(createI18NFormLabel("FFE_NAME"), cc.xy(1, y)); subPB.add(nameTF, cc.xy(3, y)); y += 2; subPB.add(createI18NFormLabel("FFE_TITLE"), cc.xy(1, y)); subPB.add(titleTF, cc.xy(3, y)); y += 2; subPB.add(byYearCB, cc.xy(3, y)); y += 2; // CardLayout for Editor Panels SpinnerModel retModel = new SpinnerNumberModel(1, //initial value 1, //min fieldInfo.getLength(), //max 1); //step sizeSpinner = new JSpinner(retModel); isIncChk = new JCheckBox("Is Incrementer"); // I18N String colDefs = "f:p:g,p,2px," + width + "px,2px,p"; closeBtn = createClose(0); PanelBuilder numPB = new PanelBuilder(new FormLayout(colDefs, "p,2px,p,2px,p")); numPB.add(createI18NFormLabel("FFE_LENGTH"), cc.xy(2, 1)); numPB.add(sizeSpinner, cc.xy(4, 1)); //numPB.add(closeBtn, cc.xy(6, 1)); numPB.add(isIncChk, cc.xy(4, 3)); sepCbx = new JComboBox(new String[] { "-", ".", "/", "(space)", "_" }); closeBtn = createClose(1); PanelBuilder sepPB = new PanelBuilder(new FormLayout(colDefs, "p,2px,p")); sepPB.add(createI18NFormLabel("FFE_SEP"), cc.xy(2, 1)); sepPB.add(sepCbx, cc.xy(4, 1)); //sepPB.add(closeBtn, cc.xy(6, 1)); closeBtn = createClose(2); PanelBuilder txtPB = new PanelBuilder(new FormLayout(colDefs, "p,2px,p")); txtPB.add(createI18NFormLabel("FFE_TEXT"), cc.xy(2, 1)); txtPB.add(fieldTxt, cc.xy(4, 1)); cardPanel = new JPanel(cardLayout); cardPanel.add("size", numPB.getPanel()); cardPanel.add("text", txtPB.getPanel()); cardPanel.add("sep", sepPB.getPanel()); cardPanel.add("none", new JLabel(" ")); y = 1; PanelBuilder leftPB = new PanelBuilder(new FormLayout("f:p:g", "t:p,10px,p,f:p:g")); leftPB.add(tblInfoPB.getPanel(), cc.xy(1, y)); y += 2; leftPB.add(subPB.getPanel(), cc.xy(1, y)); y += 2; PanelBuilder upDownPanel = new PanelBuilder(new FormLayout("p", "f:p:g, p, 2px, p, f:p:g")); upDownPanel.add(orderUpBtn, cc.xy(1, 2)); upDownPanel.add(orderDwnBtn, cc.xy(1, 4)); totLenLbl = createLabel("XXXXX"); y = 1; PanelBuilder rightPB = new PanelBuilder(new FormLayout("p:g,2px,p,2px,p", "200px,2px,p,2px,p,2px,p")); rightPB.add(createScrollPane(fieldsTbl), cc.xywh(1, y, 3, 1)); rightPB.add(upDownPanel.getPanel(), cc.xywh(5, y, 1, 1)); y += 2; rightPB.add(totLenLbl, cc.xy(1, y)); rightPB.add(fieldsPanel, cc.xywh(3, y, 1, 1)); y += 2; rightPB.add(fieldTypeLbl = createI18NFormLabel("FFE_TYPE"), cc.xy(1, y)); rightPB.add(fieldTypeCbx, cc.xy(3, y)); rightPB.add(closeBtn, cc.xy(5, y)); y += 2; rightPB.add(cardPanel, cc.xyw(1, y, 3)); y += 2; y = 1; PanelBuilder pb = new PanelBuilder(new FormLayout("p:g,10px,p,10px,p:g,10px,p", "f:p:g,10px,p")); Color bg = getBackground(); pb.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xywh(3, 1, 1, 1)); pb.add(leftPB.getPanel(), cc.xy(1, y)); pb.add(rightPB.getPanel(), cc.xy(5, y)); //pb.add(keyPanel, cc.xy(7, y)); y += 2; pb.add(samplePanel, cc.xyw(1, y, 7)); y += 2; setByYearSelected(selectedFormat); nameTF.setEditable(isNew); nameTF.setText(selectedFormat.getName()); titleTF.setText(selectedFormat.getTitle()); updateSample(); hookTextChangeListener(nameTF, "FFE_NO_NAME", 32); hookTextChangeListener(titleTF, "FFE_NO_TITLE", 32); pb.setDefaultDialogBorder(); contentPanel = pb.getPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); updateUIEnabled(); pack(); enabledEditorUI(false); hookFieldsTblSelectionListener(); fieldTypeCbx.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { typeChanged(); } }); sepCbx.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { fieldHasChanged = true; updateEnabledState(); hasChanged = true; updateUIEnabled(); } }); fieldTxt.getDocument().addDocumentListener(new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { fieldHasChanged = true; updateEnabledState(); hasChanged = true; updateUIEnabled(); } }); sizeSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { fieldHasChanged = true; updateEnabledState(); hasChanged = true; updateUIEnabled(); } }); isIncChk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fieldHasChanged = true; if (!isIncChk.isSelected()) { byYearCB.setSelected(false); } updateEntry(); updateUIEnabled(); updateEnabledState(); fieldsTbl.repaint(); } }); fieldTypeCbx.setSelectedIndex(-1); fieldHasChanged = false; updateEnabledState(); }
From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JSpinner getCo2Absolute_Co2AbsoluteMinimumSpinner() { if (co2Absolute_co2AbsoluteMinimumSpinner == null) { co2Absolute_co2AbsoluteMinimumSpinner = new JSpinner( new SpinnerNumberModel(CO2AbsoluteOnlyEvaluationOptions.getCo2AbsoluteDatasetMinimum(), Integer.MIN_VALUE, Integer.MAX_VALUE, 10)); co2Absolute_co2AbsoluteMinimumSpinner .setEnabled(!CO2AbsoluteOnlyEvaluationOptions.isAutoScaleCO2Absolute()); }/*from w w w . ja v a 2s. c o m*/ return co2Absolute_co2AbsoluteMinimumSpinner; }
From source file:de.bfs.radon.omsimulation.gui.OMPanelTesting.java
/** * Initialises the interface of the data panel with a preloaded object from * results panel. Displaying the selected campaign only. * // w ww . ja v a2 s . c om * @param simulation * The selected simulation object. * @param campaign * The selected campaign to display. */ public OMPanelTesting(OMSimulation simulation, OMCampaign campaign) { isResult = true; isSimulated = true; setResultCampaign(campaign); initialize(); comboBoxProjects.removeAllItems(); removeEventListener(); OMBuilding building = simulation.getBuilding(); comboBoxProjects.addItem(building); comboBoxProjects.setEnabled(true); sliderStartTime.setMaximum(campaign.getStart()); spnrStartTime .setModel(new SpinnerNumberModel(campaign.getStart(), campaign.getStart(), campaign.getStart(), 1)); OMRoom[] rooms = campaign.getRoomPattern(); comboBoxRoom1.removeAllItems(); comboBoxRoom1.addItem(rooms[0]); comboBoxRoom1.setEnabled(true); comboBoxRoom2.removeAllItems(); comboBoxRoom2.addItem(rooms[1]); comboBoxRoom2.setEnabled(true); comboBoxRoom3.removeAllItems(); comboBoxRoom3.addItem(rooms[2]); comboBoxRoom3.setEnabled(true); comboBoxRoom4.removeAllItems(); comboBoxRoom4.addItem(rooms[3]); comboBoxRoom4.setEnabled(true); comboBoxRoom5.removeAllItems(); comboBoxRoom5.addItem(rooms[4]); comboBoxRoom5.setEnabled(true); comboBoxRoom6.removeAllItems(); comboBoxRoom6.addItem(rooms[5]); comboBoxRoom6.setEnabled(true); comboBoxRoom7.removeAllItems(); comboBoxRoom7.addItem(rooms[6]); comboBoxRoom7.setEnabled(true); spnrStartTime.setEnabled(false); sliderStartTime.setEnabled(false); sliderStartTime.setValue(campaign.getStart()); btnMaximize.setVisible(true); btnPdf.setVisible(true); btnCsv.setVisible(true); lblExportChartTo.setVisible(true); JPanel campaignChart = createCampaignPanel(campaign, false, false); remove(panelCampaign); panelCampaign = new JPanel(); panelCampaign.setBounds(10, 150, 730, 315); panelCampaign.add(campaignChart); add(panelCampaign); updateUI(); }
From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JSpinner getCo2Absolute_Co2AbsoluteMaximumSpinner() { if (co2Absolute_co2AbsoluteMaximumSpinner == null) { co2Absolute_co2AbsoluteMaximumSpinner = new JSpinner(new SpinnerNumberModel( CO2AbsoluteOnlyEvaluationOptions.co2AbsoluteOnly_getCo2AbsoluteDatasetMaximum(), Integer.MIN_VALUE, Integer.MAX_VALUE, 10)); co2Absolute_co2AbsoluteMaximumSpinner .setEnabled(!CO2AbsoluteOnlyEvaluationOptions.isAutoScaleCO2Absolute()); }/*from ww w . ja v a2 s . c o m*/ return co2Absolute_co2AbsoluteMaximumSpinner; }
From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java
/** This method is called from within the constructor to * initialize the form./*from w w w . j a va 2s . c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { generateButton = new JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); nameCheckbox = new javax.swing.JCheckBox(); massCheckbox = new javax.swing.JCheckBox(); hipCheckbox = new javax.swing.JCheckBox(); lumCheckbox = new javax.swing.JCheckBox(); nameField = new javax.swing.JTextField(); hipSpinner = new javax.swing.JSpinner(); massSpinner = new javax.swing.JSpinner(); lumSpinner = new javax.swing.JSpinner(); seedCheckbox = new javax.swing.JCheckBox(); seedSpinner = new javax.swing.JSpinner(); jPanel2 = new javax.swing.JPanel(); classCheckbox = new javax.swing.JCheckBox(); subclassCheckbox = new javax.swing.JCheckBox(); lumClassCheckbox = new javax.swing.JCheckBox(); classCombo = new JComboBox<String>(); subclassCombo = new JComboBox<String>(); lumClassCombo = new JComboBox<String>(); jPanel3 = new javax.swing.JPanel(); distanceCheckbox = new javax.swing.JCheckBox(); ascensionCheckbox = new javax.swing.JCheckBox(); declinationCheckbox = new javax.swing.JCheckBox(); distanceSpinner = new javax.swing.JSpinner(); ascensionSpinner = new javax.swing.JSpinner(); declinationSpinner = new javax.swing.JSpinner(); resetButton = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); loadMenuItem = new javax.swing.JMenuItem(); saveMenuItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); exitMenuItem = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); aboutItem = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Stargen Solar System Generator"); generateButton.setText("Generate ..."); generateButton.setToolTipText("Generate a solar system using the parameters in the dialog"); generateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { generateButtonActionPerformed(evt); } }); nameCheckbox.setText("Name of Star"); nameCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); nameCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); nameCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { nameCheckboxStateChanged(evt); } }); massCheckbox.setText("Stellar Mass (Sol = 1.0)"); massCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); massCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); massCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { massCheckboxStateChanged(evt); } }); hipCheckbox.setText("Hipparcus Catalogue Number"); hipCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); hipCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); hipCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { hipCheckboxStateChanged(evt); } }); lumCheckbox.setText("Stellar Luminosity (Sol = 1.0)"); lumCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); lumCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); lumCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { lumCheckboxStateChanged(evt); } }); nameField.setText("Stargen"); nameField.setToolTipText("The name of the star and the system for use in output"); nameField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nameFieldActionPerformed(evt); } }); nameField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { nameFieldFocusLost(evt); } }); hipSpinner.setModel(new SpinnerNumberModel(500000, 0, 10000000, 1)); hipSpinner.setToolTipText("Stellar catalogue number used for Celestia output"); hipSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { hipSpinnerStateChanged(evt); } }); massSpinner.setModel(new SpinnerNumberModel(1.0, 0.1, 10000.0, 0.01)); massSpinner.setToolTipText("The stellar mass compared to our Sun"); massSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { massSpinnerStateChanged(evt); } }); lumSpinner.setModel(new SpinnerNumberModel(1.0, 0.1, 10000.0, 0.01)); lumSpinner.setToolTipText("The stellar luminosity compared to our Sun"); lumSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { lumSpinnerStateChanged(evt); } }); seedCheckbox.setText("Random number seed"); seedCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); seedCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); seedCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { seedCheckboxStateChanged(evt); } }); seedSpinner.setModel(new SpinnerNumberModel((Number) new Long(0L), (Comparable<Long>) new Long(0L), (Comparable) Long.MAX_VALUE, (Number) new Long(1))); seedSpinner.setToolTipText("Select a specific seed value. The same seed always generates the same result"); seedSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { seedSpinnerStateChanged(evt); } }); org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jPanel1Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup() .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(massCheckbox).add(hipCheckbox).add(lumCheckbox).add(seedCheckbox)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jPanel1Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(jPanel1Layout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING, false) .add(massSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) .add(hipSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)) .add(lumSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 184, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(seedSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup().add(nameCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE))) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup().addContainerGap() .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(nameCheckbox)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(hipCheckbox).add(hipSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(9, 9, 9) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(massCheckbox).add(massSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(lumCheckbox).add(lumSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(seedCheckbox).add(seedSpinner)) .addContainerGap(31, Short.MAX_VALUE))); jTabbedPane1.addTab("Basic", jPanel1); classCheckbox.setText("Spectral Class"); classCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); classCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); classCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { classCheckboxStateChanged(evt); } }); subclassCheckbox.setText("Spectral Subclass"); subclassCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); subclassCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); subclassCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { subclassCheckboxStateChanged(evt); } }); lumClassCheckbox.setText("Luminosity Class"); lumClassCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); lumClassCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); lumClassCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { lumClassCheckboxStateChanged(evt); } }); classCombo.setModel( new javax.swing.DefaultComboBoxModel<String>(new String[] { "O", "B", "A", "F", "G", "K", "M" })); classCombo.setToolTipText("Select the spectral class of the star. O is the hottest."); classCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { classComboActionPerformed(evt); } }); subclassCombo.setModel(new javax.swing.DefaultComboBoxModel<String>( new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" })); subclassCombo.setToolTipText("Select the spectral subclass of the star"); subclassCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { subclassComboActionPerformed(evt); } }); lumClassCombo.setModel(new javax.swing.DefaultComboBoxModel<String>( new String[] { "Ia", "Ib", "II", "III", "IV", "V", "VI", "VII" })); lumClassCombo.setToolTipText("Select the luminosity class of the star"); lumClassCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { lumClassComboActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(lumClassCheckbox).add(classCheckbox).add(subclassCheckbox)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 279, Short.MAX_VALUE) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(classCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(subclassCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(lumClassCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup().add(16, 16, 16) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(classCheckbox).add(classCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(subclassCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(subclassCheckbox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(lumClassCheckbox).add(lumClassCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(75, Short.MAX_VALUE))); jTabbedPane1.addTab("Spectral", jPanel2); distanceCheckbox.setText("Distance (light years)"); distanceCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); distanceCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); distanceCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { distanceCheckboxStateChanged(evt); } }); ascensionCheckbox.setText("Right Ascension (degrees)"); ascensionCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); ascensionCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); ascensionCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { ascensionCheckboxStateChanged(evt); } }); declinationCheckbox.setText("Declination (degrees)"); declinationCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); declinationCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); declinationCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { declinationCheckboxStateChanged(evt); } }); distanceSpinner.setModel(new SpinnerNumberModel(100.0, 0.0, 10000.0, 0.01)); distanceSpinner.setToolTipText("Set the distance of the star from Earth in light years"); distanceSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { distanceSpinnerStateChanged(evt); } }); ascensionSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 360.0, 0.01)); ascensionSpinner.setToolTipText("Set the right ascension of the star in degrees"); ascensionSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { ascensionSpinnerStateChanged(evt); } }); declinationSpinner.setModel(new SpinnerNumberModel(0.0, -90.0, 90.0, 0.01)); declinationSpinner.setToolTipText("Set the declination of the star in degrees"); declinationSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { declinationSpinnerStateChanged(evt); } }); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(distanceCheckbox).add(ascensionCheckbox).add(declinationCheckbox)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 201, Short.MAX_VALUE) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(declinationSpinner).add(ascensionSpinner).add(distanceSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(distanceCheckbox).add(distanceSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(ascensionCheckbox).add(ascensionSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(declinationCheckbox).add(declinationSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(86, Short.MAX_VALUE))); jTabbedPane1.addTab("Position", jPanel3); resetButton.setText("Reset All"); resetButton.setToolTipText("Reset all the parameters to their defaults"); resetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetButtonActionPerformed(evt); } }); jMenu1.setText("File"); loadMenuItem.setText("Load Settings ..."); loadMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadMenuItemActionPerformed(evt); } }); jMenu1.add(loadMenuItem); saveMenuItem.setText("Save Settings ..."); saveMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveMenuItemActionPerformed(evt); } }); jMenu1.add(saveMenuItem); jMenu1.add(jSeparator1); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); jMenu1.add(exitMenuItem); jMenuBar1.add(jMenu1); jMenu2.setText("Help"); aboutItem.setText("About ..."); aboutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { aboutItemActionPerformed(evt); } }); jMenu2.add(aboutItem); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup().addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup().add(resetButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 273, Short.MAX_VALUE) .add(generateButton)) .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 445, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add( org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup().addContainerGap() .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 194, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 13, Short.MAX_VALUE) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(resetButton) .add(generateButton)) .addContainerGap())); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 473) / 2, (screenSize.height - 300) / 2, 473, 300); }
From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JSpinner getCo2Absolute_deltaFiveMinutesMinimumSpinner() { if (co2Absolute_deltaFiveMinutesMinimumSpinner == null) { co2Absolute_deltaFiveMinutesMinimumSpinner = new JSpinner(new SpinnerNumberModel( CO2AbsoluteOnlyEvaluationOptions.co2AbsoluteOnly_getDeltaFiveMinutesMinimum(), Integer.MIN_VALUE, Integer.MAX_VALUE, 10)); co2Absolute_deltaFiveMinutesMinimumSpinner .setEnabled(!CO2AbsoluteOnlyEvaluationOptions.isAutoScaleDeltaFiveMinutes()); }/*from ww w .ja v a2 s .com*/ return co2Absolute_deltaFiveMinutesMinimumSpinner; }
From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java
private void appendGenerationsSpinner(GridBagLayout gridBagLayout, GridBagConstraints constraints, JPanel mainPanel) {/*from ww w. j a v a2 s .co m*/ SpinnerModel generationsModel = new SpinnerNumberModel(generationsInitial, GENERATIONS_MIN, GENERATIONS_MAX, GENERATIONS_STEP); generationsSpinner = new JSpinner(generationsModel); generationsSpinner.setEnabled(false); JLabel generationsLabel = new JLabel(generationsText); generationsLabel.setLabelFor(generationsSpinner); constraints.weightx = LAYOUT_LABEL_WEIGHT; constraints.gridwidth = GridBagConstraints.RELATIVE; gridBagLayout.setConstraints(generationsLabel, constraints); mainPanel.add(generationsLabel); constraints.weightx = LAYOUT_INPUT_WEIGHT; constraints.gridwidth = GridBagConstraints.REMAINDER; gridBagLayout.setConstraints(generationsSpinner, constraints); mainPanel.add(generationsSpinner); }