Hi, In my application i have a JDialog having a default ok button. By pressing the button an error dialog will be shown. The problem is pressing the ok button continuously (holding it), will hang the application. Other than using a timer how can i fix this? pl. give me a solution as early as possible... A sample code is given below, having the same scenario.
/** * method invoked when an action is performed on the button */ private void button_actionPerformed() { JOptionPane.showOptionDialog(this, "Continuously clicking enter will hang the application", "Title", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, null, null); }
/** * main method * * @param args command line arguments */ public static void main(String[] args) { TestModal modalObject = new TestModal(); modalObject.setSize(100,100); modalObject.show(); } }