Questions tagged [inputverifier]

An InputVerifier validates input in Graphical User Interface (GUI).

In Java, an InputVerifier validates input in Graphical User Interface (GUI). See How to Use the Focus Subsystem: Validating Input for an example.

52 questions
7
votes
5 answers

JButton stays pressed when focus stolen by JOptionPane

I am new to Swing and I have a situation. I am designing an application that renders the GUI components dynamically based on an xml file input(meta-data) . Now most of my JTextFields have InputVerifier set to them, for validation purpose. The input…
dareurdream
  • 241
  • 4
  • 13
3
votes
1 answer

VerifyInputWhenFocusTarget property has no effect

I am attempting to validate the text field user inputs using javax.swing.InputVerifier and the input validation works as expected but I have a problem regarding VerifyInputWhenFocusTarget property. I've made a label to show the status and overridden…
Chupo_cro
  • 698
  • 1
  • 7
  • 21
3
votes
2 answers

Java Swing JTextField setInputVerifier keep focus on TextField

I have a public class JdbDateTextField extends JTextField and in the constructor I add this.setInputVerifier(new ValidDateOrEmptyVerifier());. I use class ValidDateOrEmptyVerifier extends InputVerifier to verify the format of the input. If the…
Viktor Carlson
  • 989
  • 1
  • 13
  • 36
3
votes
1 answer

How to exit from Java Swing application, avoiding messages generated from setInputVerifier

I have a text field where I have imposed some constraint in input data, by the help of InputVerifier. The constraint is if the text field is left empty, then an error message will pop up. When the application starts, the cursor remains on the text…
singha
  • 3,351
  • 3
  • 13
  • 4
3
votes
3 answers

DocumentListener Java, How do I prevent empty string in JTextBox?

I have been working on a personal project to get better with programming. My goal is to make it much more robust, I am just starting. I am a current computer science student. Anyway, I am working on making a portion of the program as shown. I…
David Tunnell
  • 7,252
  • 20
  • 66
  • 124
2
votes
1 answer

temporarily disable ok button on a JDialog, accordingly to a JTextField validation

I have a JDialog created in a fashion like this, accordingly to Oracle's tutorial. using the JOptionPane constructor: optionPane = new JOptionPane(array, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, …
Heisenbug
  • 38,762
  • 28
  • 132
  • 190
2
votes
1 answer

Prevent a JComboBox popup from appearing. Passing InputVerifier

Given the following scenario: one has a JComboBox and a JTextField the latter has an InputVerifier providing its own error message. the textField is the current focus owner and its input does not satisfy the inputVerifier (Here: Less than 3…
Jörg
  • 214
  • 1
  • 9
2
votes
1 answer

Swing focus lost inputverifier

I have a frame with some JTextFields on it. When the user tabs out from a JTextField, I execute custom logic in the FocusTraversalPolicy, which sets some properties and based on them the FocusTraversalPolicy decides where should the focus go next.…
Petar Minchev
  • 46,889
  • 11
  • 103
  • 119
2
votes
1 answer

Why it ignores my while condition when I input an void string ('nothing here')?

I have this code: sex = str(input('type sex:')).upper() while sex not in 'MF': sex = str(input('try again: ')).upper() print('Done!!!') It works fine as a validation thing when I try to input almost anything, but when it's '', it just jumps…
Pedro Henrique
  • 181
  • 3
  • 11
2
votes
1 answer

How to call an InputVerifier in Java?

I am using the NetBeans IDE to design a graphic user interface with java and swing. The purpose of the GUI is to take user input then generate some text files used as input for a program written in Fortran. The problem is that the Fortran program…
Jeff Irwin
  • 1,041
  • 8
  • 12
2
votes
2 answers

Is there a way to force validation after a Format is applied to a JFormattedTextField?

The first thing I do is create a NumberFormat that is appropriate to my needs: this.format = NumberFormat.getIntegerInstance(); this.format.setMinimumIntegerDigits(6); this.format.setMaximumIntegerDigits(6); this.format.setGroupingUsed(false); I…
Thomas Owens
  • 114,398
  • 98
  • 311
  • 431
2
votes
4 answers

Enable JButtons in java after JTextFields have been validated for numeric values greater than 0?

There are two buttons which are enabled only when valid data is present in all fields, that is, numeric values and no negative numbers.. How do you do that?
Maddy
  • 167
  • 1
  • 3
  • 12
2
votes
2 answers

Error with logic or repaint/revalidate Java JFrame

What I am trying to do is this, when I enter the details it will validate if the textFiled is empty when a button is pressed, if it is empty it will display a message saying that. Then it will move to the next textFile similar to many web based…
Aaron
  • 11,239
  • 18
  • 58
  • 73
1
vote
0 answers

How does InputVerifier prevent losing focus

I looked at the InputVerifier class and all I see are booleans. I looked around a bit more (FocusEvent, requestFocus(), focusLost) and I still don't see the particular event that prevents the other Component from gaining focus. I've also looked at…
Jeremy
  • 1,364
  • 1
  • 8
  • 16
1
vote
2 answers

InputVerifier changes button background

The code below shows just a textfield and a button. The textfield has got an inputVerifier which doesn't accept an empty field. As long as the verifier's "false" result is signalled by an optionPane, the button's background turns gray after…
Jörg
  • 214
  • 1
  • 9
1
2 3 4