public NotificacioGenerica(String missatge) {
    frame = new JFrame("Notificació");
    frame.getContentPane().setLayout(new GridBagLayout());
    label = new JTextArea(missatge);
    label.setEnabled(false);
    label.setEditable(false);
    button = new JButton("D'acord!");
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    frame.getContentPane().add(label, c);
    c.gridy = 1;
    frame.getContentPane().add(button, c);
    button.requestFocusInWindow();

    button.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            frame.dispose();
          }
        });

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    pack();
    mostra(true);
  }
Exemple #2
0
 public void actionPerformed(ActionEvent event) {
   if (event.getSource().equals(launchBrowser)) {
     Configuration config = Configuration.getInstance();
     String ip = Util.getIPAddress();
     String protocol = "http" + (config.ssl ? "s" : "");
     String url = protocol + "://" + ip + ":" + config.port;
     Util.openURL(url);
   } else if (event.getSource().equals(stop)) {
     Util.shutdown();
     running = Util.isRunning();
     setStatus();
   } else if (event.getSource().equals(start)) {
     clearLogsDir();
     run();
     launchBrowser.requestFocusInWindow();
   }
 }
  public OwnerDialog(Araucaria parent) {

    super((Frame) null, true);
    araucaria = parent;
    propText = araucaria.getArgument().getSelectedProps();
    try {
      init();
      okButton.requestFocusInWindow();
      addDialogCloser(masterPanel);
      this.getRootPane().setDefaultButton(okButton);
      this.pack();
    } catch (Exception e) {
      e.printStackTrace();
    }
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(
        d.width / 2 - this.getSize().width / 2, d.height / 2 - this.getSize().height / 2);
  }
Exemple #4
0
 public void setFocusOnStart() {
   start.requestFocusInWindow();
 }