Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XXX.click may be error when JTextField is not visible #16

Open
stevenfrog opened this issue Apr 8, 2013 · 0 comments
Open

XXX.click may be error when JTextField is not visible #16

stevenfrog opened this issue Apr 8, 2013 · 0 comments

Comments

@stevenfrog
Copy link

I create a textField ti input file path.

final JTextField filePathField = new JTextField(20);
filePathField.setName(name);
filePathField.serVisible(false)

so it's not shown at beginning.
Then I use a change button to show it.

changeButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              ...
                filePathField.setVisible(true);
                ...
            }
        });

Other select button will get text from filePathField.

selectButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                ...
                    String filePath = filePathField.getText().trim();
                 ...
            }
        });

My test code:

changeButton.click();
// filePathField will show after changeButton clicked.
        filePathField.setText(TEST_FILES + "a.log");
        selectButton.click();   -> I found this action will not really do, if I System.out.println("xxxxx"), it will not shown in console

But If I set filePathField.serVisible(true) in codes, test goes OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant