List of utility methods to do JTextField
void | ponerMayuscula(KeyEvent e, JTextField textField) poner Mayuscula char keyChar = e.getKeyChar(); if (Character.isLetter(keyChar)) textField.setText(textField.getText().trim().toUpperCase()); |
void | quickButtonFlip(JTextField t, JTextField a, JTextField b) Toggles the editiablity of our text fields. t.setEditable(true); a.setEditable(false); b.setEditable(false); |
BufferedImage | readBufferedImage(JTextField out) Reads an image file from disk and returns and BufferedImage. BufferedImage image = null; File fileLocation = new File("img/balls.gif"); try { image = ImageIO.read(fileLocation); } catch (IOException e) { out.setText(String.format("Could not open image: %s", "img/balls.gif")); return image; ... |
void | secureTextDeletionFromTextField(JTextField textField, int length) Deletes text from JTextField s in a secure way. byte[] bytes = new byte[length]; new SecureRandom().engineNextBytes(bytes); String str = new String(bytes, 0, length); textField.setText(str); textField.setText(EMPTY_STRING); |
void | setEnabled(JTextField textField, boolean b) set Enabled textField.setEditable(b); textField.setEnabled(b); |
void | setEnabled(JTextField textField, boolean enabled) Method to enable/disable a Swing JTextField object if (enabled) { textField.setEnabled(true); textField.setBackground(Color.WHITE); } else { textField.setEnabled(false); textField.setBackground(UIManager.getColor("Panel.background")); |
void | setModelValue(JTextField tf, String value) set Model Value if (value != null) {
tf.setText(value);
|
void | setText(JTextField jField, Object pObject, Object pDefault) set Text if (jField == null) { return; if (pObject != null) { jField.setText(pObject.toString()); } else { if (pDefault != null) { jField.setText(pDefault.toString()); ... |
void | setupNoCommitCheckbox(final JCheckBox addLogInformationCheckBox, final JTextField commitMessage, final JCheckBox noCommitCheckBox) Initialize no commit checkbox (for both merge and pull dialog) noCommitCheckBox.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { final boolean selected = noCommitCheckBox.isSelected(); if (commitMessage != null) { commitMessage.setEnabled(!selected); if (selected) { addLogInformationCheckBox.setSelected(false); ... |
void | setupTextField(JPanel panel, JLabel label, JTextField field, long val, String toolTip) setup Text Field setupTextField(panel, label, field, _decimalFormat.format(val), toolTip);
|