nJobs.setEditable(false); nJobs.setBorder(BorderFactory.createEmptyBorder()); nJobs.setBackground(new Color(230, 230, 230)); costsVal.setEditable(false); costsVal.setBorder(BorderFactory.createEmptyBorder()); costsVal.setBackground(new Color(230, 230, 230)); vehVal.setBorder(BorderFactory.createEmptyBorder()); vehVal.setBackground(new Color(230, 230, 230));
@Override public void propertyChange(PropertyChangeEvent evt) { startValueTextField.setBackground(startValueTextField.isEditValid() ? null : Color.RED); } });
private void updateRotationField(double ra) { while (ra > 180) { ra -= 360; } while (ra < -180) { ra += 360; } rotationAngleField.setValue(ra); if (zeroRotationAngleBackground == null) { zeroRotationAngleBackground = rotationAngleField.getBackground(); } if (ra > 0) { rotationAngleField.setBackground(positiveRotationAngleBackground); } else if (ra < 0) { rotationAngleField.setBackground(negativeRotationAngleBackground); } else { rotationAngleField.setBackground(zeroRotationAngleBackground); } }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); if (!enabled) { super.setBackground(UIManager.getColor("TextField.inactiveBackground")); } } }
private void updateRotationField(Double ra) { while (ra > 180) { ra -= 360; } while (ra < -180) { ra += 360; } rotationAngleField.setValue(ra); if (zeroRotationAngleBackground == null) { zeroRotationAngleBackground = rotationAngleField.getBackground(); } if (ra > 0) { rotationAngleField.setBackground(positiveRotationAngleBackground); } else if (ra < 0) { rotationAngleField.setBackground(negativeRotationAngleBackground); } else { rotationAngleField.setBackground(zeroRotationAngleBackground); } }
@Override public void propertyChange(PropertyChangeEvent evt) { endValueTextField.setBackground(endValueTextField.isEditValid() ? null : Color.RED); } });
@Override public String valueToString(Object value) throws ParseException { if (value == null) { getFormattedTextField().setBackground(Color.white); return ""; } String retVal = null; try { retVal = super.valueToString(value); getFormattedTextField().setBackground(Color.white); } catch(ParseException ex){ getFormattedTextField().setBackground(Color.red); throw ex; } return retVal; }
public void actionPerformed(ActionEvent e) { if (e.getID() == 1001) { if (rainbowColor.isSelected()) { lastMinChoice = minColour.getBackground(); minColour.setBackground(ScaleColorRelationAnnotator.this.getBackground()); minColour.removeMouseListener(cl); lastMaxChoice = maxColour.getBackground(); maxColour.setBackground(ScaleColorRelationAnnotator.this.getBackground()); maxColour.removeMouseListener(cl); } else { minColour.setBackground(lastMinChoice); minColour.addMouseListener(cl); maxColour.setBackground(lastMaxChoice); maxColour.addMouseListener(cl); } } } });
private void setRangeTextFieldColor(boolean validValues) { Color backgroundColor = getTextFieldBackgroundColor(validValues); ((JSpinner.NumberEditor) this.rangeStartSpinner.getEditor()) .getTextField().setBackground(backgroundColor); ((JSpinner.NumberEditor) this.rangeEndSpinner.getEditor()) .getTextField().setBackground(backgroundColor); }
public void actionPerformed(ActionEvent e) { if (e.getID() == 1001) { if (rainbowColor.isSelected()) { lastMinChoice = minColour.getBackground(); minColour.setBackground(ScaleColorConceptAnnotator.this.getBackground()); minColour.removeMouseListener(cl); lastMaxChoice = maxColour.getBackground(); maxColour.setBackground(ScaleColorConceptAnnotator.this.getBackground()); maxColour.removeMouseListener(cl); } else { minColour.setBackground(lastMinChoice); minColour.addMouseListener(cl); maxColour.setBackground(lastMaxChoice); maxColour.addMouseListener(cl); } } } });
@Override public void setBackground(final Color bg) { if (getEditor() == null) { // when called from constructor super.setBackground(bg); } else { getEditor().setBackground(bg); } }
/** * @return the spinner component that is visible when the focus box has * 'focus'. */ JSpinner getSpinner() { if (m_spinner == null) { m_spinner = new JSpinner(new SpinnerNumberModel(m_index, 1, m_max_index, 1)); m_spinner.setBorder(javax.swing.BorderFactory.createLineBorder(m_background)); JSpinner.NumberEditor seditor = (JSpinner.NumberEditor) m_spinner.getEditor(); seditor.getTextField().setBackground(m_background); seditor.getTextField().setForeground(m_foreground); m_spinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { notifyListeners(new ActionEvent(FocusBox.this, ActionEvent.ACTION_PERFORMED, FOCUS_INDEX_CHANGED)); } }); } return m_spinner; }
@Override protected JFormattedTextField createEditor() { JFormattedTextField result = super.createEditor(); Insets ins = SubstanceSizeUtils .getComboTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(result)); result.setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom, ins.right)); result.setBackground(this.datePicker.getBackground()); result.setOpaque(false); return result; }
@Override public void setBackground(Color bg) { super.setBackground(bg); if (_spinner != null) { _spinner.setBackground(bg); if (_spinner.getEditor() != null && _spinner.getEditor() instanceof JSpinner.DateEditor) { JSpinner.DateEditor de = (JSpinner.DateEditor) _spinner.getEditor(); if (de.getTextField() != null) { de.getTextField().setBackground(bg); } } } }
public JFormattedTextField getIntegerTextField(Integer min, Integer max, Integer value) { NumberFormat format = NumberFormat.getInstance(); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(min); formatter.setMaximum(max); formatter.setAllowsInvalid(true); formatter.setCommitsOnValidEdit(false); JFormattedTextField field = new JFormattedTextField(formatter); field.setValue(value); field.setFont(REGULAR_FONT.deriveFont(scale * 18)); field.setFocusLostBehavior(JFormattedTextField.PERSIST); field.setForeground(AppThemeColor.TEXT_DEFAULT); field.setCaretColor(AppThemeColor.TEXT_DEFAULT); field.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(AppThemeColor.BORDER, 1), BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT, 3) )); field.setBackground(AppThemeColor.HEADER); return field; }
/** * {@inheritDoc} * <p> * * Overridden to set the background of its child compenents. */ @Override public void setBackground(Color bg) { super.setBackground(bg); for (int i = 0; i < getComponentCount(); i++) { getComponent(i).setBackground(bg); } if (yearSpinner != null) { yearSpinner.setBackground(bg); yearSpinner.getEditor().setBackground(bg); ((DefaultEditor) yearSpinner.getEditor()).getTextField() .setBackground(bg); } }
/** * {@inheritDoc} * <p> * * Overridden to set the background of its child compenents. */ @Override public void setBackground(Color bg) { super.setBackground(bg); for (int i = 0; i < getComponentCount(); i++) { getComponent(i).setBackground(bg); } if (yearSpinner != null) { yearSpinner.setBackground(bg); yearSpinner.getEditor().setBackground(bg); ((DefaultEditor) yearSpinner.getEditor()).getTextField() .setBackground(bg); } }
/** * {@inheritDoc} * <p> * * Overridden to set the background of its child compenents. */ @Override public void setBackground(Color bg) { super.setBackground(bg); for (int i = 0; i < getComponentCount(); i++) { getComponent(i).setBackground(bg); } if (yearSpinner != null) { yearSpinner.setBackground(bg); yearSpinner.getEditor().setBackground(bg); ((DefaultEditor) yearSpinner.getEditor()).getTextField() .setBackground(bg); } }
/** * {@inheritDoc} * <p> * * Overridden to set the background of its child compenents. */ @Override public void setBackground(Color bg) { super.setBackground(bg); for (int i = 0; i < getComponentCount(); i++) { getComponent(i).setBackground(bg); } if (yearSpinner != null) { yearSpinner.setBackground(bg); yearSpinner.getEditor().setBackground(bg); ((DefaultEditor) yearSpinner.getEditor()).getTextField() .setBackground(bg); } }
/** * {@inheritDoc} * <p> * * Overridden to set the background of its child compenents. */ @Override public void setBackground(Color bg) { super.setBackground(bg); for (int i = 0; i < getComponentCount(); i++) { getComponent(i).setBackground(bg); } if (yearSpinner != null) { yearSpinner.setBackground(bg); yearSpinner.getEditor().setBackground(bg); ((DefaultEditor) yearSpinner.getEditor()).getTextField() .setBackground(bg); } }