Package javax.swing

Examples of javax.swing.JDialog


  public boolean doAction(double x, double y, Object o, String action, CompoundEdit undoableEdit) {

    if (action.equals(resources.getStringValue("information"))){
      // Display plot information
      PlotInformationDialog di = new TimePlotStatisticsDialog(this);
      JDialog jd = di.createDialog(JSynoptic.gui.getOwner());
      if (jd!=null) jd.show();
      return true;
   
    } else {
        return super.doAction(x,y,o,action, undoableEdit);
    }
View Full Code Here


    return pane;
  }
 
  public void editDialog(JDialog owner) {

    final JDialog dialog = new JDialog(owner,true);
    dialog.setTitle((name==null) ? resources.getString("UnnamedMapper") : name);

    JPanel content = createPanel(owner, new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        switch (e.getID()) {
          case 1: // text change
            dialog.setTitle(e.getActionCommand());
            break;
          case 2: // OK pressed
            dialog.dispose();
            break;
        }
      }
    });
   
    dialog.getContentPane().add(content);
    dialog.pack();
    dialog.show();
    notifyListeners(); // there is no cancel => always consider the mapping changed
  }
View Full Code Here

         
          // -------------------- Column setup ----------------------------------------------
          column_setup = new JMenuItem("Column setup", ImgRep.getIcon("columns_setup.png"));
          column_setup.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JDialog col_set_frame = new JDialog(parent,"Column setup",true);
              JPanel right_panel = new JPanel(); // where the up & down buttons are located
              JPanel bottom_panel = new JPanel(); // Cancel, Defaults, Ok buttons
              JPanel center_panel = new JPanel(); // the jtable
              JButton up_button = new JButton("Up");
              JButton down_button = new JButton("Down");
              JButton ok_button = new JButton("OK");
              JButton cancel_button = new JButton("Cancel");
              JButton apply_button = new JButton("Apply");
              right_panel.setLayout(new GridLayout(2,1));
              right_panel.add(up_button);
              right_panel.add(down_button);
              bottom_panel.setLayout(new GridLayout(1,3));
              bottom_panel.add(ok_button);
              bottom_panel.add(apply_button);
              bottom_panel.add(cancel_button);
              center_panel.setLayout(new GridLayout(1,1));
              col_set_frame.setSize(400, 300);
              col_set_frame.setLayout(new BorderLayout());
              col_set_frame.add(center_panel,BorderLayout.CENTER);
              col_set_frame.add(right_panel, BorderLayout.EAST);
              col_set_frame.add(bottom_panel, BorderLayout.SOUTH);
              final JTable col_set_table = new JTable();
              //DefaultTableModel col_set_table_model = new DefaultTableModel();
              Object[][] col_set_rows_cols = new Object[14][3];
              int i = 0;
              // col name -> col obj mapping (easy way to map col names to master cols)
              final Map<String,TableColumnExt> cols = new Hashtable<String,TableColumnExt>();
              for(TableColumnExt column : table_columns) {
                if(column.isVisible()) col_set_rows_cols[i][0] = true;
                else col_set_rows_cols[i][0] = false;
                col_set_rows_cols[i][1] = column.getHeaderValue();
                cols.put(column.getHeaderValue().toString(), column);
                ++i;
              }
              col_set_table.setModel(new DefaultTableModel(col_set_rows_cols,
                  new String[] {
                  "Visibility", "Name", "Description"
              })
              {
                      Class[] types = new Class [] {
                          java.lang.Boolean.class, java.lang.String.class, java.lang.String.class
                      };

                      public Class getColumnClass(int columnIndex) {
                          return types [columnIndex];
                      }
                  });
              JScrollPane scroll_pane = new JScrollPane();
              scroll_pane.setViewportView(col_set_table);
              center_panel.add(scroll_pane);
              SwingUtils.setWindowLocationRelativeTo(col_set_frame, parent);
              apply_button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                                    for(int i=0; i<14; i++) {
                                      boolean visibility = Boolean.parseBoolean(col_set_table.getModel().getValueAt(i, 0).toString());
                                      String column_name = col_set_table.getModel().getValueAt(i, 1).toString();
                                      //cols.get(column_name).setVisible(visibility);
                                      if(visibility == false) column_model.removeColumn(cols.get(column_name));
                                      System.out.println("Column from set " + cols.get(column_name).getHeaderValue());
                                      System.out.println("<--->" + column_name + "<---->" + visibility);
                                    }
                }
              });
              col_set_frame.setVisible(true);
            }
          });
       }
       public void mousePressed(MouseEvent e) {
           showPopup(e);
View Full Code Here

   * @param items array of string to be displayed
   * @param checked array of booleans with the check status
   * @return an array of check status for the list elements or null if canceled
   */
  public static boolean[] openDialog(String title, Window parent, String[] items, boolean[] checked){
    final JDialog jd;
    if(parent instanceof Dialog){
      jd =new JDialog((Dialog)parent, title, true);
    }else{
      jd =new JDialog((Frame)parent, title, true);
    }
    final CheckBoxList cbl=new CheckBoxList(items,checked);
    JScrollPane scroller =
            new JScrollPane (cbl,
                            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jd.getContentPane().add(scroller,BorderLayout.CENTER);
    JButton okb=resources.getButton("OKButton", new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        jd.dispose();
      }     
    });
    JButton cancelb=resources.getButton("CancelButton", new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        cbl.isChecked=null;
        jd.dispose();
      }     
    });
    jd.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    JPanel pokb=new JPanel();
    pokb.add(okb);
    pokb.add(cancelb);
    jd.getContentPane().add(pokb,BorderLayout.SOUTH);
    jd.pack();
    jd.show();

    return cbl.getCheckedItems();
   
  }
View Full Code Here

         
          // -------------------- Column setup ----------------------------------------------
          column_setup = new JMenuItem("Column setup", ImgRep.getIcon("columns_setup.png"));
          column_setup.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JDialog col_set_frame = new JDialog(parent,"Column setup",true);
              JPanel right_panel = new JPanel(); // where the up & down buttons are located
              JPanel bottom_panel = new JPanel(); // Cancel, Defaults, Ok buttons
              JPanel center_panel = new JPanel(); // the jtable
              JButton up_button = new JButton("Up");
              JButton down_button = new JButton("Down");
              JButton ok_button = new JButton("OK");
              JButton cancel_button = new JButton("Cancel");
              JButton apply_button = new JButton("Apply");
              right_panel.setLayout(new GridLayout(2,1));
              right_panel.add(up_button);
              right_panel.add(down_button);
              bottom_panel.setLayout(new GridLayout(1,3));
              bottom_panel.add(ok_button);
              bottom_panel.add(apply_button);
              bottom_panel.add(cancel_button);
              center_panel.setLayout(new GridLayout(1,1));
              col_set_frame.setSize(400, 300);
              col_set_frame.setLayout(new BorderLayout());
              col_set_frame.add(center_panel,BorderLayout.CENTER);
              col_set_frame.add(right_panel, BorderLayout.EAST);
              col_set_frame.add(bottom_panel, BorderLayout.SOUTH);
              final JTable col_set_table = new JTable();
              //DefaultTableModel col_set_table_model = new DefaultTableModel();
              Object[][] col_set_rows_cols = new Object[14][3];
              int i = 0;
              // col name -> col obj mapping (easy way to map col names to master cols)
              final Map<String,TableColumnExt> cols = new Hashtable<String,TableColumnExt>();
              for(TableColumnExt column : table_columns) {
                if(column.isVisible()) col_set_rows_cols[i][0] = true;
                else col_set_rows_cols[i][0] = false;
                col_set_rows_cols[i][1] = column.getHeaderValue();
                cols.put(column.getHeaderValue().toString(), column);
                ++i;
              }
              col_set_table.setModel(new DefaultTableModel(col_set_rows_cols,
                  new String[] {
                  "Visibility", "Name", "Description"
              })
              {
                      Class[] types = new Class [] {
                          java.lang.Boolean.class, java.lang.String.class, java.lang.String.class
                      };

                      public Class getColumnClass(int columnIndex) {
                          return types [columnIndex];
                      }
                  });
              JScrollPane scroll_pane = new JScrollPane();
              scroll_pane.setViewportView(col_set_table);
              center_panel.add(scroll_pane);
              SwingUtils.setWindowLocationRelativeTo(col_set_frame, parent);
              apply_button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                                    for(int i=0; i<14; i++) {
                                      boolean visibility = Boolean.parseBoolean(col_set_table.getModel().getValueAt(i, 0).toString());
                                      String column_name = col_set_table.getModel().getValueAt(i, 1).toString();
                                      //cols.get(column_name).setVisible(visibility);
                                      if(visibility == false) column_model.removeColumn(cols.get(column_name));
                                      System.out.println("Column from set " + cols.get(column_name).getHeaderValue());
                                      System.out.println("<--->" + column_name + "<---->" + visibility);
                                    }
                }
              });
              col_set_frame.setVisible(true);
            }
          });
       }
View Full Code Here

  public JDialog createDialog(Frame parent) {
   
    if ( (dsi==null) ||(dialog!=null)){
      return null
    }
    dialog = new JDialog( parent, resources.getString("dataSourceInformation"), false);
    Container contentPane = dialog.getContentPane();

    JPanel p  = new JPanel();
    Border paneEdge = BorderFactory.createEmptyBorder(0,10,10,10);
    p.setBorder(paneEdge);
View Full Code Here

        setFocusPainted(false);
        addActionListener(new ActionListener() {
            boolean _dialogOk;

            public void actionPerformed(ActionEvent e) {
                final JDialog dialog = new JDialog(_owner, true);
                dialog.setTitle(_title);
                JColorChooser chooser = ColorChooserProvider.colorChooserProvider.getColorChooser();
                dialog.getContentPane().add(chooser);
                JButton cancel, ok;
                JPanel p = new JPanel();
                // TODO i18n
                p.add(ok = new JButton("OK"));
                p.add(cancel = new JButton("Cancel"));
                _dialogOk = false;
                ok.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        _dialogOk = true;
                        dialog.dispose();
                    }
                });
                cancel.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        dialog.dispose();
                    }
                });
                dialog.getContentPane().add(p, BorderLayout.SOUTH);
                dialog.pack();
                dialog.setVisible(true);
                if (_dialogOk) {
                    set(chooser.getColor());
                }
            }
        });
View Full Code Here

            return true;
        }
        if (action.equals(resources.getStringValue("information"))) {

            PlotInformationDialog di = new PlotInformationDialog(this);
            JDialog jd = di.createDialog(JSynoptic.gui.getOwner());
            if (jd!=null) jd.show();
            return true;
        }
        for(int i=0;i<_curves.size();i++){

            // magnetize a curve action
View Full Code Here

          .getRoot()));
      expandAll(getTargetTree(), new TreePath(getTargetTree().getModel()
          .getRoot()));
    }

    this.dialog = new JDialog(fileRenamer.getParentFrame());
    this.dialog.setModal(true);
    this.dialog.getContentPane().add(inspectionPanel);
    this.dialog.addWindowListener(new WindowCloser());
    this.dialog.setSize(800, 500);
    this.dialog.setLocationRelativeTo(null);
View Full Code Here

    }
   
  }

  public void testPlaceDialog() {
    Dialog d = new JDialog();
    d.setSize(50, 50);
    Container c = new JWindow();
    c.setBounds(100, 200, 100, 50);
   
    Util.placeDialog(d, c);
    assertEquals(125, d.getX());
    assertEquals(200, d.getY());
   
    // Test upper left corner
    c.setBounds(0,0,100,100);
    d.setSize(200, 200);
   
    Util.placeDialog(d, c);
    assertEquals(0, d.getX());
    assertEquals(0, d.getY());
  }
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.