List of usage examples for javax.swing JTextField setForeground
@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.") public void setForeground(Color fg)
From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java
/** * Sets the default text for the specified field. * * @param field The field to handle.//from ww w .j a v a 2s . co m * @param text The text to display. */ private void setTextFieldDefault(JTextField field, String text) { field.getDocument().removeDocumentListener(this); if (text == null) { field.setText(""); field.setForeground(originalColor); } else { field.setText(text); field.setForeground(Color.LIGHT_GRAY); } field.getDocument().addDocumentListener(this); setControls(); }
From source file:org.scify.talkandplay.gui.users.UserFormPanel.java
private void disableTextField(JTextField textField) { textField.setEnabled(false);/*w w w.j a v a2 s . c om*/ textField.setForeground(Color.decode(UIConstants.disabledColor)); textField.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.decode(UIConstants.disabledColor))); textField.setBorder(BorderFactory.createCompoundBorder(textField.getBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); }
From source file:org.scify.talkandplay.gui.users.UserFormPanel.java
private void enableTextField(JTextField textField) { textField.setEnabled(true);/*from w ww . j av a 2 s.co m*/ textField.setForeground(Color.decode(UIConstants.green)); textField.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.decode(UIConstants.green))); textField.setBorder(BorderFactory.createCompoundBorder(textField.getBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); }
From source file:tools.help.java
/** * kontrolor na double tie meni bodku ?iarku * * @param Y Jtext field vstup/*from ww w.j a v a2 s.c o m*/ * @param output ak je Y kokoina tak vyhodi tuto hodnotu * @return */ public static double ReadCheckDouble(javax.swing.JTextField Y, double output) { String hodnota1 = Y.getText(); hodnota1 = hodnota1.replace(" ", ""); String hodnota2 = hodnota1.replace(",", "."); if (hodnota1.equals(hodnota2)) { } else { Y.setText(hodnota2); } Double value; try { value = Double.parseDouble(hodnota2); Y.setForeground(Color.black); return value; } catch (NumberFormatException | NullPointerException e) { Y.setForeground(Color.red); return value = output; } }
From source file:tools.help.java
/** * vyluje to iste ?islo po kontrole a ak je kokotnia tak vrati hodnotu aout * put, a ete ak je kokotina tak vyhodi error sigh * * @param Y Jtext field/*w w w.java2 s . c o m*/ * @param output * @return */ public static double ReadCheckDoubleErrorSign(javax.swing.JTextField Y, double output) { String hodnota1 = Y.getText(); hodnota1 = hodnota1.replace(" ", ""); String hodnota2 = hodnota1.replace(",", "."); if (hodnota1.equals(hodnota2)) { } else { Y.setText(hodnota2); } Double value; try { value = Double.parseDouble(hodnota2); Y.setForeground(Color.black); return value; } catch (NumberFormatException | NullPointerException e) { Y.setForeground(Color.red); help.warning1row(language_help.LangLabel(constants.getLanguage_option(), 3)); return value = output; } }
From source file:tools.help.java
public static int ReadCheckIntErrorSign(javax.swing.JTextField Y, int output, String error) { String hodnota1 = Y.getText(); hodnota1 = hodnota1.replace(" ", ""); String hodnota2 = hodnota1.replace(",", "."); if (hodnota1.equals(hodnota2)) { } else {/*ww w . j a v a2 s. co m*/ Y.setText(hodnota2); } int value; try { value = Integer.parseInt(hodnota2); Y.setForeground(Color.black); return value; } catch (NumberFormatException | NullPointerException e) { Y.setForeground(Color.red); help.warning1row(error); return value = output; } }