Package java.awt

Examples of java.awt.Button$State


        // add the Cancel button to the bottom of the dialog (if allowCancel is
        // true)
        if (allowCancel) {
            Panel bottom = new Panel(new FlowLayout(FlowLayout.CENTER, 1, 1));
            cancel = new Button(Messages.getString("ProgressBar.cancel")); //$NON-NLS-1$
            cancel.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    // pbar.dispose();
                    shouldCancel = true;
                }
View Full Code Here


        p.add(cFKForced);
        p.add(createLabel(""));
        p.add(createLabel(""));

        if (iTransferMode == TRFM_TRANSFER) {
            bStart    = new Button("Start Transfer");
            bContinue = new Button("Continue Transfer");

            bContinue.setEnabled(false);
        } else if (iTransferMode == Transfer.TRFM_DUMP) {
            bStart = new Button("Start Dump");
        } else if (iTransferMode == Transfer.TRFM_RESTORE) {
            bStart = new Button("Start Restore");
        }

        bStart.addActionListener(this);
        p.add(bStart);
View Full Code Here

        txtResult = new TextArea(20, 40);

        txtCommand.setFont(fFont);
        txtResult.setFont(new Font("Courier", Font.PLAIN, 12));

        butExecute = new Button("Execute");
        butClear   = new Button("Clear");

        butExecute.addActionListener(this);
        butClear.addActionListener(this);
        pCommand.add("East", butExecute);
        pCommand.add("West", butClear);
View Full Code Here

      pluginLoader.broadcast(new AppletRequest(this));
      if (appletFrame != this) {
        final String startText = options.getProperty("Applet.detach.startText");
        final String stopText = options.getProperty("Applet.detach.stopText");
        final Button close = new Button();

        // this works for Netscape only!
        Vector privileges =
                Common.split(options.getProperty("Applet.Netscape.privilege"), ',');
        Class privilegeManager = null;
        Method enable = null;
        try {
          privilegeManager =
                  Class.forName("netscape.security.PrivilegeManager");
          enable = privilegeManager
                  .getMethod("enablePrivilege", new Class[]{String.class});
        } catch (Exception e) {
          System.err.println("Applet: This is not Netscape ...");
        }

        if (privilegeManager != null && enable != null && privileges != null)
          for (int i = 0; i < privileges.size(); i++)
            try {
              enable.invoke(privilegeManager,
                            new Object[]{privileges.elementAt(i)});
              System.out.println("Applet: access for '" +
                                 privileges.elementAt(i) + "' allowed");

            } catch (Exception e) {
              System.err.println("Applet: access for '" +
                                 privileges.elementAt(i) + "' denied");
            }

        // set up the clipboard
        try {
          clipboard = appletFrame.getContentPane().getToolkit().getSystemClipboard();
          System.err.println("Applet: acquired system clipboard: " + clipboard);
        } catch (Exception e) {
          System.err.println("Applet: system clipboard access denied: " +
                             ((e instanceof InvocationTargetException) ?
                              ((InvocationTargetException) e).getTargetException() : e));
          // e.printStackTrace();
        } finally {
          if (clipboard == null) {
            System.err.println("Applet: copy & paste only within the JTA");
            clipboard = new Clipboard("de.mud.jta.Main");
          }
        }

        if ((new Boolean(options.getProperty("Applet.detach.immediately"))
                .booleanValue())) {
          if ((new Boolean(options.getProperty("Applet.detach.fullscreen"))
                  .booleanValue()))
            ((JFrame) appletFrame)
                    .setSize(appletFrame.getContentPane().getToolkit().getScreenSize());
          else
            ((JFrame) appletFrame).pack();

          ((JFrame) appletFrame).show();
          pluginLoader.broadcast(new SocketRequest(host, Integer.parseInt(port)));
          pluginLoader.broadcast(new ReturnFocusRequest());
          close.setLabel(startText != null ? stopText : "Disconnect");
        } else
          close.setLabel(startText != null ? startText : "Connect");

        close.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (((JFrame) appletFrame).isVisible()) {
              pluginLoader.broadcast(new SocketRequest());
              ((JFrame) appletFrame).setVisible(false);
              close.setLabel(startText != null ? startText : "Connect");
            } else {
              if (frameTitle == null)
                ((JFrame) appletFrame)
                        .setTitle("jta: " + host + (port.equals("23")?"":" " + port));
              if ((new Boolean(options.getProperty("Applet.detach.fullscreen"))
                      .booleanValue()))
                ((JFrame) appletFrame)
                        .setSize(appletFrame.getContentPane().getToolkit().getScreenSize());
              else
                ((JFrame) appletFrame).pack();
              ((JFrame) appletFrame).show();
              if (port == null || port.length() <= 0)
    port = "23";
              getAppletContext().showStatus("Trying " + host + " " + port + " ...");
              pluginLoader.broadcast(new SocketRequest(host,
                                                       Integer.parseInt(port)));
              pluginLoader.broadcast(new ReturnFocusRequest());
              close.setLabel(stopText != null ? stopText : "Disconnect");
            }
          }
        });

        getContentPane().setLayout(new BorderLayout());
        getContentPane().add("Center", close);

        // add a menu bar
        MenuBar mb = new MenuBar();
        Menu file = new Menu("File");
        file.setShortcut(new MenuShortcut(KeyEvent.VK_F, true));
        MenuItem tmp;
        file.add(tmp = new MenuItem("Connect"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            pluginLoader.broadcast(new SocketRequest(host,
                                                     Integer.parseInt(port)));
          }
        });
        file.add(tmp = new MenuItem("Disconnect"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            pluginLoader.broadcast(new SocketRequest());
          }
        });
        file.add(new MenuItem("-"));
        file.add(tmp = new MenuItem("Print"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (pluginLoader.getComponents().get("Terminal") != null) {
              PrintJob printJob =
                      appletFrame.getContentPane().getToolkit()
                      .getPrintJob((JFrame) appletFrame, "JTA Terminal", null);
              ((Component) pluginLoader.getComponents().get("Terminal"))
                      .print(printJob.getGraphics());
              printJob.end();
            }
          }
        });
        file.add(new MenuItem("-"));
        file.add(tmp = new MenuItem("Exit"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            ((JFrame) appletFrame).setVisible(false);
            pluginLoader.broadcast(new SocketRequest());
            close.setLabel(startText != null ? startText : "Connect");
          }
        });
        mb.add(file);

        Menu edit = new Menu("Edit");
        edit.setShortcut(new MenuShortcut(KeyEvent.VK_E, true));
        edit.add(tmp = new MenuItem("Copy"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (debug > 2)
              System.err.println("Applet: copy: " + focussedPlugin);
            if (focussedPlugin instanceof VisualTransferPlugin)
              ((VisualTransferPlugin) focussedPlugin).copy(clipboard);
          }
        });
        edit.add(tmp = new MenuItem("Paste"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (debug > 2)
              System.err.println("Applet: paste: " + focussedPlugin);
            if (focussedPlugin instanceof VisualTransferPlugin)
              ((VisualTransferPlugin) focussedPlugin).paste(clipboard);
          }
        });
        mb.add(edit);

        Map menuList = pluginLoader.getMenus();
        names = menuList.keySet().iterator();
        while (names.hasNext()) {
          String name = (String) names.next();
    Object o = menuList.get(name);
          if (o instanceof Menu) mb.add((Menu) o);
        }

        Menu help = new Menu("Help");
        help.setShortcut(new MenuShortcut(KeyEvent.VK_HELP, true));
        help.add(tmp = new MenuItem("General"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Help.show(appletFrame.getContentPane(), options.getProperty("Help.url"));
          }
        });
        mb.setHelpMenu(help);

        // only add the menubar if the property is true
        if ((new Boolean(options.getProperty("Applet.detach.menuBar"))
                .booleanValue()))
          ((JFrame) appletFrame).setMenuBar(mb);

        // add window closing event handler
        try {
          ((JFrame) appletFrame).addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
              pluginLoader.broadcast(new SocketRequest());
              ((JFrame) appletFrame).setVisible(false);
              close.setLabel(startText != null ? startText : "Connect");
            }
          });
        } catch (Exception e) {
          System.err.println("Applet: could not set up Window event listener");
          System.err.println("Applet: you will not be able to close it");
        }

        pluginLoader.registerPluginListener(new OnlineStatusListener() {
          public void online() {
            if (debug > 0) System.err.println("Terminal: online");
            online = true;
            if (((JFrame) appletFrame).isVisible() == false)
              ((JFrame) appletFrame).setVisible(true);
          }

          public void offline() {
            if (debug > 0) System.err.println("Terminal: offline");
            online = false;
            if (disconnectCloseWindow) {
              ((JFrame) appletFrame).setVisible(false);
              close.setLabel(startText != null ? startText : "Connect");
            }
          }
        });

        // register a focus status listener, so we know when a plugin got focus
View Full Code Here

    this.add(this.text);
   
    this.data = new TextField(60);
    this.add(this.data);
   
    Button push_button = new Button("push");
    push_button.addActionListener(new pushListener(s, this));
    this.add(push_button);
    Button pop_button = new Button("pop");
    pop_button.addActionListener(new popListener(s, this));
    this.add(pop_button);
   
    Button lock_button = new Button("print");
    lock_button.addActionListener(new printListener(s, this));
    this.add(lock_button);
   
    this.setSize(500, 300);
    this.setResizable(false);
    this.text.setBackground(Color.black);
View Full Code Here

        super(client);
    }

    public Object createComponentInstance(Object parent, DomNode element)
    {
        Button btn = new Button();
        return btn;
    }
View Full Code Here

    }

    public Object updateUI(Object com, DomNode element)
    {
        String str = element.getAttribute("label");
        Button btn = (Button) com;
        btn.setLabel(str);
        return btn;
    }
View Full Code Here

            BridgeInputContext context, Map inputForm)
    { //TODO: Change the way the event is detect and dispatch
        //use a dispatcher
        if (hasEvent(peer, inputForm))
        {
            Button btn = (Button) peer.getComponentObject();           
            postEvent(context, new ActionEvent(btn, ActionEvent.ACTION_PERFORMED, btn.getActionCommand()),
                    BridgeEventQueue.LOW_PRIORITY); //always low priority
        }
    }
View Full Code Here

          fRun.setEnabled(fSuiteField.getText().length() > 0);
          fStatusLine.setText("");
        }
      }
    );
    fRun= new Button("Run");
    fRun.setEnabled(false);
    fRun.addActionListener(
      new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          runSuite();
        }
      }
    );
    boolean useLoader= useReloadingTestSuiteLoader();
    fUseLoadingRunner= new Checkbox("Reload classes every run", useLoader);
    if (inVAJava())
      fUseLoadingRunner.setVisible(false);

    //---- second section
    fProgressIndicator= new ProgressBar();

    //---- third section
    fNumberOfErrors= new Label("0000", Label.RIGHT);
    fNumberOfErrors.setText("0");
    fNumberOfErrors.setFont(PLAIN_FONT);

    fNumberOfFailures= new Label("0000", Label.RIGHT);
    fNumberOfFailures.setText("0");
    fNumberOfFailures.setFont(PLAIN_FONT);

    fNumberOfRuns= new Label("0000", Label.RIGHT);
    fNumberOfRuns.setText("0");
    fNumberOfRuns.setFont(PLAIN_FONT);

    Panel numbersPanel= createCounterPanel();

    //---- fourth section
    Label failureLabel= new Label("Errors and Failures:");

    fFailureList= new List(5);
    fFailureList.addItemListener(
      new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
          failureSelected();
        }
      }
    );
    fRerunButton= new Button("Run");
    fRerunButton.setEnabled(false);
    fRerunButton.addActionListener(
      new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          rerun();
        }
      }
    );

    Panel failedPanel= new Panel(new GridLayout(0, 1, 0, 2));
    failedPanel.add(fRerunButton);

    fTraceArea= new TextArea();
    fTraceArea.setRows(5);
    fTraceArea.setColumns(60);

    //---- fifth section
    fStatusLine= new TextField();
    fStatusLine.setFont(PLAIN_FONT);
    fStatusLine.setEditable(false);
    fStatusLine.setForeground(Color.red);

    fQuitButton= new Button("Exit");
    fQuitButton.addActionListener(
      new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          System.exit(0);
        }
View Full Code Here

  frame_1_grid.columnWeights = frame_1_columnWeights;

  frame_1 = new Panel();
  this.add(frame_1);
 
  ok = new Button();
  ok.setLabel("OK");
  frame_1.add(ok);
 
  title = new Label();
  title.setFont(new Font("Helvetica",Font.PLAIN + Font.BOLD , 18));
  title.setText(message);
  title.setAlignment(Label.CENTER);
  this.add(title);
 
  cancel = new Button();
  cancel.setLabel("Cancel");
  frame_1.add(cancel);
 
  // Geometry management
  GridBagConstraints con = new GridBagConstraints();
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.