java - Returning a JTextField to editing after a warning dialog -


In my application I have a JTextField, which will allow the user to fill it with input in a certain way. I have a method that checks that the input in the field is valid and if it does not display a dialog, after this I want to focus on returning to the text field so that the user can fix the mistake and make the right formatted Could type in input I tried to do this by having the JTextField call request Focus () on myself, but it seems only half job JTextField displays cursing cursor, but as long as I do not click on the text field again, Can not type in text also Do I have another method of calling? I could not find anything else in the documentation

This is not exactly the solution you asked, but you You may want to consider javax.swing. InputWirefire This object allows you to verify the input in a field and remove the focus if the format is not correct. I do not think it will allow you to set up a dialogue to explain the error (although it may be - try it out) but this will definitely allow you to place a message in the 'message area'.

What do you do JComponent has an input wichiter set, whether it tests the content for validity; If this is not correct then JComponent will not issue a focus (and can write an error message).


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -