Package com.jidesoft.dialog

Examples of com.jidesoft.dialog.ButtonPanel


     */
    public static JPanel createTableModelModifier(final DefaultTableModel tableModel) {
        JPanel tableModelPanel = new JPanel(new BorderLayout(6, 6));
        final JTable table = new JTable(tableModel);
        tableModelPanel.add(new JScrollPane(table));
        ButtonPanel buttonPanel = new ButtonPanel();

        JButton insert = new JButton("Insert");
        insert.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                Vector rowData = tableModel.getDataVector();
                int index = table.getSelectedRow();
                if (index != -1) {
                    Vector v = (Vector) rowData.get(index);
                    Vector clone = new Vector();
                    for (int i = 0; i < v.size(); i++) {
                        if (i == 0) {
                            clone.add((int) (Math.random() * 10));
                        }
                        else {
                            clone.add("" + v.get(i));
                        }
                    }
                    tableModel.insertRow(index, clone);
                }
            }
        });

        JButton delete = new JButton("Delete");
        delete.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                int[] rows = table.getSelectedRows();
                for (int i = rows.length - 1; i >= 0; i--) {
                    int row = rows[i];
                    tableModel.removeRow(row);
                }
            }
        });

        JButton clear = new JButton("Clear");
        clear.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                for (int i = 0; i < tableModel.getRowCount(); i++) {
                    tableModel.removeRow(0);
                }
            }
        });

        buttonPanel.add(insert);
        buttonPanel.add(delete);
        buttonPanel.add(clear);
        tableModelPanel.add(buttonPanel, BorderLayout.AFTER_LAST_LINE);
        return tableModelPanel;
    }
View Full Code Here


    @Override
    protected Container createButtonArea() {
        int orientation = UIDefaultsLookup.getInt("OptionPane.buttonOrientation");
        orientation = orientation == 0 ? SwingConstants.CENTER : orientation;
        ButtonPanel buttonPanel = new ButtonPanel(orientation);
        Border border = (Border) UIDefaultsLookup.get("OptionPane.buttonAreaBorder");
        buttonPanel.setName("OptionPane.buttonArea");
        if (border != null) {
            buttonPanel.setBorder(border);
        }
        boolean sameSize = UIDefaultsLookup.getBoolean("OptionPane.sameSizeButtons");
        buttonPanel.setSizeConstraint(sameSize ? ButtonPanel.SAME_SIZE : ButtonPanel.NO_LESS_THAN);
        int padding = UIDefaultsLookup.getInt("OptionPane.buttonPadding");
        padding = padding == 0 ? 6 : padding;
        buttonPanel.setButtonGap(padding);
        addButtonComponents(buttonPanel, getButtons(), getInitialValueIndex());
        return buttonPanel;
    }
View Full Code Here

        _approveButton.setAction(getApproveSelectionAction());

        _cancelButton = new JButton();
        _cancelButton.addActionListener(getCancelSelectionAction());

        ButtonPanel buttonPanel = new ButtonPanel();
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 0, 0));
        buttonPanel.addButton(_approveButton, ButtonPanel.AFFIRMATIVE_BUTTON);
        buttonPanel.addButton(_cancelButton, ButtonPanel.CANCEL_BUTTON);
        return buttonPanel;
    }
View Full Code Here

  public Dimension getPreferredSize(){
    return PREFERRED_SIZE;
  }

  public ButtonPanel createButtonPanel(){
    ButtonPanel buttonPanel = super.createButtonPanel();
    AbstractAction applyAction = new ApplyAction();
    applyAction.setEnabled(false);
    AbstractAction okAction = new OkAction();
    ((JButton)buttonPanel.getButtonByName(ButtonNames.APPLY)).setAction(applyAction);
    ((JButton)buttonPanel.getButtonByName(ButtonNames.OK)).setAction(okAction);
    return buttonPanel;
  }
View Full Code Here

        return label;
    }

    public ButtonPanel createButtonPanel()
    {
        final ButtonPanel buttonPanel = new ButtonPanel();
        final JButton okButton = new JButton("Bind");
        final JButton cancelButton = new JButton("Cancel");

        buttonPanel.addButton(okButton);
        buttonPanel.addButton(cancelButton);

        okButton.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                doBind();
                dispose();

            }
        });

        cancelButton.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                dispose();
            }
        });

        buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
        return buttonPanel;
    }
View Full Code Here

    *
    * @see com.jidesoft.dialog.StandardDialog#createButtonPanel()
    */
   public ButtonPanel createButtonPanel()
   {
      final ButtonPanel buttonPanel = new ButtonPanel(SwingConstants.RIGHT);
     
      AbstractAction okButtonAction = new AbstractAction(UIManager.getString("OptionPane.okButtonText"))
      {
         /**
     *
     */
    private static final long serialVersionUID = 6700170688321726600L;

    public void actionPerformed(ActionEvent arg0)
         {
            configPanel.doOK();
            setDialogResult(RESULT_AFFIRMED);
            setVisible(false);
            dispose();
         }
      };

     
      AbstractAction cancelButtonAction = new AbstractAction(UIManager.getString("OptionPane.cancelButtonText"))
      {
         /**
     *
     */
    private static final long serialVersionUID = -2716459494822521628L;

    public void actionPerformed(ActionEvent arg0)
         {
            configPanel.doCancel();
            setDialogResult(RESULT_CANCELLED);
            setVisible(false);
            dispose();
         }
      };

      JButton okButton = new JButton(okButtonAction);
      JButton cancelButton = new JButton(cancelButtonAction);

      buttonPanel.addButton(okButton);
      buttonPanel.addButton(cancelButton);
      buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

      return buttonPanel;
   }
View Full Code Here

     *
     * @see com.jidesoft.dialog.StandardDialog#createButtonPanel()
     */
    public ButtonPanel createButtonPanel()
    {
        final ButtonPanel buttonPanel = new ButtonPanel(SwingConstants.RIGHT);

        AbstractAction okButtonAction = new AbstractAction(UIManager.getString("OptionPane.okButtonText"))
        {
            /**
       *
       */
      private static final long serialVersionUID = 2353403995331123497L;

      public void actionPerformed(ActionEvent arg0)
            {
                beanPanel.doOK();
                setDialogResult(RESULT_AFFIRMED);
                setVisible(false);
                dispose();
            }
        };

        AbstractAction cancelButtonAction = new AbstractAction(UIManager.getString("OptionPane.cancelButtonText"))
        {
            /**
       *
       */
      private static final long serialVersionUID = 3126103743620232352L;

      public void actionPerformed(ActionEvent arg0)
            {
                beanPanel.doCancel();
                setDialogResult(RESULT_CANCELLED);
                setVisible(false);
                dispose();
            }
        };

        JButton okButton = new JButton(okButtonAction);
        JButton cancelButton = new JButton(cancelButtonAction);

        buttonPanel.addButton(okButton);
        buttonPanel.addButton(cancelButton);
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

        okButton.setEnabled(beanPanel.isEditable());

        return buttonPanel;
    }
View Full Code Here

        return label;
    }

    public ButtonPanel createButtonPanel()
    {
        final ButtonPanel buttonPanel = new ButtonPanel();
        final JButton okButton = new JButton("OK");
        final JButton cancelButton = new JButton("Cancel");

        buttonPanel.addButton(okButton);
        buttonPanel.addButton(cancelButton);

        okButton.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                onOK();
                dispose();

            }
        });

        cancelButton.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                dispose();
            }
        });

        buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
        return buttonPanel;
    }
View Full Code Here

  public JComponent createBannerPanel() {
    return new JLabel();
  }

  public ButtonPanel createButtonPanel() {
    final ButtonPanel buttonPanel = new ButtonPanel();
    final JButton okButton = new JButton("OK");
    final JButton cancelButton = new JButton("Cancel");

    buttonPanel.addButton(okButton);
    buttonPanel.addButton(cancelButton);

    okButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        onOK();
        dispose();

      }
    });

    cancelButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        dispose();
      }
    });

    buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    return buttonPanel;
  }
View Full Code Here

     *
     * @see com.jidesoft.dialog.StandardDialog#createButtonPanel()
     */
    public ButtonPanel createButtonPanel()
    {
        final ButtonPanel buttonPanel = new ButtonPanel(SwingConstants.RIGHT);

        AbstractAction okButtonAction = new AbstractAction(UIManager.getString("OptionPane.okButtonText"))
        {
            /**
       *
       */
      private static final long serialVersionUID = -7972988497933837263L;

      public void actionPerformed(ActionEvent arg0)
            {
                mapPanel.doOK();
                setDialogResult(RESULT_AFFIRMED);
                setVisible(false);
                dispose();
            }
        };

        AbstractAction cancelButtonAction = new AbstractAction(UIManager.getString("OptionPane.cancelButtonText"))
        {
            /**
       *
       */
      private static final long serialVersionUID = -4199961023918150328L;

      public void actionPerformed(ActionEvent arg0)
            {
                mapPanel.doCancel();
                setDialogResult(RESULT_CANCELLED);
                setVisible(false);
                dispose();
            }
        };

        JButton okButton = new JButton(okButtonAction);
        JButton cancelButton = new JButton(cancelButtonAction);

        buttonPanel.addButton(okButton);
        buttonPanel.addButton(cancelButton);
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

        cancelButton.setEnabled(mapPanel.isEditable());

      
        return buttonPanel;
View Full Code Here

TOP

Related Classes of com.jidesoft.dialog.ButtonPanel

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.