Package charvax.swing

Examples of charvax.swing.JOptionPane


        String selected_option = null;

        String[] message = { "This shows how to create and use",
                "a JOptionPane directly, without using",
                "the convenience methods"};
        JOptionPane pane = new JOptionPane(message);

        // Make the dialog display a JTextField for user input.
        pane.setWantsInput(true);

        // Set the initial input value displayed to the user.
        pane.setInitialSelectionValue("default input value");

        // Provide customized button labels.
        String[] options = { "Option 1", "Option 2", "Option 3", "Option 4"};
        pane.setOptions(options);

        // Make "Option 2" the default button.
        pane.setInitialValue("Option 2");

        JDialog dialog = pane.createDialog(parent_, "Custom JOptionPane");
        dialog.show();
        Object selectedValue = pane.getValue();
        System.err.println("Selected value is " + selectedValue);
        results[ 0] = "The input value is \"" + (String) pane.getInputValue()
                + "\"";

        // If there is NOT an array of option buttons:
        // (In this case, there is).
        if (pane.getOptions() == null) {
            int option = ((Integer) selectedValue).intValue();
            switch (option) {
            case JOptionPane.YES_OPTION:
                selected_option = "YES";
                break;
View Full Code Here

TOP

Related Classes of charvax.swing.JOptionPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.