Package jmt.framework.gui.components

Examples of jmt.framework.gui.components.JMTDialog


    this.mainWindow = mainWindow;
  }

  private void createDialog() {
    // Creates modal dialog
    dialogFrame = new JMTDialog(mainWindow, true);
    dialogFrame.centerWindow(width, height);
    dialogFrame.setResizable(true);
    dialogFrame.setMinimumSize(new Dimension((int)(width * RESIZE_RATIO), (int) (height* RESIZE_RATIO)));
    dialogFrame.getContentPane().setLayout(new BorderLayout());

View Full Code Here


   * @param title title of dialog to be created
   * @param autoclose to automatically close the dialog after a timeout
   * @return created dialog
   */
  protected static JMTDialog createDialog(Window owner, AboutDialogPanel panel, boolean autoclose) {
    final JMTDialog dialog;
    if (owner == null) {
      dialog = new JMTDialog();
    } else if (owner instanceof Dialog) {
      dialog = new JMTDialog((Dialog) owner, true);
    } else if (owner instanceof Frame) {
      dialog = new JMTDialog((Frame) owner, true);
    } else {
      dialog = new JMTDialog();
    }
    dialog.setTitle(panel.getDialogTitle());
    dialog.getContentPane().setLayout(new BorderLayout());
    dialog.getContentPane().add(panel, BorderLayout.CENTER);

    // Adds exit button
    JButton exit = new JButton();
    exit.setText("Close");
    exit.addActionListener(new ActionListener() {

      /**
       * Invoked when an action occurs.
       */
      public void actionPerformed(ActionEvent e) {
        dialog.close();
      }
    });

    JPanel bottom = new JPanel();
    bottom.add(exit);
    dialog.getContentPane().add(bottom, BorderLayout.SOUTH);
    dialog.centerWindow(640, 600);
   
    // Handles autoclose
    if (autoclose) {
      ExecutorService es = Executors.newSingleThreadExecutor();
      es.execute(new Runnable() {
        @Override
        public void run() {
          try {
            Thread.sleep(AUTOCLOSE_TIMEOUT);
            dialog.close();
          } catch (InterruptedException ex) {
            // Nothing to do
          }
        }
      });
View Full Code Here

TOP

Related Classes of jmt.framework.gui.components.JMTDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.