Package java.awt

Examples of java.awt.Button$State


            Panel center = new Panel();
            center.add(new Label(message));

            // Create a panel for the 'OK' button
            Panel bottom = new Panel();
            Button okButton = new Button("   OK   ");
            okButton.addActionListener(new ButtonHandler());
            bottom.add(okButton);

            // Add the two panels to the window/frame
            add(center, BorderLayout.CENTER);
            add(bottom,BorderLayout.SOUTH);
View Full Code Here


         p.add(pp);
         constr.gridwidth = GridBagConstraints.REMAINDER;
         gb.setConstraints(pp, constr);
         constr.gridwidth = 1;
         constr.weightx = 1.0;
         Button b;
         p.add(b = new Button("  OK  "));
         b.addActionListener(new Ok());
         constr.weightx = 1.0;
         gb.setConstraints(b, constr);
         p.add(b = new Button("Clear"));
         b.addActionListener(new Clear());
         constr.weightx = 2.0;
         gb.setConstraints(b, constr);
         p.add(b = new Button("Cancel"));
         b.addActionListener(new Cancel());
         constr.weightx = 1.0;
         gb.setConstraints(b, constr);
         add("South", p);

         pack();
View Full Code Here

      add(new Panel(), constr);

      constr.gridwidth = 1;
      constr.anchor = GridBagConstraints.CENTER;
      constr.weightx = 1.0;
      add(default_focus = new Button("Accept"), constr);
      default_focus.addActionListener(new Accept());

      Button b;
      constr.gridwidth = GridBagConstraints.REMAINDER;
      add(b = new Button("Reject"), constr);
      b.addActionListener(new Reject());

      constr.weightx = 0.0;
      p = new Separator();
      constr.fill = GridBagConstraints.HORIZONTAL;
      add(p, constr);

      constr.fill = GridBagConstraints.NONE;
      constr.anchor = GridBagConstraints.WEST;
      add(new Label("Accept/Reject all cookies from a host or domain:"), constr);

      p = new Panel();
      p.add(new Label("Host/Domain:"));
      p.add(domain = new TextField(30));
      add(p, constr);

      add(new Label("domains are characterized by a leading dot (`.');"), constr);
      add(new Label("an empty string matches all hosts"), constr);

      constr.anchor = GridBagConstraints.CENTER;
      constr.gridwidth = 1;
      constr.weightx = 1.0;
      add(b = new Button("Accept All"), constr);
      b.addActionListener(new AcceptDomain());

      constr.gridwidth = GridBagConstraints.REMAINDER;
      add(b = new Button("Reject All"), constr);
      b.addActionListener(new RejectDomain());

      pack();

      constr.anchor = GridBagConstraints.WEST;
      constr.gridwidth = GridBagConstraints.REMAINDER;
View Full Code Here

            p.add(l);

            add(p, "Center");

            Button cb = new Button("Close");
            cb.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    dispose();
                }
            });
View Full Code Here

            ((GridLayout) p.getLayout()).setHgap(5);
            ((GridLayout) p.getLayout()).setVgap(5);

            for (int i = 0; i < 3; ++i) {
                final int val = i;
                Button tweak = new Button("Set " + i);
                tweak.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        cg.setSelectedCheckbox(boxes[val]);
                    }
                });
                p.add(tweak);
            }

            add(p, "Center");

            Button cb = new Button("Close");
            cb.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    dispose();
                }
            });
View Full Code Here

            ch.setSize(150, 150);
            add(ch, "Center");

            final ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
            final Panel p = new Panel();
            p.add(new Button("Stop"));
            p.add(new Button("evil"));
            p.add(new Button("hoarders"));
            p.add(new Button("use"));
            p.add(new Button("GNU!"));

            sp.add(p);
            add(sp, "South");

            Panel east_panel = new Panel();
            east_panel.setLayout(new GridLayout(0, 1));

            CheckboxGroup group = new CheckboxGroup();
            Checkbox cb = new Checkbox("one", group, true);
            east_panel.add(cb);
            cb = new Checkbox("two", group, false);
            east_panel.add(cb);

            add(east_panel, "East");

            final Button wb = new Button();
            wb.setLabel("Hello World!");
            wb.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    l.setText("Hello World!");

                    final Dialog d = new Dialog(parent);
                    d.setLayout(new FlowLayout());
                    d.setModal(true);
                    Button b = new Button("foobar");
                    b.addMouseListener(new MouseAdapter() {
                        public void mousePressed(MouseEvent me) {
                            d.setVisible(false);
                        }
                    });
                    d.add(b);
View Full Code Here

        public void init() {
            initted = true;
            setTitle("RoundRect");
            setLayout(new BorderLayout());
            add(new DrawRoundRect(), "West");
            Button cb = new Button("Close");
            cb.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    dispose();
                }
            });
            add(cb, "Center");
View Full Code Here

        l.add("Item 1");
        l.add("Item 2");
        l.add("Item 3");
        //wnd.add(l, BorderLayout.NORTH);

        final Button b = new Button("Hello world");
        b.addActionListener(new ActionListener() {
            int i = 0;

            public void actionPerformed(ActionEvent e) {
                System.out.println("Action performed " + e);
                switch (i) {
                    case 0: {
                        add(new Button(String.valueOf(i)), BorderLayout.WEST);
                        break;
                    }
                    case 1: {
                        add(new Button(String.valueOf(i)), BorderLayout.SOUTH);
                        break;
                    }
                    case 2: {
                        add(new Button(String.valueOf(i)), BorderLayout.EAST);
                        break;
                    }
                    default:
                        b.setLabel(String.valueOf(i));
                        setVisible(false);
                }
                i++;
                invalidate();
            }
        });
        add(b, BorderLayout.CENTER);
        b.setBackground(Color.YELLOW);

        final Button b2 = new Button("Left");
        final Scrollbar sb = new Scrollbar(Scrollbar.HORIZONTAL);
        final Checkbox cb1 = new Checkbox("Right");

        add(b2, BorderLayout.WEST);
        b2.setBackground(Color.RED);
        b2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("Action on b2");
                if (sb.getValue() + sb.getBlockIncrement() <= sb.getMaximum()) {
                    sb.setValue(sb.getValue() + sb.getBlockIncrement());
                } else {
View Full Code Here

        Hashtable<Button, SubWindow> windows;

        Vector<Button> buttons;

        void addSubWindow(String name, SubWindow w) {
            Button b = new Button(name);
            b.addActionListener(this);

            buttons.addElement(b);
            windows.put(b, w);
        }
View Full Code Here

            setMenuBar(mb);

            String version = System.getProperty("gnu.classpath.version");
            add(new Label("GNU Classpath " + version), "North");

            closeButton = new Button("Close");
            closeButton.addActionListener(this);
            closeButton.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 18));
            add(closeButton, "South");

            windows = new Hashtable<Button, SubWindow>();
View Full Code Here

TOP

Related Classes of java.awt.Button$State

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.