Package shag.dialog

Examples of shag.dialog.ModalDialog


                        return false;
                    }
                }

                ActionCommand[] list = { lefty, save };
                ModalDialog md = ModalDialog.createCustomDialog("Custom Test", list);

                final Action action = md.getNamedAction("Lefty");
   
                JButton button = new JButton("Toggle Lefty");
                button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        action.setEnabled(!action.isEnabled());
                    }
                });
               
                md.showDialog(button);
            }
        });
        p.add(testButton);
       
        testButton = new JButton("createCustomDialog w/ ActionCommands, No Cancel");
        testButton.setToolTipText("Create dialog with optional cancel, then set an array of action commands.");
        testButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ModalDialog.showWarningDialog("To be implemented.");
            }
        });
        p.add(testButton);
       
        // Placeholder to skip a cell.
        p.add(new JLabel());

        testButton = new JButton("createCustomDialog w/ Strings, Cancel");
        testButton.setToolTipText("Create dialog with an array of strings.");
        testButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ModalDialog.showWarningDialog("To be implemented.");
            }
        });
        p.add(testButton);
       
        testButton = new JButton("createCustomDialog w/ Strings, No Cancel");
        testButton.setToolTipText("Create dialog with optional cancel and an array of strings.");
        testButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ModalDialog.showWarningDialog("To be implemented.");
            }
        });
        p.add(testButton);
       
        testButton = new JButton("createOKDialog w/ ActionCommand");
        testButton.setToolTipText("Create dialog then set an action command.");
        testButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final JTextField p = new JTextField("(enter a number)");
                ActionCommand okPassword = new ActionCommand("Enter") {
                    boolean successful = true;
                    public void run() {
                        try {
                            Integer.parseInt(p.getText());
                            successful = true;
                            ModalDialog.showPlainDialog(p.getText());
                        } catch(NumberFormatException e) {
                            successful = false;
                            ModalDialog.showErrorDialog(e.toString());
                        }
                    }
                   
                    public boolean isSuccessful() {
                        return(successful);
                    }
                };
               
                ModalDialog md = ModalDialog.createOKDialog("ActionCommand Test");
                md.getDefaultAction().setCommand(okPassword);
                md.showDialog(p);
            }
        });
        p.add(testButton);
       
        // Install the window's menu bar.
View Full Code Here

TOP

Related Classes of shag.dialog.ModalDialog

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.