Results 1 to 4 of 4
- 08-08-2011, 02:31 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
Creating a selective InputVerifier
Hi, i´ve been struggling with a piece of code on wich i have a JFormattedTextField with an InputVerifier set in. The case is this...as long as the JPanel, on wich this TextField is placed in, is active the InputVerifier should verify the input :)...however if the user select a JMenu placed in the JMenuBar this InputVerifier should be deactivated...avoiding to launch an OptionDialog. Below is the InputVerifier´s code. Any ideas?. Thank you.
PS: I´ve tried to reset the TextField´s InputVerfier to null, to overried the shouldYieldFocus(), to disable everything (JPanel, TextField, etc)...please anyone...HELP!Java Code:private InputVerifier verifier_leg = new InputVerifier() { @Override public boolean verify(JComponent input) { Boolean aux = !txt.getText().isEmpty(); if (!(aux)){ getToolkit().beep(); txt.selectAll(); JOptionPane.showConfirmDialog(null, "El Numero de legajo ingresado no se encuentra en el registro", "Error", JOptionPane.PLAIN_MESSAGE, JOptionPane.INFORMATION_MESSAGE); } return aux; } };Last edited by sunde887; 08-08-2011 at 02:39 AM. Reason: review; Added code tags, [code]...[/code]
- 08-08-2011, 02:43 AM #2
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,143
- Rep Power
- 5
You can try this when you create your menus:
Java Code:menu.setVerifyInputWhenFocusTarget( false );
- 08-15-2011, 05:40 PM #3
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
- 08-15-2011, 06:53 PM #4
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
It´s a bug, thanks for the assistance anyway :)
Similar Threads
-
selective image encryption
By anjalirag in forum New To JavaReplies: 1Last Post: 04-20-2013, 06:28 AM -
Creating and implementing class for creating a calendar object
By kumalh in forum New To JavaReplies: 9Last Post: 07-29-2011, 02:18 PM -
To set selective font, color and size for a column in a table
By sas in forum AWT / SwingReplies: 3Last Post: 04-05-2011, 02:46 PM -
Send selective objects in a class over network
By RDReavis in forum Advanced JavaReplies: 2Last Post: 01-18-2010, 08:45 AM -
Go-back-N & Selective repeat protocol
By Engineera in forum NetworkingReplies: 3Last Post: 01-14-2009, 11:18 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks