private void loadFloor() { if (currentFloor == null) return; isLoading = true; blendingCheckbox.setSelected(currentFloor.occlude); switch (previewBox.getMode()) { case RT3_GAME: gameColour.setColour(currentFloor.colour2); gameTexture.setValue(currentFloor.texture); gameName.setText(currentFloor.name); break; case RT3_MAP: gameColour.setColour(currentFloor.minimapColour); gameTexture.setValue(currentFloor.texture); gameName.setText(currentFloor.name); break; case RT4P_OVERLAY: gameColour.setColour(currentFloor.hdColour); gameTexture.setValue(currentFloor.hdTexture); // gameName.setText(currentFloor.name); break; case RT4P_UNDERLAY: gameColour.setColour(currentFloor.hdUlColour); gameTexture.setValue(currentFloor.hdUlTexture); // gameName.setText(currentFloor.name); break; } isLoading = false; previewBox.repaint(); }
public void setXRangeToTime() { showTime(); // set the x axis from the time range of the data GeoDate minDate = mFileViewer.getMinDate(); GeoDate maxDate = mFileViewer.getMaxDate(); xTics.setValue(new Integer(xTicsVal)); }
private void setValue(final JComponent component) { final String primitiveFormName = _primitiveForm.getName(); if (_dotDefinitionDialogFrame.isPropertyStatic(primitiveFormName, _property)) { Object object = _dotDefinitionDialogFrame.getValueOfStaticProperty(primitiveFormName, _property); if (component instanceof JComboBox) { final String currentValue; if (object instanceof Color) { currentValue = ColorManager.getInstance().getColorName((Color) object); } else if (object instanceof Integer) { Integer i = (Integer) object; if (i.equals(Font.PLAIN)) { currentValue = STANDARD_FONT; } else if (i.equals(Font.BOLD)) { currentValue = BOLD_FONT; } else if (i.equals(Font.ITALIC)) { currentValue = ITALIC_FONT; } else { currentValue = "Unbekannter Font"; } } else { currentValue = (String) object; } JComboBox comboBox = (JComboBox) component; comboBox.setSelectedItem(currentValue); } else if (component instanceof JSpinner) { JSpinner spinner = (JSpinner) component; if (object instanceof Integer) { spinner.setValue((Integer) object); } else { spinner.setValue((Double) object); } } } else { if (component instanceof JComboBox) { JComboBox comboBox = (JComboBox) component; comboBox.setSelectedItem(DOTPoint.getDefaultValue(_property)); } else if (component instanceof JSpinner) { JSpinner spinner = (JSpinner) component; spinner.setValue(DOTPoint.getDefaultValue(_property)); } } }
/*-------------------------------------------------------------------------*/ public void refresh(String name) { if (name == null) { return; } DifficultyLevel dl = Database.getInstance().getDifficultyLevels().get(name); impl.setText(dl.getClass().getName()); sortOrder.setValue(dl.getSortOrder()); }
public void setAdvancedValues() { // get pretty ranges for the current parameters // get the range for the station value double min = 10000; double max = 0; for (int fc = 0; fc < mFileViewer.mNumOpenFiles; fc++) { OpenDataFile of = (OpenDataFile) mFileViewer.mOpenFiles.elementAt(fc); for (int sec = 0; sec < of.mNumSections; sec++) { Section sech = (Section) of.mSections.elementAt(sec); if (sech.mNumCasts == 0) { continue; } for (int stc = 0; stc < sech.mStations.size(); stc++) { Station sh = (Station) sech.mStations.elementAt(stc); if (!sh.mUseStn) { continue; } // get the station value double y = sh.getStnValue(mSelYParam); if (y == JOAConstants.MISSINGVALUE || y >= JOAConstants.EPICMISSINGVALUE) { continue; } else { min = y < min ? y : min; max = y > max ? y : max; } } } } Triplet newRange = JOAFormulas.GetPrettyRange(min, max); double yMinv = newRange.getVal1(); double yMaxv = newRange.getVal2(); double yIncv = newRange.getVal3(); yMin.setText(JOAFormulas.formatDouble(String.valueOf(yMinv), 3, false)); yMax.setText(JOAFormulas.formatDouble(String.valueOf(yMaxv), 3, false)); yInc.setText(JOAFormulas.formatDouble(String.valueOf(yIncv), 3, false)); yTics.setValue(new Integer(yTicsVal)); if (b1.isSelected()) { mOffset = JOAConstants.PROFSEQUENCE; setXRangeToSequence(); } else if (b2.isSelected()) { mOffset = JOAConstants.PROFDISTANCE; setXRangeToDistance(); } else if (b3.isSelected()) { mOffset = JOAConstants.PROFTIME; setXRangeToTime(); } }
@Override public void setAIChoices(String[] value) { java.util.List<String> choiceList = new ArrayList<String>(); for (String v : value) { choiceList.add(v); } aiModel.setList(choiceList); if (value.length > 0) { aiChoices.setValue(value[0]); } }
public void setXRangeToSequence() { hideTime(); // set the x axis from the total mercator distance double tempXMin = 0; double tempXMax = mFileViewer.mTotalStations; Triplet newRange = JOAFormulas.GetPrettyRange(tempXMin, tempXMax); double xMinv = newRange.getVal1(); double xMaxv = newRange.getVal2(); double xIncv = newRange.getVal3(); xMin.setText(String.valueOf((int) xMinv)); xMax.setText(String.valueOf((int) xMaxv)); xInc.setText(String.valueOf((int) xIncv)); xTics.setValue(new Integer(xTicsVal)); }
public void setXRangeToDistance() { hideTime(); // set the x axis from the total mercator distance double tempXMin = 0; double tempXMax = mFileViewer.mTotMercDist * 1.852; Triplet newRange = JOAFormulas.GetPrettyRange(tempXMin, tempXMax); double xMinv = newRange.getVal1(); double xMaxv = newRange.getVal2(); double xIncv = newRange.getVal3(); xMin.setText(JOAFormulas.formatDouble(String.valueOf(xMinv), 3, false)); xMax.setText(JOAFormulas.formatDouble(String.valueOf(xMaxv), 3, false)); xInc.setText(JOAFormulas.formatDouble(String.valueOf(xIncv), 3, false)); xTics.setValue(new Integer(xTicsVal)); }
public JPanel getAdditionalCharacteristicsPanel(final DisplayObjectType displayObjectType) { JLabel translationFactorLabel = new JLabel("Verschiebungsfaktor: "); SpinnerModel spinnerModel = new SpinnerNumberModel(100, 0, 5000, 1); _translationFactorSpinner.setModel(spinnerModel); _translationFactorSpinner.setMaximumSize(new Dimension(60, 30)); _translationFactorSpinner.setEnabled(_dotDefinitionDialogFrame.isEditable()); JPanel translationPanel = new JPanel(); translationPanel.setLayout(new BoxLayout(translationPanel, BoxLayout.X_AXIS)); translationPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 10)); translationPanel.add(translationFactorLabel); translationPanel.add(_translationFactorSpinner); JLabel joinByLineLabel = new JLabel("Verbindungslinie: "); _joinByLineCheckBox.setSelected(false); _joinByLineCheckBox.setEnabled(_dotDefinitionDialogFrame.isEditable()); JPanel joinByLinePanel = new JPanel(); joinByLinePanel.setLayout(new BoxLayout(joinByLinePanel, BoxLayout.X_AXIS)); joinByLinePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); joinByLinePanel.add(joinByLineLabel); joinByLinePanel.add(_joinByLineCheckBox); JPanel invisiblePanel = new JPanel(); invisiblePanel.add(new JTextField()); invisiblePanel.setVisible(false); JPanel thePanel = new JPanel(); thePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); thePanel.setLayout(new SpringLayout()); thePanel.add(translationPanel); thePanel.add(joinByLinePanel); thePanel.add(invisiblePanel); SpringUtilities.makeCompactGrid(thePanel, 3, 5, 5); if (displayObjectType != null) { DOTPoint dotPoint = (DOTPoint) displayObjectType; _translationFactorSpinner.setValue(dotPoint.getTranslationFactor()); _joinByLineCheckBox.setSelected(dotPoint.isJoinByLine()); } addChangeListeners(); // Erst jetzt, denn sonst werden die Setzungen von // _translationFactorSpinner und _joinByLineCheckBox schon verarbeitet! return thePanel; }
/** Update date spinner to synchronize with the other spinners */ private void updateDate() { // Get current month and year in int int month = ((SpinnerListModel) jspMonth.getModel()).getList().indexOf(jspMonth.getValue()); int year = ((Integer) spinnerYear.getValue()).intValue(); // Set a new maximum number of days for the new month and year SpinnerNumberModel numberModel = (SpinnerNumberModel) jspDay.getModel(); numberModel.setMaximum(new Integer(maxDaysInMonth(year, month))); // Set a new current day if it exceeds the maximum if (((Integer) (numberModel.getValue())).intValue() > maxDaysInMonth(year, month)) numberModel.setValue(new Integer(maxDaysInMonth(year, month))); // Get the current day int day = ((Integer) jspDay.getValue()).intValue(); // Set a new date in the date spinner jspDate.setValue(new GregorianCalendar(year, month, day).getTime()); }
DOTItemDialog() { super(); _primitiveForm = primitiveForm; _property = property; _dynamicDefinitionComponent = new DynamicDefinitionComponent(_configuration, new DOTPointPlugin()); final Object propertyValue = initDynamicDefinitionComponent(); final JPanel panel = new JPanel(); panel.setLayout(new SpringLayout()); JLabel aLabel = null; if (_property == DOTProperty.DURCHMESSER) { aLabel = new JLabel("Durchmesser: "); if (propertyValue != null) { _diameterSpinner.setValue(propertyValue); } _component = _diameterSpinner; } else if (_property == DOTProperty.FARBE || _property == DOTProperty.FUELLUNG) { aLabel = new JLabel("Farbe: "); if (propertyValue != null) { _colorComboBox.setSelectedItem(propertyValue); } _component = _colorComboBox; } else if (_property == DOTProperty.GROESSE) { aLabel = new JLabel("Schriftgröße: "); if (propertyValue != null) { _textSizeSpinner.setValue(propertyValue); } _component = _textSizeSpinner; } else if (_property == DOTProperty.STRICHBREITE) { aLabel = new JLabel("Strichbreite: "); if (propertyValue != null) { _strokeWidthSpinner.setValue(propertyValue); } _component = _strokeWidthSpinner; } else if (_property == DOTProperty.TEXT) { aLabel = new JLabel("Text: "); prepareTextComboBox(propertyValue); _component = _textComboBox; } else if (_property == DOTProperty.TEXTSTIL) { aLabel = new JLabel("Textstil: "); if (propertyValue != null) { _textStyleComboBox.setSelectedItem(propertyValue); } _component = _textStyleComboBox; } else if (_property == DOTProperty.TRANSPARENZ) { aLabel = new JLabel("Tranzparenz: "); if (propertyValue != null) { _transparencySpinner.setValue(propertyValue); } _component = _transparencySpinner; } panel.add(aLabel); panel.add(_component); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); SpringUtilities.makeCompactGrid(panel, 2, 20, 5); final JButton saveButton = new JButton("Speichern"); saveButton.setEnabled(_dotDefinitionDialogFrame.isEditable()); final JButton cancelButton = new JButton("Dialog schließen"); final JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new SpringLayout()); buttonsPanel.add(saveButton); buttonsPanel.add(cancelButton); buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); SpringUtilities.makeCompactGrid(buttonsPanel, 2, 20, 5); addButtonListeners(saveButton, cancelButton); setTitle("GND: Darstellungsfestlegung für Punkte"); setLayout(new BorderLayout()); add(new JScrollPane(panel), BorderLayout.NORTH); add(new JScrollPane(_dynamicDefinitionComponent), BorderLayout.CENTER); add(buttonsPanel, BorderLayout.SOUTH); pack(); setSize(700, 550); final Rectangle bounds = getBounds(); setLocation( new Point((int) (bounds.getHeight() / 1.5 + 300), (int) (bounds.getWidth() / 1.5))); }
static String[] input(int d, int m, int y) { // input frame for schedule String[] out = new String[4]; // appointment info storage final String[] doctors = {"Dr. Whitehead", "Dr. Namie", "Dr. Liddell"}; final JFrame input = new JFrame("Make Appointment"); Container pane1; JPanel pan = new JPanel(null); JLabel doctor = new JLabel("Choose your Doctor:"); JLabel da = new JLabel("Date:"); /*JLabel day=new JLabel(Integer.toString(d)); JLabel mo=new JLabel("Month:"); JLabel month=new JLabel(Integer.toString(m)); JLabel ye=new JLabel("Year:"); JLabel year=new JLabel(Integer.toString(y));*/ JLabel time = new JLabel("Appointment Time:"); JButton submit = new JButton("Submit"); docName = new JComboBox(doctors); JSpinner timeSpinner = new JSpinner(new SpinnerDateModel()); JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "hh:mm a"); timeSpinner.setEditor(timeEditor); timeSpinner.setValue(new Date()); JSpinner dateSpinner = new JSpinner(new SpinnerDateModel()); JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(dateSpinner, "MMM/dd/yyyy"); dateSpinner.setEditor(dateEditor); dateSpinner.setValue(new Date()); input.setSize(330, 375); // Set size to 400x400 pixels pane1 = input.getContentPane(); pane1.setLayout(null); // Apply null layout pan.setLayout(new GridLayout(4, 2, 20, 50)); pane1.setSize((int) (input.getHeight() / 2), (int) (input.getWidth() / 2)); pane1.setLocation( input.getHeight() - ((int) (input.getHeight() / 2)), input.getWidth() - ((int) (input.getWidth() / 2))); // trying to center failed input.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Close when X is clicked pane1.add(pan); // pan.add(ye); // pan.add(year); pan.add(da); pan.add(dateSpinner); pan.add(time); pan.add(timeSpinner); pan.add(doctor); pan.add(docName); pan.add(submit); submit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { fmain.setVisible(true); input.setVisible(false); } }); pan.setBounds(0, 0, 320, 335); input.setResizable(false); input.setVisible(true); return out; }