예제 #1
0
  public void login() {

    if (DataUser.getUsr() == null) {
      LoginDialog form = new LoginDialog();
      ODatabaseDocumentTx db = App.getDbd();
      ODatabaseRecordThreadLocal.INSTANCE.set(db);
      form.buildComponent(db);
      db.close();
      JDialog d = new JDialog(frame);
      d.setModalityType(ModalityType.APPLICATION_MODAL);
      d.getContentPane().add(form.getPanel());
      d.pack();
      setCenterDialog(d);
      d.setVisible(true);
    } else {
      // logout
      DataUser.setUsr(null);
      DataUser.setGrp(null);
      closeAllWindow();
    }
    DataUser.setAkses();
    for (HakAksesListener hakAksesListener : cangeHakAkses) {
      hakAksesListener.changeHakAkses();
    }
    //		if (DataUser.usr != null) {
    //			// open default like welcome
    //
    //		}
  }
예제 #2
0
  protected static void doUninstall() {
    final UninstallDialog uninstall = new UninstallDialog();

    final JDialog dialog = new JDialog(frame);

    final List<ServiceInfo> selected = servicesTable.getSelection();
    uninstall._SERVICES.setText("");
    for (ServiceInfo info : selected) {
      uninstall._SERVICES.setText(
          uninstall._SERVICES.getText() + info.getHost() + "/" + info.getDisplayName() + " ");
    }

    uninstall._OK_BUTTON.setAction(
        new AbstractAction("UNINSTALL") {

          public void actionPerformed(ActionEvent e) {
            uninstall._OK_BUTTON.setEnabled(false);
            uninstall._SERVICES.setText("");
            for (ServiceInfo info : selected) {
              AsyncServiceManagerServer proxy = proxies.get(info.getHost());
              if (proxy != null) {
                boolean result = false;
                try {
                  result =
                      ((Boolean)
                              ((Future) proxy.yajswUninstall(info.getName()))
                                  .get(10, TimeUnit.SECONDS))
                          .booleanValue();
                } catch (Exception e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
                }
                if (result) uninstall._SERVICES.setText(uninstall._SERVICES.getText() + "success");
                else uninstall._SERVICES.setText(uninstall._SERVICES.getText() + "error");
              } else uninstall._SERVICES.setText(uninstall._SERVICES.getText() + "no connection");
            }
          }
        });
    uninstall._CANCEL_BUTTON.setAction(
        new AbstractAction("CLOSE") {

          public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
          }
        });

    dialog.add(uninstall);
    dialog.setLocationRelativeTo(frame);
    dialog.setSize(500, 170);
    dialog.setModalityType(ModalityType.APPLICATION_MODAL);
    dialog.setVisible(true);
  }
예제 #3
0
  protected static void doReloadConsole() {
    final ReloadConsoleDialog reloadConsole = new ReloadConsoleDialog();

    final JDialog dialog = new JDialog(frame);
    if (servicesTable.getSelection().size() == 0) return;
    final ServiceInfo selected = servicesTable.getSelection().get(0);
    reloadConsole._SERVICE.setText(selected.getName());
    reloadConsole._CONFIGURATION.setModel(new DefaultComboBoxModel(new Vector(configurations)));

    reloadConsole._OK_BUTTON.setAction(
        new AbstractAction("Reload") {

          public void actionPerformed(ActionEvent e) {
            reloadConsole._OK_BUTTON.setEnabled(false);
            AsyncServiceManagerServer proxy = proxies.get(selected.getHost());
            boolean result = false;
            try {
              result =
                  ((Boolean)
                          ((Future)
                                  proxy.yajswReloadConsole(
                                      selected.getName(),
                                      (String) reloadConsole._CONFIGURATION.getSelectedItem()))
                              .get(10, TimeUnit.SECONDS))
                      .booleanValue();
            } catch (Exception e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
            if (result) reloadConsole._MESSAGE.setText("success");
            else reloadConsole._MESSAGE.setText("error");
            if (!configurations.contains(reloadConsole._CONFIGURATION.getSelectedItem())) {
              configurations.add((String) reloadConsole._CONFIGURATION.getSelectedItem());
              saveData();
            }
          }
        });
    reloadConsole._CANCEL_BUTTON.setAction(
        new AbstractAction("CLOSE") {

          public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
          }
        });

    dialog.add(reloadConsole);
    dialog.setLocationRelativeTo(frame);
    dialog.setSize(550, 200);
    dialog.setModalityType(ModalityType.APPLICATION_MODAL);
    dialog.setVisible(true);
  }
 /**
  * Shows a {@link ScatterPlotPane}.
  *
  * @param parent parent component. Can be null
  * @param xAxisName name of the X-Axis
  * @param yAxisName name of the Y-Axis
  * @param chartData data to plot
  */
 public static void showDialog(
     Component parent, String xAxisName, String yAxisName, List<ScatterPlotData> chartData) {
   ScatterPlotPane scatterPlotPane = new ScatterPlotPane(parent, xAxisName, yAxisName, chartData);
   JDialog scatterPlotDialog = new JDialog();
   scatterPlotDialog.setContentPane(scatterPlotPane);
   scatterPlotDialog.setModalityType(ModalityType.APPLICATION_MODAL);
   scatterPlotDialog.setTitle("Scatter Plot");
   scatterPlotDialog.setIconImages(Images.getApplicationImages());
   scatterPlotDialog.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT));
   scatterPlotDialog.setMinimumSize(new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT));
   scatterPlotDialog.pack();
   scatterPlotDialog.setLocationRelativeTo(parent);
   scatterPlotDialog.setVisible(true);
   scatterPlotDialog.dispose();
 }
예제 #5
0
  public JDialog getChildDialog() {

    JDialog dialog = new JDialog();
    dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    dialog.setBounds(100, 100, 450, 300);
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(new JTextField(), BorderLayout.CENTER);
    panel.add(new JTextField(), BorderLayout.NORTH);
    panel.add(new JTextField(), BorderLayout.SOUTH);
    panel.add(new JLabel("Blah"), BorderLayout.EAST);
    panel.add(new JLabel("Blah"), BorderLayout.WEST);
    dialog.getContentPane().setLayout(new BorderLayout());
    dialog.getContentPane().add(panel, BorderLayout.CENTER);
    return dialog;
  }
예제 #6
0
  @Override
  public void actionPerformed(ActionEvent e) {
    JDialog mydialog = new JDialog();
    mydialog.setSize(new Dimension(400, 500));
    mydialog.setTitle("JCR Workbench - Help");
    mydialog.setModalityType(Dialog.ModalityType.MODELESS);
    mydialog.setVisible(true);

    String url = HelpAction.class.getResource("quickStartHelp.html").toExternalForm();
    log.trace("loading help from: " + url);
    try {
      JEditorPane editorPane = new JEditorPane(url);
      JScrollPane scrolledContent = new JScrollPane(editorPane);
      mydialog.setContentPane(scrolledContent);
    } catch (IOException e1) {
      e1.printStackTrace();
    }
  }
예제 #7
0
  /**
   * Shows a modal dialog to select some files
   *
   * @param file_list default files in the selected file list
   * @return the file list returns <code>null</code> if the dialog was closed with cancel, or ESC or
   *     X
   */
  public static String[] showFileChooserDialog(final FileFilter filter, final String[] file_list) {

    final JDialog dlg = new JDialog();
    dlg.setAlwaysOnTop(true);
    dlg.setModalityType(ModalityType.APPLICATION_MODAL);
    final int[] cancelFlag = new int[] {0};

    final FileChooserPanel panel = new FileChooserPanel(filter);
    if (file_list != null) {
      panel.update(file_list);
    }

    final JButton ok = new JButton("OK");
    ok.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            cancelFlag[0] = -1;
            dlg.dispose();
          }
        });
    final JButton cancel = new JButton("Cancel");
    cancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            dlg.dispose();
          }
        });
    final JPanel buttons = new JPanel();
    buttons.add(ok);
    buttons.add(cancel);
    dlg.getContentPane().setLayout(new BorderLayout());
    dlg.getContentPane().add(panel, BorderLayout.CENTER);
    dlg.getContentPane().add(buttons, BorderLayout.SOUTH);

    dlg.pack();
    dlg.setVisible(true);

    if (cancelFlag[0] == -1) {
      return panel.getSelectedFiles();
    }
    return null;
  }
예제 #8
0
  @Override
  public void start(Question t, JButton sourceButton) {
    JDialog dialog = new JDialog(windowParent, "Question Editor");

    QuestionEditorPanel questionEditorPanel = new QuestionEditorPanel(t, dialog, sourceButton);
    dialog.add(questionEditorPanel);

    dialog.setModalityType(ModalityType.APPLICATION_MODAL);
    dialog.pack();

    // Centers inside the application frame
    int x = windowParent.getX() + (windowParent.getWidth() - dialog.getWidth()) / 2;
    int y = windowParent.getY() + (windowParent.getHeight() - dialog.getHeight()) / 2;
    dialog.setLocation(x, y);

    // Shows the modal dialog and waits
    dialog.setVisible(true);
    dialog.toFront();
  }
예제 #9
0
  protected static void doNewHost() {
    final NewHostDialog newDialog = new NewHostDialog();

    final JDialog dialog = new JDialog(frame);
    final Vector<String> listData = new Vector<String>();
    newDialog._OK_BUTTON.setAction(
        new AbstractAction("ADD") {

          public void actionPerformed(ActionEvent e) {
            String name = newDialog._HOST.getText();
            String stPort = newDialog._PORT.getText();
            if (name == null || name.length() == 0 || stPort == null || stPort.length() == 0)
              return;
            try {
              int port = Integer.parseInt(stPort);
              synchronized (hosts) {
                hosts.updateObject(new Host(name, port));
                saveData();
              }
            } catch (Exception ex) {
              ex.printStackTrace();
            }
          }
        });
    newDialog._CANCEL_BUTTON.setAction(
        new AbstractAction("CLOSE") {

          public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
          }
        });
    dialog.add(newDialog);
    dialog.setLocationRelativeTo(frame);
    dialog.setSize(350, 180);
    dialog.setModalityType(ModalityType.APPLICATION_MODAL);
    dialog.setVisible(true);
  }
예제 #10
0
 private void createDialog() {
   dialog.setLayout(new MigLayout());
   dialog.setModalityType(ModalityType.APPLICATION_MODAL);
   dialog.setResizable(false);
 }
예제 #11
0
  @SuppressWarnings("rawtypes")
  public static void runReport(
      List<List> customerData,
      List<List> projectData,
      JCheckBox markErrorsCheckBox,
      JTextField frameAgreement,
      JTextField category,
      File output,
      JFrame frame) {

    final JDialog dialog = new JDialog();
    final ExcelDocumentCreator creator;
    JPanel contentPane;

    dialog.setTitle("Creating report");
    dialog.setBounds(100, 100, 560, 189);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    dialog.setContentPane(contentPane);
    SpringLayout sl_contentPane = new SpringLayout();
    contentPane.setLayout(sl_contentPane);

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black));
    sl_contentPane.putConstraint(SpringLayout.NORTH, panel, -5, SpringLayout.NORTH, contentPane);
    panel.setBackground(Color.white);
    sl_contentPane.putConstraint(SpringLayout.WEST, panel, -5, SpringLayout.WEST, contentPane);
    sl_contentPane.putConstraint(SpringLayout.EAST, panel, 5, SpringLayout.EAST, contentPane);
    sl_contentPane.putConstraint(SpringLayout.SOUTH, panel, -50, SpringLayout.SOUTH, contentPane);
    contentPane.add(panel);

    JPanel panel_1 = new JPanel();
    sl_contentPane.putConstraint(SpringLayout.WEST, panel_1, -5, SpringLayout.WEST, contentPane);
    sl_contentPane.putConstraint(SpringLayout.SOUTH, panel_1, 5, SpringLayout.SOUTH, contentPane);
    sl_contentPane.putConstraint(SpringLayout.NORTH, panel_1, 90, SpringLayout.NORTH, contentPane);
    sl_contentPane.putConstraint(SpringLayout.EAST, panel_1, 5, SpringLayout.EAST, contentPane);
    SpringLayout sl_panel = new SpringLayout();
    panel.setLayout(sl_panel);

    final JProgressBar progressBar = new JProgressBar();
    sl_panel.putConstraint(SpringLayout.NORTH, progressBar, -50, SpringLayout.SOUTH, panel);
    sl_panel.putConstraint(SpringLayout.WEST, progressBar, 20, SpringLayout.WEST, panel);
    panel.add(progressBar);

    JTextField stateField = new JTextField("Querying Database");
    sl_panel.putConstraint(SpringLayout.EAST, progressBar, 247, SpringLayout.EAST, stateField);
    sl_panel.putConstraint(SpringLayout.NORTH, stateField, 10, SpringLayout.NORTH, panel);
    sl_panel.putConstraint(SpringLayout.WEST, stateField, 10, SpringLayout.WEST, panel);
    stateField.setBorder(BorderFactory.createEmptyBorder());
    panel.add(stateField);
    stateField.setColumns(10);

    JTextField progressField = new JTextField();
    sl_panel.putConstraint(SpringLayout.SOUTH, progressBar, -6, SpringLayout.NORTH, progressField);
    sl_panel.putConstraint(SpringLayout.WEST, progressField, 10, SpringLayout.WEST, panel);
    sl_panel.putConstraint(SpringLayout.EAST, progressField, -257, SpringLayout.EAST, panel);
    sl_panel.putConstraint(SpringLayout.EAST, stateField, 0, SpringLayout.EAST, progressField);
    progressField.setBorder(BorderFactory.createEmptyBorder());
    sl_panel.putConstraint(SpringLayout.SOUTH, progressField, -10, SpringLayout.SOUTH, panel);
    panel.add(progressField);
    progressField.setColumns(10);
    contentPane.add(panel_1);
    SpringLayout sl_panel_1 = new SpringLayout();
    panel_1.setLayout(sl_panel_1);

    JButton btnCancel =
        new JButton("Cancel") {
          private static final long serialVersionUID = 1L;

          public void addNotify() {
            super.addNotify();
            requestFocus();
          }
        };

    sl_panel_1.putConstraint(SpringLayout.SOUTH, btnCancel, -10, SpringLayout.SOUTH, panel_1);
    sl_panel_1.putConstraint(SpringLayout.EAST, btnCancel, -10, SpringLayout.EAST, panel_1);
    panel_1.add(btnCancel);

    progressBar.setIndeterminate(true);

    creator =
        new ExcelDocumentCreator(
            customerData,
            projectData,
            frameAgreement,
            markErrorsCheckBox,
            category,
            stateField,
            progressField,
            output);
    creator.addPropertyChangeListener(
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (creator.isDone()) dialog.dispose();

            if ("progress".equals(evt.getPropertyName())) {
              progressBar.setValue((Integer) evt.getNewValue());
              progressBar.setIndeterminate(false);
            }
          }
        });
    creator.execute();

    btnCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            creator.cancel(true);
          }
        });

    dialog.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent evt) {
            creator.cancel(true);
            dialog.dispose();
          }
        });

    dialog.setModalityType(ModalityType.APPLICATION_MODAL);
    dialog.setLocationRelativeTo(frame);
    dialog.setResizable(false);
    dialog.setVisible(true);
  }
  protected void handleExecute() {
    ImageView view = getSelectedView();

    if (view != null) {
      ColorBarAnnotation cbar =
          (ColorBarAnnotation) view.getAnnotation(view.getSelectedPlot(), ColorBarAnnotation.ID);

      if (cbar == null) {
        cbar = new ColorBarAnnotation(view.getModel());
        view.setAnnotation(view.getSelectedPlot(), cbar.getIdentifier(), cbar);
      }

      log.finest("retrieved color bar annotation for editing");

      ColorBarAnnotationPresenter presenter = new ColorBarAnnotationPresenter(cbar);
      Container c = JOptionPane.getFrameForComponent(view);

      final JButton okButton = new JButton("OK");
      okButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              dialog.setVisible(false);
              dialog.dispose();
            }
          });

      final JButton cancelButton = new JButton("Cancel");
      cancelButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              // view.setAnnotation(safeCopy);
              // icross.setLinePaint(safeCopy.getLinePaint());
              // icross.setLineWidth(safeCopy.getLineWidth());
              // icross.setGap(safeCopy.getGap());
              // icross.setVisible(safeCopy.isVisible());

              dialog.setVisible(false);
              dialog.dispose();
            }
          });

      final JButton applyButton = new JButton("Apply");

      dialog = new JDialog(JOptionPane.getFrameForComponent(view));
      dialog.setLayout(new BorderLayout());

      Point p = c.getLocation();

      JPanel mainPanel = new JPanel();
      mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 8, 15, 8));
      mainPanel.setLayout(new BorderLayout());
      JPanel buttonPanel =
          ButtonBarFactory.buildRightAlignedBar(okButton, cancelButton, applyButton);

      mainPanel.add(presenter.getComponent(), BorderLayout.CENTER);
      mainPanel.add(buttonPanel, BorderLayout.SOUTH);

      dialog.add(mainPanel, BorderLayout.CENTER);
      dialog.pack();
      dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
      dialog.setLocation(
          (int) (p.getX() + c.getWidth() / 2f), (int) (p.getY() + c.getHeight() / 2f));
      dialog.setVisible(true);
    }
  }
예제 #13
0
 public void run() {
   while (connected) {
     try {
       Object obj = in.readObject();
       if (obj.toString().equals("-101")) {
         connected = false;
         in.close();
         out.close();
         socket.close();
         SwingUtilities.invokeLater(
             new Runnable() {
               public void run() {
                 Cashier.closee = true;
                 JOptionPane.showMessageDialog(
                     null,
                     "Disconnected from server. Please Restart",
                     "Error:",
                     JOptionPane.PLAIN_MESSAGE);
                 try {
                   m.stop();
                 } catch (Exception w) {
                 }
               }
             });
       } else if (obj.toString().split("::")[0].equals("broadcast")) {
         // System.out.println("braodcast received");
         bc.run(obj.toString().substring(obj.toString().indexOf("::") + 2));
       } else if (obj.toString().split("::")[0].equals("chat")) {
         // System.out.println("chat received:
         // "+obj.toString().substring(obj.toString().indexOf("::")+2));
         cc.run(obj.toString().substring(obj.toString().indexOf("::") + 2));
       } else if (obj.toString().split("::")[0].equals("rankings")) {
         String hhh = obj.toString().split("::")[1];
         final JDialog jd = new JDialog();
         jd.setUndecorated(false);
         JPanel pan = new JPanel(new BorderLayout());
         JLabel ppp = new JLabel();
         ppp.setFont(new Font("Arial", Font.BOLD, 20));
         ppp.setText(
             "<html><pre>Thanks for playing !!!<br/>1st: "
                 + hhh.split(":")[0]
                 + "<br/>2nd: "
                 + hhh.split(":")[1]
                 + "<br/>3rd: "
                 + hhh.split(":")[2]
                 + "</pre></html>");
         pan.add(ppp, BorderLayout.CENTER);
         JButton ok = new JButton("Ok");
         ok.addActionListener(
             new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                 jd.setVisible(false);
                 try {
                   m.stop();
                 } catch (Exception w) {
                 }
               }
             });
         pan.add(ok, BorderLayout.SOUTH);
         jd.setContentPane(pan);
         jd.setModalityType(JDialog.ModalityType.APPLICATION_MODAL);
         jd.pack();
         jd.setLocationRelativeTo(null);
         jd.setVisible(true);
       } else if (obj.toString().split("::")[0].equals("rank")) {
         rc.run(obj.toString().substring(obj.toString().indexOf("::") + 2));
       } else {
         User hhh = null;
         try {
           hhh = (User) obj;
           /*if(usrD==1)
           {
               reply=obj;
               ccl.interrupt();
           }
           else*/
           {
             try {
               m.ur.changeData((User) obj);
             } catch (Exception w) {
               try {
                 maain.ur.changeData((User) obj);
               } catch (Exception ppp) {
                 ppp.printStackTrace();
               }
             }
           }
         } catch (Exception p) {
           int iid = -1;
           try {
             iid = Integer.parseInt(obj.toString());
             obj = in.readObject();
             if (obj.toString().equals("-102")) {
               // ccl.interrupt();
               SwingUtilities.invokeLater(
                   new Runnable() {
                     public void run() {
                       Cashier.closee = true;
                       JOptionPane.showMessageDialog(
                           null, "Server Not Running.", "Error:", JOptionPane.PLAIN_MESSAGE);
                     }
                   });
             }
             // Thread th = ((Thread)rev.remove(iid));
             rev2.put(iid, obj);
             // System.out.println("Put: "+iid+"   :   "+obj.toString()+"   :
             // "+Thread.currentThread());
             // th.interrupt();
             // ccl.interrupt();
           } catch (Exception ppp) {
               /*ppp.printStackTrace();*/
             System.out.println(
                 "Shit: "
                     + iid
                     + "   :   "
                     + obj.toString()
                     + "   :   "
                     + Thread.currentThread());
           }
         }
       }
       try {
         Thread.sleep(500);
       } catch (Exception n) {
       }
     } catch (Exception m) {
     }
   }
 }
예제 #14
0
  protected static void doInstall() {
    final InstallDialog install = new InstallDialog();

    final JDialog dialog = new JDialog(frame);
    final Vector<String> listData = new Vector<String>();
    for (Host host : hosts.getObjectList()) {
      listData.add(host.getName());
    }
    install._HOSTS_LIST.setListData(listData);
    for (int i = 0; i < listData.size(); i++) install._HOSTS_LIST.setSelectedIndex(i);
    List<ServiceInfo> selected = servicesTable.getSelection();
    if (selected.size() > 0) {
      ServiceInfo selection = selected.get(0);
    }
    install._CONFIGURATION.setModel(new DefaultComboBoxModel(new Vector(configurations)));
    install._OK_BUTTON.setAction(
        new AbstractAction("INSTALL") {

          public void actionPerformed(ActionEvent e) {
            int[] selInd = install._HOSTS_LIST.getSelectedIndices();
            install._OK_BUTTON.setEnabled(false);
            install._MESSAGE.setText("installing");
            for (int i : selInd) {
              install._MESSAGE.setText(install._MESSAGE.getText() + " - " + listData.get(i) + ": ");
              AsyncServiceManagerServer proxy = proxies.get(listData.get(i));
              if (proxy != null) {
                boolean result = false;
                try {
                  result =
                      ((Boolean)
                              ((Future)
                                      proxy.yajswInstall(
                                          (String) install._CONFIGURATION.getSelectedItem()))
                                  .get(10, TimeUnit.SECONDS))
                          .booleanValue();
                } catch (Exception e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
                }
                if (result) install._MESSAGE.setText(install._MESSAGE.getText() + "success");
                else install._MESSAGE.setText(install._MESSAGE.getText() + "error");
              } else install._MESSAGE.setText(install._MESSAGE.getText() + "no connection");
              if (!configurations.contains(install._CONFIGURATION.getSelectedItem())) {
                configurations.add((String) install._CONFIGURATION.getSelectedItem());
              }
            }
            saveData();
          }
        });
    install._CANCEL_BUTTON.setAction(
        new AbstractAction("CLOSE") {

          public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
          }
        });
    dialog.add(install);
    dialog.setLocationRelativeTo(frame);
    dialog.setSize(570, 320);
    dialog.setModalityType(ModalityType.APPLICATION_MODAL);
    dialog.setVisible(true);
  }