@Override
  public void actionPerformed(ActionEvent e) {

    OWLReasoner reasoner = owlManager.getOWLReasonerManager().getCurrentReasoner();

    if (reasoner instanceof QuestOWL) {
      try {
        check = ((QuestOWL) reasoner).getEmptyEntitiesChecker();

        JDialog dialog = new JDialog();
        dialog.setModal(true);
        dialog.setSize(520, 400);
        dialog.setLocationRelativeTo(null);
        dialog.setTitle("Empties Check");

        EmptiesCheckPanel emptiesPanel = new EmptiesCheckPanel(check);
        JPanel pnlCommandButton = createButtonPanel(dialog);
        dialog.setLayout(new BorderLayout());
        dialog.add(emptiesPanel, BorderLayout.CENTER);
        dialog.add(pnlCommandButton, BorderLayout.SOUTH);
        DialogUtils.installEscapeCloseOperation(dialog);

        dialog.pack();
        dialog.setVisible(true);

      } catch (Exception ex) {
        JOptionPane.showMessageDialog(null, "An error occured. For more info, see the logs.");
      }
    } else {
      JOptionPane.showMessageDialog(null, "You have to start ontop reasoner for this feature.");
    }
  }
Example #2
0
  public JDialog showProgressDialog(
      JDialog parent, String title, String message, boolean includeCancelButton) {
    fileSearchCancelled = false;
    final JDialog prog;
    JProgressBar bar = new JProgressBar(SwingConstants.HORIZONTAL);
    JButton cancel = new JButton(Globals.lang("Cancel"));
    cancel.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent event) {
            fileSearchCancelled = true;
            ((JButton) event.getSource()).setEnabled(false);
          }
        });
    prog = new JDialog(parent, title, false);
    bar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    bar.setIndeterminate(true);
    if (includeCancelButton) {
      prog.add(cancel, BorderLayout.SOUTH);
    }
    prog.add(new JLabel(message), BorderLayout.NORTH);
    prog.add(bar, BorderLayout.CENTER);
    prog.pack();
    prog.setLocationRelativeTo(null); // parent);
    // SwingUtilities.invokeLater(new Runnable() {
    //    public void run() {
    prog.setVisible(true);
    //    }
    // });
    return prog;
  }
  /** Creates a new QuestionImportUI */
  public QuestionImportUI() {
    _dialog = new JDialog();
    _dialog.setIconImage(Loader.getImageIcon(Loader.IMAGE_STURESY).getImage());

    _dialog.setLayout(new BorderLayout());

    _loadButton = new JButton(Localize.getString("button.load"));
    _cancelButton = new JButton(Localize.getString("button.cancel"));

    _list = new JList(new DefaultListModel());
    _list.setCellRenderer(new QuestionListCellRenderer(35));
    JScrollPane pane = new JScrollPane(_list);

    JLabel label = new JLabel(Localize.getString("label.select.questions"));

    _dialog.add(label, BorderLayout.NORTH);
    _dialog.add(pane, BorderLayout.CENTER);

    JPanel southpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    southpanel.add(_loadButton);
    southpanel.add(_cancelButton);

    _dialog.add(southpanel, BorderLayout.SOUTH);
    _dialog.setSize(300, 350);
  }
 /* (non-Javadoc)
  * @see org.jajuk.ui.actions.JajukAction#perform(java.awt.event.ActionEvent)
  */
 @Override
 public void perform(ActionEvent evt) {
   final JEditorPane text = new JEditorPane("text/html", getTraces());
   text.setEditable(false);
   text.setMargin(new Insets(10, 10, 10, 10));
   text.setOpaque(true);
   text.setBackground(Color.WHITE);
   text.setForeground(Color.DARK_GRAY);
   text.setFont(FontManager.getInstance().getFont(JajukFont.BOLD));
   final JDialog dialog =
       new JDialog(JajukMainWindow.getInstance(), Messages.getString("DebugLogAction.0"), false);
   JButton jbCopy =
       new JButton(
           Messages.getString("DebugLogAction.2"),
           IconLoader.getIcon(JajukIcons.COPY_TO_CLIPBOARD));
   jbCopy.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           StringSelection data = new StringSelection(text.getText());
           Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
           clipboard.setContents(data, data);
         }
       });
   JButton jbRefresh =
       new JButton(Messages.getString("DebugLogAction.1"), IconLoader.getIcon(JajukIcons.REFRESH));
   jbRefresh.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           // Refresh traces
           text.setText(getTraces());
         }
       });
   JButton jbClose =
       new JButton(Messages.getString("Close"), IconLoader.getIcon(JajukIcons.CLOSE));
   jbClose.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           dialog.dispose();
         }
       });
   dialog.setLayout(new MigLayout("insets 10", "[grow]"));
   JScrollPane panel = new JScrollPane(text);
   UtilGUI.setEscapeKeyboardAction(dialog, panel);
   dialog.add(panel, "grow,wrap");
   dialog.add(jbCopy, "split 3,right,sg button");
   dialog.add(jbRefresh, "split 3,right,sg button");
   dialog.add(jbClose, "right,sg button");
   dialog.setPreferredSize(new Dimension(800, 600));
   dialog.pack();
   dialog.setLocationRelativeTo(JajukMainWindow.getInstance());
   dialog.setVisible(true);
 }
Example #5
0
  public DatePicker(JFrame parent) {
    d = new JDialog();
    d.setModal(true);
    String[] header = {"Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"};
    JPanel p1 = new JPanel(new GridLayout(7, 7));
    p1.setPreferredSize(new Dimension(430, 120));

    for (int x = 0; x < button.length; x++) {
      final int selection = x;
      button[x] = new JButton();
      button[x].setFocusPainted(false);
      button[x].setBackground(Color.white);
      if (x > 6)
        button[x].addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
                day = button[selection].getActionCommand();
                d.dispose();
              }
            });
      if (x < 7) {
        button[x].setText(header[x]);
        button[x].setForeground(Color.red);
      }
      p1.add(button[x]);
    }
    JPanel p2 = new JPanel(new GridLayout(1, 3));
    JButton previous = new JButton("<< Previous");
    previous.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            month--;
            displayDate();
          }
        });
    p2.add(previous);
    p2.add(l);
    JButton next = new JButton("Next >>");
    next.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            month++;
            displayDate();
          }
        });
    p2.add(next);
    d.add(p1, BorderLayout.CENTER);
    d.add(p2, BorderLayout.SOUTH);
    d.pack();
    d.setLocationRelativeTo(parent);
    displayDate();
    d.setVisible(true);
  }
  private void getDialog() {
    GridBagConstraints csTexto = new GridBagConstraints();
    GridBagConstraints csBoton = new GridBagConstraints();

    csTexto.weighty = 1;
    csTexto.gridx = 0;
    csTexto.gridy = 0;

    csBoton.weighty = 1;
    csBoton.gridx = 0;
    csBoton.gridy = 5;

    JLabel correcto = new JLabel("Casillas correctas");
    correcto.setForeground(new Color(0x0095FF));
    JLabel error = new JLabel("Casillas erróneas");
    error.setForeground(Color.red);
    JLabel seleccion = new JLabel("Casilla seleccionada");
    seleccion.setForeground(Color.green);
    JLabel amarillo = new JLabel("Casillas con número seleccionado");
    amarillo.setForeground(Color.yellow);
    JButton boton = new JButton("Cerrar");

    boton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            dialogGuide.dispose();
          }
        });

    dialogGuide = new JDialog();
    dialogGuide.setSize(300, 200);
    dialogGuide.setModal(false);
    dialogGuide.setVisible(true);
    dialogGuide.setLocationRelativeTo(this);
    dialogGuide.setTitle("GUIDE");

    dialogGuide.setLayout(new GridBagLayout());
    dialogGuide.getContentPane().setBackground(new Color(0x585858));

    dialogGuide.add(seleccion, csTexto);
    csTexto.gridy = 1;
    dialogGuide.add(amarillo, csTexto);
    csTexto.gridy = 2;
    dialogGuide.add(correcto, csTexto);
    csTexto.gridy = 3;
    dialogGuide.add(error, csTexto);
    csTexto.gridy = 4;
    dialogGuide.add(boton, csBoton);
  }
Example #7
0
  private static void nastaveni() {
    OKbt.addActionListener(new ConfirmModifyForm());
    dialog.add(lbName);
    dialog.add(tfName);
    dialog.add(lbAutor);
    dialog.add(tfAutor);
    dialog.add(lbDate);
    dialog.add(tfDate);
    dialog.add(new JSeparator());
    dialog.add(OKbt);

    dialog.setLayout(new FlowLayout());
    dialog.setSize(200, 250);
    dialog.setLocation(frame.getLocation());
  }
Example #8
0
  /**
   * A very basic dialogue creator. This allows for greater customization like setting modality.
   *
   * @param owner The owner
   * @param minSize The minimum size
   * @param title The title
   * @param message The message to display
   * @param option The options - i.e. the buttons added defined by {@link JDialog} option types.
   *     Currently only {@link JOptionPane#OK_OPTION} is supported.
   * @param icon The icon to display
   * @param modalityType The modality type @see ModalityType
   */
  private void showDialouge(
      Window owner,
      Dimension minSize,
      String title,
      String message,
      int option,
      Icon icon,
      ModalityType modalityType) {
    final JDialog d = new JDialog(owner, title, modalityType);
    d.setLayout(new BorderLayout());
    d.setSize(minSize);
    d.setMinimumSize(minSize);
    // set the dialouge's location to be centred at the centre of it's owner
    d.setLocation(
        ((owner.getX() + owner.getWidth()) / 2) - d.getWidth() / 2,
        ((owner.getY() + owner.getHeight()) / 2) - d.getHeight() / 2);
    JLabel l = new JLabel(message, icon, SwingConstants.CENTER);
    // Add dialogue's text containing children for text recolouring
    l.setForeground(survivor.getCurrentColourScheme().getReadableText());
    complementaryAmenableForegroundColourableComponents.add(l);
    d.add(l, BorderLayout.CENTER);

    if (option == JOptionPane.OK_OPTION) {
      JButton ok = new JButton("OK");
      // make the button respond when ENTER is pressed
      ok.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "pressed");
      ok.getInputMap().put(KeyStroke.getKeyStroke("released ENTER"), "released");
      // Add dialogue's text containing children for text recolouring
      complementaryAmenableForegroundColourableComponents.add(ok);
      ok.setForeground(survivor.getCurrentColourScheme().getReadableText());
      ok.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
              d.dispose();
            }
          });

      d.add(ok, BorderLayout.PAGE_END);
    }

    //		d.setBackground(hangman.currentColourScheme.getC3());
    // The dialogue is included in the below sets for proper colouring
    backgroundColourableComponents.add(d);

    d.setVisible(true);
  }
 public JDialog newImportPortfolioJDialog() {
   JDialog jDialog = new JDialog(mainJFrame.mainFrame, true);
   importPortfolioJPanel = new ImportPortfolioJPanel(jDialog);
   jDialog.add(importPortfolioJPanel);
   jDialog.pack();
   return jDialog;
 }
 private JDialog newAddCriteriaJDialog() {
   JDialog jDialog = new JDialog(mainJFrame.mainFrame, true);
   addNewDecEvaCriteriaJPanel = new AddNewDecEvaCriteriaJPanel(jDialog);
   jDialog.add(addNewDecEvaCriteriaJPanel);
   jDialog.pack();
   return jDialog;
 }
Example #11
0
  // OutPutPanel의 버튼 이벤트 핸들러
  @Override
  public void actionPerformed(ActionEvent e) {
    JButton jb = (JButton) e.getSource(); // 이벤트가 발생한 객체를 받아온다.

    if (jb.getText().equals("그리기")) {

      repaint(); // 다시그린다.

    } else if (jb.getText().equals("리셋")) {
      try {

        FileWriter fw = new FileWriter("location.txt"); // 쓰기위한 메모장을 연다.
        String s = ""; // 빈 문장
        fw.write(s); // 빈 문장을 덮어 쓴다.
        fw.close(); // 닫는다.
        MainDrawPanel.count = 0;
        repaint();

      } catch (IOException ie) {
        System.out.println(ie);
      }

    } else if (jb.getText().equals("그린갯수")) {

      JDialog Msg = new JDialog(f, "Dialog", true); // 다이얼로그 객체 생성
      Msg.setSize(150, 100); // 다이얼로그 사이즈
      Msg.setLocation(800, 200); // 다이얼로그 생성 위치
      Msg.setLayout(new FlowLayout()); // 다이얼로그 레이아웃
      Msg.add(new JLabel("원을 총 " + MainDrawPanel.count + "개 그림.", JLabel.CENTER));
      Msg.setVisible(true); // 다이얼로그 화면 출력
    }
  }
Example #12
0
  @Override
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == btn6) {
      la.setText("로그인 정보가 없습니다.");
      JOptionPane.showMessageDialog(this, "로그아웃되셨습니다.");

      new LoginGUI(this);
    } else if (e.getSource() == btn4) {
      System.out.println("버튼4");

      TimeSeriesDemo demo = new TimeSeriesDemo("aa");
      // ChartPanel cp = demo.TimeSerie();
      // jp.getLeftComponent()
      // p4.add(cp);
      JDialog tsd_jd = new JDialog(this);
      // .add(demo.chartPanel);

    } else if (e.getSource() == btn5) {
      // p5.add(new BMIdemo());
    } else if (e.getSource() == btn8) {

      JDialog jd = new JDialog(this);
      pie1 = pcd.createDemoPanel();
      jd.add(pie1);

      jd.setVisible(true);
      jd.setSize(400, 400);
      jd.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }
  }
    @Override
    public void keyPressed(KeyEvent e) {
        int keyCode = e.getKeyCode();

         if(keyCode == KeyEvent.VK_ENTER){
            final JDialog dialog = new JDialog();
            dialog.setTitle("Search results");
            dialog.setModal(true);
            int height = 40;
            
            dialog.setBounds(0, 0, 300, 500);

            JPanel panel = new JPanel();                     
            ArrayList list = DataLayer.search(zoekBalk.getText());
            panel.setLayout(new GridLayout(list.size(), 1));
            
            if(list.size() == 0){
                JOptionPane.showMessageDialog(null, zoekBalk.getText() + " kon niet gevonden worden/ bestaat niet!", "Niet gevonden", JOptionPane.INFORMATION_MESSAGE);
                //panel.add(new JLabel(zoekBalk.getText() + " kon niet gevonden worden/ bestaat niet!"));
            }else{
                for(int i = 0; i < list.size(); i++){
                    panel.add(new JLabel(list.get(i).toString()));
                    height = height + 20;
                }
                dialog.setPreferredSize(new Dimension(200, height));
                dialog.add(panel);
                dialog.pack();
                dialog.setLocationRelativeTo(null);
                dialog.setVisible(true);
                dialog.validate();
            }
        }
    }
Example #14
0
  public static Map[] showOpenMapDialog(final JFrame owner) throws IOException {
    final JFileChooser ch = new JFileChooser();
    if (config.getFile("mapLastOpenDir") != null) {
      ch.setCurrentDirectory(config.getFile("mapLastOpenDir"));
    }
    ch.setDialogType(JFileChooser.OPEN_DIALOG);
    ch.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    if (ch.showOpenDialog(MainFrame.getInstance()) != JFileChooser.APPROVE_OPTION) {
      return null;
    }
    final File dir = ch.getSelectedFile();
    config.set("mapLastOpenDir", dir);
    final String[] maps = dir.list(FILTER_TILES);
    for (int i = 0; i < maps.length; ++i) {
      maps[i] = maps[i].substring(0, maps[i].length() - MapIO.EXT_TILE.length());
    }
    final JDialog dialog = new JDialog(owner, Lang.getMsg("gui.chooser"));
    dialog.setModal(true);
    dialog.setLocationRelativeTo(null);
    dialog.setLayout(new BorderLayout());

    final JList list = new JList(maps);
    final JButton btn = new JButton(Lang.getMsg("gui.chooser.Ok"));

    btn.addActionListener(
        new AbstractAction() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            if (list.getSelectedValue() != null) {
              dialog.setVisible(false);
            }
          }
        });

    dialog.add(new JScrollPane(list), BorderLayout.CENTER);
    dialog.add(btn, BorderLayout.SOUTH);
    dialog.pack();
    dialog.setVisible(true);
    dialog.dispose();

    Map[] loadedMaps = new Map[list.getSelectedIndices().length];
    for (int i = 0; i < list.getSelectedIndices().length; i++) {
      loadedMaps[i] = MapIO.loadMap(dir.getPath(), (String) list.getSelectedValues()[i]);
    }
    return loadedMaps;
  }
Example #15
0
  private void initComponents() {
    //        super.setSize(348 - 8, 100 - 10);
    super.setMinimumSize(new Dimension(300, 60));

    panelProgress = new PanelProgress();

    super.add(panelProgress);
  }
Example #16
0
 private void initPrintDialog() {
   JScrollPane sc = new JScrollPane(printTable);
   GemPanel p = new GemPanel(new BorderLayout());
   p.add(sc, BorderLayout.CENTER);
   printDlg = new JDialog();
   printDlg.add(p);
   printDlg.setSize(GemModule.XXL_SIZE);
 }
 public JDialog createFileChooserDialog(JFileChooser jfilechooser, String s, Container container) {
   JDialog jdialog = new JDialog(frame, s, true);
   jdialog.setDefaultCloseOperation(2);
   jdialog.add(jfilechooser);
   jdialog.pack();
   jdialog.setLocationRelativeTo(container);
   return jdialog;
 }
Example #18
0
  public Object showWindow(final MkWindow macWindow, String title, boolean isModal) {
    listMkWindow.add(macWindow);
    if (isModal) {
      JDialog modalFrame = new JDialog(this, title, true);
      // macWindow.setJanela(modalFrame);
      final MkRun onCloseWindow = macWindow.onCloseWindow;
      modalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
      modalFrame.addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              if (onCloseWindow != null) {
                onCloseWindow.execute();
              }
              disposeWindow(macWindow);
            }
          });
      modalFrame.setLayout(new BorderLayout());
      modalFrame.add(macWindow, BorderLayout.CENTER);
      modalFrame.pack();
      Dimension desktopSize = desktopPane.getSize();
      int x = (desktopSize.width - modalFrame.getWidth()) / 2;
      int y = (desktopSize.height - modalFrame.getHeight()) / 2;
      modalFrame.setLocation((x < 0 ? 0 : x), (y < 0 ? 0 : y));
      if (macWindow.panelButton != null) {
        modalFrame.getRootPane().setDefaultButton((JButton) macWindow.panelButton.getComponent(0));
      }
      modalFrame.setVisible(true);
      return modalFrame;
    } else {
      JInternalFrame internalFrame = new JInternalFrame(title, true, true, true, true);
      internalFrame.setContentPane(macWindow);
      internalFrame.pack();
      //            internalFrame.setBounds(internalFrame.getBounds()); //pq?
      desktopPane.add(internalFrame);

      internalFrame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
      final MkRun onCloseWindow = macWindow.onCloseWindow;
      if (onCloseWindow != null) {
        internalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);

        internalFrame.addInternalFrameListener(
            new InternalFrameAdapter() {
              public void internalFrameClosing(InternalFrameEvent e) {
                onCloseWindow.execute();
              }
            });
      }

      Dimension desktopSize = desktopPane.getSize();
      int x = (desktopSize.width - internalFrame.getWidth()) / 2;
      int y = (desktopSize.height - internalFrame.getHeight()) / 2;
      internalFrame.setLocation((x < 0 ? 0 : x), (y < 0 ? 0 : y));
      internalFrame.setVisible(true);
      return internalFrame;
    }
  }
Example #19
0
 private void showNewBindingDialog(String str) {
   JDialog bindingDiag = new JDialog();
   fileSelector = this.createJList(str, bindingFiles);
   panelCreateBind.add(new JScrollPane(fileSelector), BorderLayout.NORTH);
   panelCreateBind.add(this.bindingName, BorderLayout.SOUTH);
   bindingDiag.add(panelCreateBind);
   bindingDiag.setLocationRelativeTo(frame);
   bindingDiag.setSize(400, 400);
   bindingDiag.setVisible(true);
 }
Example #20
0
 public void showDialog() {
   dialog = new JDialog(null, JDialog.ModalityType.TOOLKIT_MODAL);
   dialog.setDefaultCloseOperation(this.defaultCloseOperation);
   dialog.setResizable(true);
   dialog.setModal(true);
   dialog.add(this);
   dialog.pack();
   dialog.setTitle(title);
   dialog.setVisible(true);
 }
 public void showAboutDialog() {
   final JDialog splashDialog = new JDialog(getProjectExplorer());
   splashDialog.setModal(true);
   splashDialog.setResizable(false);
   SplashPage page = new SplashPage();
   splashDialog.add(page);
   splashDialog.pack();
   UIUtil.centerOnFrame(splashDialog, getProjectExplorer());
   splashDialog.setVisible(true);
 }
  private void initializeDlg() {
    if (pst.isEmbeddedView()) {
      return;
    }
    JDialog dlg = (JDialog) parentContainer;

    dlg.add(viewLayout.mainPanel, BorderLayout.CENTER);

    //        SwingUtils.locateOnScreenCenter(dlg);
    SwingUtils.locateRelativeToMenu(dlg);
    dlg.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    dlg.addWindowListener(
        new java.awt.event.WindowAdapter() {
          // todo ver cómo se va a hacer esto en la versión Filthy
          public void windowOpened(WindowEvent e) {
            if (pst != null) {
              pst.onWindowsOpened(e);
              pst.onWindowsOpenedInternalOnlyForAWFW(e);
              if (!pst.isReadOnly()) {
                //                        pst.setFocusToCmpOnWindowOpen();
                //
                // ActionManager.instance().getVisualMgrForActions().repaintMainDisabledActions(pst.getActionRsr());
              } else {
                pst.configureAsReanOnly();
                JButton btnCancel = (JButton) pst.getIpView().getComponent("btnCancel");
                if (btnCancel != null) {
                  btnCancel.requestFocusInWindow();
                }
              }
            }
          }

          public void windowClosing(WindowEvent e) {
            MsgDisplayer.showMessage("sw.common.closeWindowDisabled");
          }

          public void windowActivated(WindowEvent e) {
            Object oppositeWindow = e.getOppositeWindow();

            if (oppositeWindow instanceof DlgMensaje) {
              logger.debug("Ignoring Windows activated for DlgMensaje");
              return;
            }
            if (oppositeWindow instanceof JDialog) {
              JDialog dlg = (JDialog) oppositeWindow;
              if (MessageDisplayer.GENERIC_MESSAGE_TITLE.equals(dlg.getTitle())) {
                logger.debug("Ignoring Windows activated for System Msg");
                return;
              }
            }
            logger.debug("Windows Activated:" + pst);
            AWWindowsManager.instance().setPresenterActivated(pst);
          }
        });
  }
Example #23
0
  /**
   * This method creates a exception dialog and sets it visible.
   *
   * @param message to display
   * @param reason to display
   */
  private void showExcpetionDialog(String message, String reason) {

    Rectangle guiBounds = this.getBounds();
    int width = getProperty("DialogWidth");
    int height = getProperty("DialogHeight");
    int xPos = guiBounds.x + (guiBounds.width - width) / 2;
    int yPos = guiBounds.y + (guiBounds.height - height) / 2;

    final JDialog dialog = new JDialog(this, true);
    dialog.setBounds(xPos, yPos, width, height);
    dialog.setLayout(new BorderLayout(10, 10));
    dialog.setTitle(guiText.getString("ExceptionDialogTitle"));

    // message label
    JLabel messageLabel = new JLabel(message);
    JPanel messageLabelPanel = new JPanel();
    messageLabelPanel.add(messageLabel);

    // reason panel
    JTextArea reasonTextArea = new JTextArea(reason);
    JScrollPane reasonScrollPane = new JScrollPane(reasonTextArea);
    reasonScrollPane.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(guiText.getString("DetailsPanelTitle")),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    reasonTextArea.setEditable(false);

    // ok button
    JButton okButton = new JButton(guiText.getString("OkButtonLabel"));
    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
          }
        });

    // put all together
    dialog.add(messageLabelPanel, BorderLayout.NORTH);
    dialog.add(reasonScrollPane, BorderLayout.CENTER);
    dialog.add(okButton, BorderLayout.SOUTH);
    dialog.setVisible(true);
  }
Example #24
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);
  }
  /**
   * Prompt for a password, and wait until the user enters it.
   *
   * @param prompt The prompt string
   * @return The new password.
   */
  @SuppressWarnings("serial")
  private String getPassword(String prompt) {
    final JDialog input = new JDialog(mainWindow, "Prompt", true);
    input.setLayout(new FlowLayout());
    input.add(new JLabel(prompt));
    JPasswordField textField = new JPasswordField(10);
    input.add(textField);
    Action okAction =
        new AbstractAction("OK") {
          public void actionPerformed(ActionEvent e) {
            input.dispose();
          }
        };
    textField.addActionListener(okAction);
    JButton ok = new JButton(okAction);
    input.add(ok);
    input.pack();
    input.setLocationRelativeTo(mainWindow);
    input.setVisible(true); // BLOCKING

    return new String(textField.getPassword());
  }
  private void showDialogNotification(JDialog parent, String type, String string) {
    final JDialog dialog = new JDialog(parent, type);
    JLabel pic = new JLabel();
    if (type.equals("Warning")) {
      pic.setIcon(new ImageIcon(getClass().getResource(BoardDialog.pictureWarning)));
    } else {
      pic.setIcon(new ImageIcon(getClass().getResource(BoardDialog.pictureError)));
    }
    GridBagLayout dialogLayout = new GridBagLayout();
    dialog.setLayout(dialogLayout);
    GridBagConstraints c = new GridBagConstraints();
    JLabel message = new JLabel(string);
    JButton close = new JButton("close");
    ActionListener actionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // panel.setAlwaysOnTop(true);
            dialog.dispose();
          }
        };
    close.addActionListener(actionListener);

    c.gridx = 0;
    c.gridy = 0;
    c.ipadx = 20;
    dialog.add(pic, c);

    c.gridx = 1;
    c.gridy = 0;
    dialog.add(message, c);

    c.gridx = 1;
    c.gridy = 1;
    dialog.add(close, c);
    dialog.pack();
    dialog.setLocationRelativeTo(parent);
    dialog.setAlwaysOnTop(true);
    dialog.setVisible(true);
  }
Example #27
0
 private void dialog(String title, String cad) {
   JScrollPane scr = new JScrollPane();
   scr.setSize(300, 500);
   JDialog dialogo = new JDialog();
   dialogo.setTitle(title);
   JTextArea area = new JTextArea();
   dialogo.setSize(300, 500);
   area.setSize(300, 500);
   scr.setViewportView(area);
   dialogo.add(scr);
   area.setText(cad);
   dialogo.setVisible(true);
 }
Example #28
0
  private void initGUI(String title, String version) {
    JLabel xenaLogoLabel = new JLabel(IconFactory.getIconByName("images/xena-icon.png"));
    xenaLogoLabel.setOpaque(false);
    JLabel headerLabel = new JLabel(IconFactory.getIconByName("images/naaheader-blue.png"));
    JLabel footerLabel = new JLabel(IconFactory.getIconByName("images/naafooter-blue.png"));

    logTextArea = new JTextArea(8, 10);
    logTextArea.setEditable(false);
    logTextArea.setBorder(new EmptyBorder(0, 0, 0, 0));
    logTextArea.setBackground(new Color(255, 255, 255));
    logTextArea.setWrapStyleWord(true);
    logTextArea.setLineWrap(true);
    JScrollPane logSP =
        new JScrollPane(
            logTextArea,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    logSP.setBorder(new EmptyBorder(0, 0, 0, 0));

    JLabel versionLabel = new JLabel(title + " " + version);
    versionLabel.setBackground(logTextArea.getBackground());
    versionLabel.setForeground(logTextArea.getForeground());
    versionLabel.setFont(versionLabel.getFont().deriveFont(Font.BOLD));
    versionLabel.setOpaque(true);

    JPanel textPanel = new JPanel(new BorderLayout());
    textPanel.add(versionLabel, BorderLayout.NORTH);
    textPanel.add(logSP, BorderLayout.CENTER);
    textPanel.setBorder(new LineBorder(logTextArea.getBackground(), 6));

    JPanel infoPanel = new JPanel(new BorderLayout());
    infoPanel.setOpaque(false);
    infoPanel.add(xenaLogoLabel, BorderLayout.WEST);
    infoPanel.add(textPanel, BorderLayout.CENTER);

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setBorder(new LineBorder(Color.BLACK));
    mainPanel.setBackground(logTextArea.getBackground());
    mainPanel.add(headerLabel, BorderLayout.NORTH);
    mainPanel.add(infoPanel, BorderLayout.CENTER);
    mainPanel.add(footerLabel, BorderLayout.SOUTH);

    splashDialog = new JDialog((Frame) null, "", false);
    splashDialog.setUndecorated(true);
    splashDialog.add(mainPanel, BorderLayout.CENTER);
    splashDialog.pack();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension splashSize = splashDialog.getSize();
    splashDialog.setLocation(
        (screenSize.width - splashSize.width) / 2, (screenSize.height - splashSize.height) / 2);
  }
Example #29
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);
  }
  private void init() {
    window = new JDialog();

    JLabel hostLabel = new JLabel("host:");
    hostLabel.setHorizontalAlignment(JLabel.RIGHT);
    JLabel portLabel = new JLabel("port:");
    portLabel.setHorizontalAlignment(JLabel.RIGHT);
    JLabel passwordLabel = new JLabel("password:"******"user:"******"6600");
    passwordField = new JPasswordField();
    userField = new JTextField();

    okButton = new JButton("OK");

    window.setLayout(new GridLayout(5, 2));
    window.add(hostLabel);
    window.add(hostField);
    window.add(portLabel);
    window.add(portField);
    window.add(passwordLabel);
    window.add(passwordField);
    window.add(userLabel);
    window.add(userField);
    window.add(okButton);

    window.setAlwaysOnTop(true);
    window.pack();

    Rectangle bounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    window.setLocation(
        (bounds.width / 2) - (window.getWidth() / 2),
        (bounds.height / 2) - (window.getHeight() / 2));
  }