String[] options = {"Ok", "Fortryd"}; // the buttons Object[] message = new Object[2]; message[0] = "Indtast dit navn"; message[1] = new JTextField(6); int result = JOptionPane.showOptionDialog ( new JPanel(), // the parent that the dialog blocks message, // the dialog message array "Navn", // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type icon, // optional icon, use null to use the options, // options string array, will be made into message[1] // option that should be made into a default ); String n = ((JTextField)message[1]).getText();
loadet var desværre hurtigst, men du får 5 point for eksemplet
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.