Package javax.swing

Examples of javax.swing.JDialog


            }
          }catch(Throwable sizeFault) {
            mTrayIcon = new TrayIcon(ImageIO.read(new File("imgs/tvbrowser16.png")), tooltip);
          }

          mTrayParent = new JDialog();
          mTrayParent.setTitle("Tray-Menu");

          mTrayParent.setSize(0, 0);
          mTrayParent.setUndecorated(true);
          mTrayParent.setAlwaysOnTop(true);
View Full Code Here


    ta.setWrapStyleWord(true);
    //ta.setBackground(getBackground());
    ta.setEditable(false);
    ta.setText(m_HelpText.toString());
    ta.setCaretPosition(0);
    JDialog jdtmp;
    if (PropertyDialog.getParentDialog(this) != null)
      jdtmp = new JDialog(PropertyDialog.getParentDialog(this), "Information");
    else
      jdtmp = new JDialog(PropertyDialog.getParentFrame(this), "Information");
    final JDialog jd = jdtmp;
    jd.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        jd.dispose();
        if (m_HelpDialog == jd) {
          m_HelpBut.setEnabled(true);
        }
      }
    });
    jd.getContentPane().setLayout(new BorderLayout());
    jd.getContentPane().add(new JScrollPane(ta), BorderLayout.CENTER);
    jd.pack();
    jd.setSize(400, 350);
    jd.setLocation(m_aboutPanel.getTopLevelAncestor().getLocationOnScreen().x
                   + m_aboutPanel.getTopLevelAncestor().getSize().width,
                   m_aboutPanel.getTopLevelAncestor().getLocationOnScreen().y);
    jd.setVisible(true);
    m_HelpDialog = jd;
  }
View Full Code Here

      m_IOThread = new Thread() {
    public void run() {
      try {
              // create dialog
              final DataGeneratorPanel generatorPanel = new DataGeneratorPanel();
              final JDialog dialog = new JDialog();
              final JButton generateButton = new JButton("Generate");
              final JCheckBox showOutputCheckBox =
                                  new JCheckBox("Show generated data as text, incl. comments");

              showOutputCheckBox.setMnemonic('S');
              generatorPanel.setLog(m_Log);
              generatorPanel.setGenerator(m_DataGenerator);
              generatorPanel.setPreferredSize(
                  new Dimension(
                        300,
                        (int) generatorPanel.getPreferredSize().getHeight()));
              generateButton.setMnemonic('G');
              generateButton.setToolTipText("Generates the dataset according the settings.");
              generateButton.addActionListener(new ActionListener(){
                  public void actionPerformed(ActionEvent evt){
                    // generate
                    generatorPanel.execute();
                    boolean generated = (generatorPanel.getInstances() != null);
                    if (generated)
                      setInstances(generatorPanel.getInstances());

                    // close dialog
                    dialog.dispose();

                    // get last generator
                    m_DataGenerator = generatorPanel.getGenerator();

                    // display output?
                    if ( (generated) && (showOutputCheckBox.isSelected()) )
                      showGeneratedInstances(generatorPanel.getOutput());
                }
              });
              dialog.setTitle("DataGenerator");
              dialog.getContentPane().add(generatorPanel, BorderLayout.CENTER);
              dialog.getContentPane().add(generateButton, BorderLayout.EAST);
              dialog.getContentPane().add(showOutputCheckBox, BorderLayout.SOUTH);
              dialog.pack();
             
              // display dialog
              dialog.setVisible(true);
      }
            catch (Exception ex) {
        ex.printStackTrace();
        m_Log.logMessage(ex.getMessage());
      }
View Full Code Here

   * displays a dialog with the generated instances from the DataGenerator
   *
   * @param data  the data to display
   */
  protected void showGeneratedInstances(String data) {
    final JDialog dialog = new JDialog();
    final JButton saveButton = new JButton("Save");
    final JButton closeButton = new JButton("Close");
    final JTextArea textData = new JTextArea(data);
    final JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    textData.setEditable(false);
    textData.setFont(
        new Font("Monospaced", Font.PLAIN, textData.getFont().getSize()));

    saveButton.setMnemonic('S');
    saveButton.setToolTipText("Saves the output to a file");
    saveButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent evt){
        JFileChooser filechooser = new JFileChooser();
        int result = filechooser.showSaveDialog(dialog);
        if (result == JFileChooser.APPROVE_OPTION) {
          try {
            BufferedWriter writer = new BufferedWriter(
                                      new FileWriter(
                                        filechooser.getSelectedFile()));
            writer.write(textData.getText());
            writer.flush();
            writer.close();
            JOptionPane.showMessageDialog(
              dialog,
              "Output successfully saved to file '"
              + filechooser.getSelectedFile() + "'!",
              "Information",
              JOptionPane.INFORMATION_MESSAGE);
          }
          catch (Exception e) {
            e.printStackTrace();
          }
          dialog.dispose();
        }
      }
    });
    closeButton.setMnemonic('C');
    closeButton.setToolTipText("Closes the dialog");
    closeButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent evt){
        dialog.dispose();
      }
    });
    panel.add(saveButton);
    panel.add(closeButton);
    dialog.setTitle("Generated Instances (incl. comments)");
    dialog.getContentPane().add(new JScrollPane(textData), BorderLayout.CENTER);
    dialog.getContentPane().add(panel, BorderLayout.SOUTH);
    dialog.pack();

    // make sure, it's not bigger than 80% of the screen
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    int width  = dialog.getWidth() > screen.getWidth()*0.8
                    ? (int) (screen.getWidth()*0.8) : dialog.getWidth();
    int height = dialog.getHeight() > screen.getHeight()*0.8
                    ? (int) (screen.getHeight()*0.8) : dialog.getHeight();
    dialog.setSize(width, height);
   
    // display dialog
    dialog.setVisible(true);
  }
View Full Code Here

   */
  protected void showConfigureDialog(final SearchTextField textField) {
    final SearchForm form = new SearchForm(false, false, true);
    form.setSearchFormSettings(mSearchFormSettings);

    final JDialog configure = new JDialog(MainFrame.getInstance(), mLocalizer.msg("settingsTitle","Search-Settings"), false);
    configure.setUndecorated(true);
    JPanel panel = (JPanel)configure.getContentPane();
    panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),Borders.DLU4_BORDER));
    panel.setLayout(new FormLayout("fill:pref:grow, 3dlu, pref", "pref, fill:3dlu:grow, pref"));

    form.setParentDialog(configure);

    CellConstraints cc = new CellConstraints();

    panel.add(form, cc.xyw(1, 1, 3));

    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        configure.setVisible(false);
        mSearchFormSettings = form.getSearchFormSettings();
        saveSearchFormSettings();
        textField.requestFocusInWindow();
        textField.selectAll();
      }
    });

    panel.add(ok, cc.xy(3,3));

    UiUtilities.registerForClosing(new WindowClosingIf() {
      public void close() {
        configure.removeWindowListener(configure.getWindowListeners()[0]);
        configure.setVisible(false);
        textField.requestFocusInWindow();
        textField.selectAll();
      }

      public JRootPane getRootPane() {
        return configure.getRootPane();
      }
    });

    configure.pack();

    configure.addWindowListener(new WindowAdapter() {
      public void windowDeactivated(WindowEvent e) {
        if(!form.isSearchFieldsSelectionDialogVisible()) {
          ((JDialog)e.getSource()).setVisible(false);
          mSearchFormSettings = form.getSearchFormSettings();
          saveSearchFormSettings();
        }
      }
    });

    Point p = mSearchButton.getLocationOnScreen();

    if(MainFrame.getInstance().getToolbar().getToolbarLocation().compareTo(BorderLayout.NORTH) == 0) {
      configure.setLocation(p.x - configure.getWidth() + mSearchButton.getWidth(),p.y + mSearchButton.getHeight());
    } else {
      configure.setLocation(p.x ,p.y - configure.getHeight());
    }
    configure.setVisible(true);
  }
View Full Code Here

   * Creates the dialog an makes it visible
   */
  public void show() {
    Window parent = UiUtilities.getLastModalChildOf(MainFrame.getInstance());

    mDialog = new JDialog(parent);
    mDialog.setModal(true);

    mDialog.setTitle(mProgram.getTitle());
    mDialog.setContentPane(mMainPanel);

View Full Code Here

  public String getToolTipText(MouseEvent e) {
    return getToolTipText();
  }
 
  private void showPopup(final Point p, final JPopupMenu menu) {
    final JDialog popupParent = SystemTray.getProgamPopupParent();
    menu.addPopupMenuListener(new PopupMenuListener() {
      public void popupMenuWillBecomeVisible(PopupMenuEvent e) {}

      public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        popupParent.setVisible(false);
      }

      public void popupMenuCanceled(PopupMenuEvent e) {}
    });
   
    popupParent.setVisible(true);
    popupParent.toFront();
   
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        menu.show(popupParent,p.x - popupParent.getLocation().x,p.y - popupParent.getLocation().y);
      };
    });
  }
View Full Code Here

      mUseSystemTray = false;
      Settings.propTrayIsEnabled.setBoolean(false);
    }

    if (mUseSystemTray) {
      mTrayParent = new JDialog();
      mTrayParent.setTitle("Tray-Menu-Program-Popup");

      mTrayParent.setSize(0, 0);
      mTrayParent.setUndecorated(true);
      mTrayParent.setAlwaysOnTop(true);
View Full Code Here

      pane.setInitialValue(cancel);
      pane.setMessage(mLocalizer.msg("betawarning.text","<html>The plugin <b>{0}</b> is a beta version.<br>Beta versions are possible unstable and could contain errors.<br><br>Are you sure that you want to install this version?</html>",getName() + " " + getVersion()));
     
      Window w = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
     
      JDialog dialog = pane.createDialog(w, mLocalizer.msg("betawarning.title","Beta version"));
      dialog.setModal(true);
      dialog.setLocationRelativeTo(w);
      dialog.setVisible(true);
     
      if(!ok.equals(pane.getValue())) {
        return false;
      }
    }
View Full Code Here

    JButton browseBut = new JButton("Browse...");
    browseBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          //final JFrame jf = new JFrame("Choose directory");
          final JDialog jf = new JDialog((JDialog)SaverCustomizer.this.getTopLevelAncestor(),
              "Choose directory", true);
          jf.setLayout(new BorderLayout());
          jf.getContentPane().add(m_fileChooser, BorderLayout.CENTER);
          m_fileChooserFrame = jf;
          jf.pack();
          jf.setVisible(true);
        } catch (Exception ex) {
          ex.printStackTrace();
        }
      }
    });
View Full Code Here

TOP

Related Classes of javax.swing.JDialog

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.