Package diva.gui

Examples of diva.gui.BasicFrame


                        sp.addShade("Foo", new JLabel("foo's component"));
                        sp.addShade("Bar", new JLabel("bar's component"));
                        sp.addShade("Baz", new JLabel("baz's component"));
                        sp.addShade("Moo", new JLabel("moo's component"));

                        JFrame f = new BasicFrame("Shade test");
                        f.getContentPane().add("Center", sp);

                        JPanel btns = new JPanel();
                        f.getContentPane().add("South", btns);

                        JButton b1 = new JButton("rm sel");
                        b1.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                int i = sp.getSelectedIndex();

                                if (i >= 0) {
                                    sp.removeShadeAt(i);
                                }
                            }
                        });
                        btns.add(b1);

                        JButton b2 = new JButton("rm sel-1");
                        b2.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                int i = sp.getSelectedIndex() - 1;

                                if (i >= 0) {
                                    sp.removeShadeAt(i);
                                }
                            }
                        });
                        btns.add(b2);

                        JButton b3 = new JButton("rm sel+1");
                        b3.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                int i = sp.getSelectedIndex() + 1;

                                if ((i >= 1) && (i < sp.getShadeCount())) {
                                    sp.removeShadeAt(i);
                                }
                            }
                        });
                        btns.add(b3);

                        JButton b4 = new JButton("rm all");
                        b4.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                sp.removeAll();
                            }
                        });
                        btns.add(b4);

                        JButton b5 = new JButton("toggle sel");
                        b5.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                int i = sp.getSelectedIndex();

                                if (i >= 0) {
                                    boolean en = sp.isEnabledAt(i);
                                    sp.setEnabledAt(i, !en);
                                }
                            }
                        });
                        btns.add(b5);

                        JButton b6 = new JButton("toggle sel-1");
                        b6.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                int i = sp.getSelectedIndex() - 1;

                                if (i >= 0) {
                                    boolean en = sp.isEnabledAt(i);
                                    sp.setEnabledAt(i, !en);
                                }
                            }
                        });
                        btns.add(b6);

                        f.setSize(600, 400);
                        f.setVisible(true);
                    } catch (Exception ex) {
                        System.err.println(ex.toString());
                        ex.printStackTrace();
                    }
                }
View Full Code Here

TOP

Related Classes of diva.gui.BasicFrame

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.