@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 int showDialog() {
    panel = new JPanel(new GridBagLayout());

    double lower = Double.NEGATIVE_INFINITY;
    double upper = Double.POSITIVE_INFINITY;

    if (parameter.isZeroOne) {
      lower = 0.0;
      upper = 1.0;
    } else if (parameter.isNonNegative) {
      lower = 0.0;
    }

    panel = new JPanel(new GridBagLayout());

    setupComponents();

    JOptionPane optionPane =
        new JOptionPane(
            panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
    optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));

    final JDialog dialog = optionPane.createDialog(frame, "Linked Parameter Setup");

    priorSettingsPanel.setDialog(dialog);
    priorSettingsPanel.setParameter(parameter);

    if (OSType.isMac()) {
      dialog.setMinimumSize(new Dimension(dialog.getBounds().width, 300));
    } else {
      Toolkit tk = Toolkit.getDefaultToolkit();
      Dimension d = tk.getScreenSize();
      if (d.height < 700 && panel.getHeight() > 450) {
        dialog.setSize(new Dimension(panel.getWidth() + 100, 550));
      } else {
        // setSize because optionsPanel is shrunk in dialog
        dialog.setSize(new Dimension(panel.getWidth() + 100, panel.getHeight() + 100));
      }

      //            System.out.println("panel width = " + panel.getWidth());
      //            System.out.println("panel height = " + panel.getHeight());
    }

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

    int result = JOptionPane.CANCEL_OPTION;
    Integer value = (Integer) optionPane.getValue();
    if (value != null && value != -1) {
      result = value;
    }

    return result;
  }
Example #3
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); // 다이얼로그 화면 출력
    }
  }
  private JDialog assembleDialog() {
    String title = getTitle();
    JDialog dlg = createDialog(title);

    boolean showAudit = showAuditFields();

    int headerHeight = 0;
    //        int headerHeight = (int) viewLayout.headerPanel.getPreferredSize().getHeight();
    int auditInfoHeight = 0; // (int) viewLayout.auditInfo.getPreferredSize().getHeight();
    int toolbarHeight = 0;
    int errorHeight = 0;
    int contentHeight = (int) viewLayout.contentPanel.getPreferredSize().getHeight();
    int contentWidth = (int) viewLayout.contentPanel.getPreferredSize().getWidth();
    int footerHeight = 0;
    int delta = 40;
    /*        if(contentHeight<=450){
        delta=-160;
    }else if (contentHeight<=700){
        delta=40;
    }*/

    dlg.setSize(
        contentWidth,
        (showAudit ? -14 : -14)
            + headerHeight
            + toolbarHeight
            + auditInfoHeight
            + errorHeight
            + contentHeight
            + footerHeight
            + delta);

    return dlg;
  }
 public void xtestTiming() {
   final JDialog dialog = new JDialog((JFrame) null, "TestTiming");
   JDesktopPane pane = new JDesktopPane();
   dialog.setContentPane(pane);
   final Object[] f = {null};
   for (int i = 99; i >= 0; i--) {
     JInternalFrame frame = new JInternalFrame("Internal Frame - " + i, true, true, true, true);
     JButton s = new JButton("button" + i);
     s.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             final long start = System.currentTimeMillis();
             System.err.println("TestMarathonNamingStrategy.testTiming(): " + start);
             namingStrategy.setTopLevelComponent(dialog, true);
             String name = namingStrategy.getName((Component) e.getSource());
             System.err.println(
                 "TestMarathonNamingStrategy.testTiming(): name = "
                     + name
                     + "::"
                     + (System.currentTimeMillis() - start));
           }
         });
     f[0] = s;
     frame.getContentPane().add(s);
     frame.pack();
     frame.setLocation(i, i);
     frame.setVisible(true);
     pane.add(frame);
   }
   dialog.setSize(500, 500);
   dialog.setModal(true);
   dialog.setVisible(true);
   System.err.println(
       "TestMarathonNamingStrategy.testTiming(): " + ((Component) f[0]).isVisible());
 }
Example #6
0
  private void warning(String msg) {
    final JDialog warn;
    JButton ok;
    JLabel message;

    warn = new JDialog();
    warn.setTitle(msg);

    message = new JLabel("CryoBay: " + msg);
    ok = new JButton("Ok");

    ok.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            warn.dispose();
          }
        });

    warn.getContentPane().setLayout(new BorderLayout());
    warn.getContentPane().add(message, "North");
    warn.getContentPane().add(ok, "South");

    warn.setSize(200, 80);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    warn.setLocation(screenSize.width / 2 - 100, screenSize.height / 2 - 40);
    warn.setResizable(false);
    warn.show();
  }
  /** 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);
  }
Example #8
0
  /**
   * This constructor creates a new message window with the information of an email on which the
   * user wants to respond
   *
   * @param message : stores information of an email on which we want to respond
   * @throws MessagingException : Throws exception to the the function where an object of type
   *     SendMessage has been instantiate
   * @throws IOException : Throws exception to the the function where an object of type SendMessage
   *     has been instantiate
   */
  public SendMessage(Message message) throws MessagingException, IOException {
    this.message = message;
    textArea = new JTextArea();
    scrollPane = new JScrollPane(textArea);
    wrongMailsStringBuilder = new StringBuilder();
    window = new JDialog();
    username = "******";
    userPassword = "******";
    width = 800;
    height = 500;
    messageHandler = new MessageHandler(message);
    window.setSize(width, height);
    window.setName("send a new E-Mail");
    window.setVisible(true);

    setTextArea();
    createToLabel();
    createCcLabel();
    createBccLabel();
    createSubjectLabel();
    createCcField();
    createBccField();
    createSendButton();
    createCancelButton();
    createSaveButton();
    createFormular(messageHandler, message);
    createContainer();
    setWindowConfiguration();
  }
Example #9
0
  /**
   * Centers a <code>JDialog</code> to the screen.
   *
   * @param dialog JDialog dialog to center
   */
  public static void centerDialog(JDialog dialog) {
    // since the Toolkit.getScreenSize() method is broken in the Linux implementation
    // of Java 5  (it returns double the screen size under xinerama), this method is
    // encapsulated to accomodate this with a hack.
    // TODO: remove the hack, once Java fixed this.
    // final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    final Rectangle screenSize =
        GraphicsEnvironment.getLocalGraphicsEnvironment()
            .getDefaultScreenDevice()
            .getDefaultConfiguration()
            .getBounds();

    final Dimension dialogSize = dialog.getSize();

    if (dialogSize.height > screenSize.height) {
      dialogSize.height = screenSize.height;
    }

    if (dialogSize.width > screenSize.width) {
      dialogSize.width = screenSize.width;
    }

    dialog.setLocation(
        screenSize.x + (screenSize.width - dialogSize.width) / 2,
        screenSize.y + (screenSize.height - dialogSize.height) / 2);
    dialog.setSize(dialogSize);
  }
Example #10
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);
    }
  }
  @SuppressWarnings("static-access")
  public DatePicker(Observer observer, Date selecteddate, Locale locale) {
    super();
    this.locale = locale;
    register(observer);
    screen = new JDialog();
    screen.addWindowFocusListener(this);
    screen.setSize(200, 200);
    screen.setResizable(false);
    screen.setModal(true);
    screen.setUndecorated(true);
    screen.setDefaultLookAndFeelDecorated(true);
    screen.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    screen.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    screen.getContentPane().setLayout(new BorderLayout());
    //
    calendar = new GregorianCalendar();
    setSelectedDate(selecteddate);
    Calendar c = calendar;
    if (selectedDate != null) c = selectedDate;
    updateScreen(c);
    screen.getContentPane().add(navPanel, BorderLayout.NORTH);

    screen.setTitle(getString("program.title", "Date Picker"));
  }
Example #12
0
 /**
  * This method initializes jDialog
  *
  * @return javax.swing.JDialog
  */
 private JDialog getJDialog() {
   if (jDialog == null) {
     jDialog = new JDialog();
     jDialog.setContentPane(getJContentPane());
     jDialog.setTitle(title);
     jDialog.setSize(this.getWidth() + 5, this.getHeight() + 35);
     jDialog.setLayout(new BorderLayout());
     jDialog.getContentPane().add(this, BorderLayout.CENTER);
     jDialog.setModal(true);
     jDialog.setAlwaysOnTop(true);
     GuiUtils.centerOnScreen(jDialog);
     jDialog.setResizable(false);
     jDialog.setAlwaysOnTop(true);
     jDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
     jDialog.addWindowListener(
         new WindowAdapter() {
           public void windowClosing(WindowEvent e) {
             JOptionPane.showMessageDialog(jDialog, "You must enter a password!");
           }
         });
     // getJContentPane().paintImmediately(0, 0, 300, 300);
     jDialog.setIconImage(ImageUtils.getImage("images/neptus-icon.png"));
     jDialog.toFront();
     jDialog.setFocusTraversalPolicy(new PasswordPanelFocusTraversalPolicy());
     jDialog.setVisible(true);
   }
   return jDialog;
 }
Example #13
0
 public static void aboutSystem(Frame owner) {
   JDialog dialog = new JDialog(owner, "System Properties"); // $NON-NLS-1$
   DiagnosticsForSystem viewer = new DiagnosticsForSystem();
   dialog.setContentPane(viewer);
   dialog.setSize(500, 300);
   dialog.setVisible(true);
 }
  @Override
  public void onCannotStonePlaced() {
    JDialog diag = new JDialog(this, CANNOT_PLACE, true);
    diag.setSize(new Dimension(300, 200));

    JPanel pan = new JPanel(new BorderLayout());
    JLabel lab = new JLabel(CANNOT_PLACE_MSG);
    lab.setSize(280, 190);
    pan.add(lab, BorderLayout.CENTER);
    JButton but = new JButton(VERIFY);
    pan.add(but, BorderLayout.SOUTH);

    final JDialog dia = diag;
    but.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dia.dispose();
          }
        });

    diag.getContentPane().add(pan);
    diag.setLocationRelativeTo(null);
    diag.setVisible(true);
  }
  private void init(String title) {
    diag = new JDialog(frame, title, false);

    preview = new PreviewPanel(null, new MetaData(), Globals.prefs.get("preview1"));

    sortedEntries =
        new SortedList<BibtexEntry>(entries, new EntryComparator(false, true, "author"));
    model = new EventTableModel<BibtexEntry>(sortedEntries, new EntryTableFormat());
    entryTable = new JTable(model);
    GeneralRenderer renderer = new GeneralRenderer(Color.white);
    entryTable.setDefaultRenderer(JLabel.class, renderer);
    entryTable.setDefaultRenderer(String.class, renderer);
    setWidths();
    TableComparatorChooser<BibtexEntry> tableSorter =
        new TableComparatorChooser<BibtexEntry>(
            entryTable, sortedEntries, TableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD);
    setupComparatorChooser(tableSorter);
    JScrollPane sp = new JScrollPane(entryTable);

    EventSelectionModel<BibtexEntry> selectionModel =
        new EventSelectionModel<BibtexEntry>(sortedEntries);
    entryTable.setSelectionModel(selectionModel);
    selectionModel.getSelected().addListEventListener(new EntrySelectionListener());
    entryTable.addMouseListener(new TableClickListener());

    contentPane.setTopComponent(sp);
    contentPane.setBottomComponent(preview);

    // Key bindings:
    AbstractAction closeAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            diag.dispose();
          }
        };
    ActionMap am = contentPane.getActionMap();
    InputMap im = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(Globals.prefs.getKey("Close dialog"), "close");
    am.put("close", closeAction);

    diag.addWindowListener(
        new WindowAdapter() {
          public void windowOpened(WindowEvent e) {
            contentPane.setDividerLocation(0.5f);
          }

          public void windowClosing(WindowEvent event) {
            Globals.prefs.putInt("searchDialogWidth", diag.getSize().width);
            Globals.prefs.putInt("searchDialogHeight", diag.getSize().height);
          }
        });

    diag.getContentPane().add(contentPane, BorderLayout.CENTER);
    // Remember and default to last size:
    diag.setSize(
        new Dimension(
            Globals.prefs.getInt("searchDialogWidth"), Globals.prefs.getInt("searchDialogHeight")));
    diag.setLocationRelativeTo(frame);
  }
  /** If Certificate was not accepted during installation user must accept it here. */
  public static boolean acceptCertificatePanel(String certificate) throws Exception {
    CertificatePanel CertificatePanel = new CertificatePanel(certificate);
    ResourceBundle bundle = NbBundle.getBundle(AcceptCertificate.class);
    String yesLabel = bundle.getString("MSG_CertificateYesButton");
    String noLabel = bundle.getString("MSG_CertificateNoButton");
    JButton yesButton = new JButton(yesLabel);
    JButton noButton = new JButton(noLabel);

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            command = e.getActionCommand();
            d.setVisible(false);
          }
        };
    yesButton.addActionListener(listener);
    noButton.addActionListener(listener);

    yesButton.setActionCommand("yes"); // NOI18N
    noButton.setActionCommand("no"); // NOI18N

    yesButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_AcceptButton"));
    yesButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSD_AcceptButton"));

    noButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_RejectButton"));
    noButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSD_RejectButton"));

    int maxWidth = Math.max(yesButton.getPreferredSize().width, noButton.getPreferredSize().width);
    int maxHeight =
        Math.max(yesButton.getPreferredSize().height, noButton.getPreferredSize().height);
    yesButton.setPreferredSize(new Dimension(maxWidth, maxHeight));
    noButton.setPreferredSize(new Dimension(maxWidth, maxHeight));

    d = new JDialog((Frame) null, bundle.getString("MSG_CertificateDlgTitle"), true);

    d.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_CertificateDlg"));
    d.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CertificateDlg"));

    d.getContentPane().add(CertificatePanel, BorderLayout.CENTER);
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(17, 12, 11, 11));
    buttonPanel.add(yesButton);
    buttonPanel.add(noButton);
    d.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    d.setSize(new Dimension(600, 600));
    d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    d.setModal(true);
    d.setResizable(true);
    // Center on screen
    d.setLocationRelativeTo(null);
    d.setVisible(true);

    if ("yes".equals(command)) { // NOI18N
      return true;
    } else {
      return false;
    }
  }
Example #17
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);
 }
 private void visualizarReporteGenerado() throws HeadlessException {
   JDialog viewer = new JDialog(new JFrame(), "Vista previa del reporte", true);
   viewer.setSize(800, 600);
   viewer.setLocationRelativeTo(null);
   JRViewer jrv = new JRViewer(reporteFill);
   viewer.getContentPane().add(jrv);
   viewer.setVisible(true);
 }
 public TrafficD2CharChooseService() {
   jDialog = new JDialog(TrafficWindow.mainWindow, "二维图");
   jDialog.setSize(120, 100);
   jDialog.setLocation(
       (TrafficWindow.screensize.width - 120) / 2, (TrafficWindow.screensize.height - 100) / 2);
   setContent();
   jDialog.setVisible(true);
 }
  public static void do_max_normal(JDialog frame) {
    Toolkit tk = Toolkit.getDefaultToolkit();
    int xSize = ((int) tk.getScreenSize().getWidth());
    int ySize = ((int) tk.getScreenSize().getHeight());
    frame.setSize(xSize, ySize);
    //        Center.setCenter(frame);

    //        frame.setVisible(true);
  }
Example #21
0
 public static void main(String[] args) {
   JDialog dialog = new JDialog();
   JPanel_MemoryUsage panel = new JPanel_MemoryUsage("./");
   dialog.getContentPane().add(panel);
   dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
   dialog.setSize(500, 300);
   dialog.addWindowListener(panel);
   dialog.setVisible(true);
 }
  public BreakpointViewBase() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    mErrorDialog = new JDialog(SwingUtilities.windowForComponent(this), "Invalid input");
    mErrorDialog.setModal(true);
    mErrorDialog.setSize(new Dimension(400, 100));
    mErrorDialog.setLocationRelativeTo(SwingUtilities.windowForComponent(this));
  }
        public void run() {
          String command = inputTextArea.getText().trim();
          if (command == null || command.length() == 0) {
            JOptionPane.showMessageDialog(
                mainWindow, "Command window is empty", "Out of order", JOptionPane.WARNING_MESSAGE);
            return;
          }

          // make busy dialog same width as main window.
          Dimension dlgBounds = busyDialog.getSize();
          dlgBounds.width = mainWindow.getSize().width;
          busyDialog.setSize(dlgBounds);

          runButton.setEnabled(false);
          Configuration config = (Configuration) connectionsList.getSelectedItem();
          if (passwdPromptCheckBox.isSelected() || !config.hasPassword()) {
            String pass = getPassword("Connection password for " + config.getName());
            config.setPassword(pass);
          }
          resultsStatusBar.reset();
          busyDialog.setVisible(true);

          try {
            currentConnection = configManager.getConnection(config);

            SQLRunner.setVerbosity(Verbosity.QUIET);
            SQLRunner prog = new SQLRunner(currentConnection, null, "t");
            prog.setGUI(SQLRunnerGUI.this);
            if (mode != null) {
              prog.setOutputMode(mode);
            }
            prog.setOutputFile(out);

            // RUN THE SQL
            prog.runStatement(command);

            if (prog.isEscape()) {
              outputPanel.setSelectedIndex(0);
            }
            resultsStatusBar.showSuccess(); // If no exception thrown!
          } catch (Exception e) {
            resultsStatusBar.showFailure();
            eHandler.handleError(e);
          } finally {
            runButton.setEnabled(true);
            busyDialog.setVisible(false);
            try {
              // Nested try here is deliberate, not a big deal if this call crashes
              if (currentConnection != null) {
                currentConnection.close();
              }
            } catch (SQLException ex) {
              System.err.println("Warning: close caused " + ex);
            }
          }
        }
Example #24
0
    private void _setSizeForLocation(int width, int height, @Nullable Point initial) {
      Point location = initial != null ? initial : getLocation();
      Rectangle rect = new Rectangle(location.x, location.y, width, height);
      ScreenUtil.fitToScreen(rect);
      if (initial != null || location.x != rect.x || location.y != rect.y) {
        setLocation(rect.x, rect.y);
      }

      super.setSize(rect.width, rect.height);
    }
Example #25
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 #26
0
  public void showDialog(Window owner) {
    TextPanel text = new TextPanel();
    text.addParagraph(getText());
    text.setPreferredWith(500);

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout(10, 10));
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));
    JScrollPane scroll = new JScrollPane(text);
    panel.add(scroll);

    final JDialog dialog = new JDialog(owner);

    JButton copy = new JButton("Copy to clipboard");
    copy.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                    clipboard.setContents(
                        new StringSelection(Logger.this.getText()),
                        new ClipboardOwner() {
                          @Override
                          public void lostOwnership(Clipboard clipboard, Transferable contents) {}
                        });
                  }
                });
          }
        });
    JButton close = new JButton("Close");
    close.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
          }
        });
    panel.add(ButtonBarFactory.buildHelpCloseBar(copy, close), BorderLayout.SOUTH);

    dialog.setModal(true);
    dialog.setTitle("CheS-Mapper Log");
    dialog.getContentPane().add(panel);
    dialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    dialog.pack();
    if (dialog.getWidth() > 600 || dialog.getHeight() > 800)
      dialog.setSize(new Dimension(600, 800));
    dialog.setLocationRelativeTo(owner);
    dialog.setVisible(true);
  }
Example #27
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);
  }
  public static void main(String[] args) {
    JDialog dlgVentana = new JDialog();
    dlgVentana.setResizable(false);

    GeopistaComparacionPanel iniciar = new GeopistaComparacionPanel();

    dlgVentana.getContentPane().add(iniciar);
    dlgVentana.setSize(750, 600);
    dlgVentana.setVisible(true);
    dlgVentana.setLocation(150, 90);
    dlgVentana.setTitle("Discrepancias de la Información");
    dlgVentana.setResizable(false);
  }
Example #29
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);
 }
 public static void showCashReturn(String text, String title) {
   if (instance != null) {
     dialog = new JDialog(instance, title, false);
     JLabel label = new JLabel(text);
     label.setFont(label.getFont().deriveFont(Font.BOLD, 20));
     label.setHorizontalAlignment(SwingConstants.CENTER);
     label.setVerticalAlignment(SwingConstants.CENTER);
     dialog.getContentPane().add(label);
     dialog.setSize(Math.max(instance.getWidth() / 2, 200), 100);
     dialog.setLocationRelativeTo(instance);
     dialog.setVisible(true);
   }
 }