Package com.jidesoft.swing

Examples of com.jidesoft.swing.JideButton


  public void setButtonStyle(int style){
    this.buttonStyle = style;
  }
 
  public AbstractButton createButton() {
    JideButton button = new JideButton();
    button.setButtonStyle(buttonStyle);
    return button;
  }
View Full Code Here


        buttonsPanel.setButtonGap(0);

        final ButtonGroup group = new ButtonGroup();
        for (int i = 0; i < _pageList.getPageCount(); i++) {
            final AbstractDialogPage optionsPanel = _pageList.getPage(i);
            final JideButton button = createIconButton(optionsPanel.getTitle(), optionsPanel.getIcon());
            button.setToolTipText(optionsPanel.getDescription());
            button.setEnabled(optionsPanel.isPageEnabled());
            button.addActionListener(new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    setCurrentPage(optionsPanel, buttonsPanel);
                    if (getCurrentPage() == optionsPanel) {
                        group.setSelected(button.getModel(), true);
                    }
                }
            });
            optionsPanel.addPropertyChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    if (AbstractDialogPage.PROPERTY_PAGE_ENABLED.equals(evt.getPropertyName())) {
                        button.setEnabled(Boolean.TRUE.equals(evt.getNewValue()));
                    }
                    else if (AbstractDialogPage.ICON_PROPERTY.equals(evt.getPropertyName())) {
                        button.setIcon((Icon) evt.getNewValue());
                    }
                    else if (AbstractDialogPage.TITLE_PROPERTY.equals(evt.getPropertyName())) {
                        button.setText((String) evt.getNewValue());
                    }
                    else if (AbstractDialogPage.DESCRIPTION_PROPERTY.equals(evt.getPropertyName())) {
                        button.setToolTipText((String) evt.getNewValue());
                    }
                }
            });
            buttonsPanel.addButton(button);
            group.add(button);
            if (i == 0) {
                group.setSelected(button.getModel(), true);
            }
        }

        buttonsPanel.setOpaque(false);
        buttonsPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

        final JScrollPane pane = new JScrollPane(buttonsPanel) {
            @Override
            public Dimension getPreferredSize() {
                if (buttonsPanel.getAlignment() == SwingConstants.TOP || buttonsPanel.getAlignment() == SwingConstants.BOTTOM)
                    return new Dimension(buttonsPanel.getPreferredSize().width + getVerticalScrollBar().getPreferredSize().width, 5);
                else
                    return new Dimension(5, buttonsPanel.getPreferredSize().height + getHorizontalScrollBar().getPreferredSize().height);
            }

            @Override
            public Dimension getMinimumSize() {
                return getPreferredSize();
            }

        };
        pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

        buttonsPanel.setOpaque(false);

        _pageList.addListDataListener(new ListDataListener() {
            public void intervalAdded(ListDataEvent e) {
                for (int i = e.getIndex0(); i <= e.getIndex1(); i++) {
                    addPage(i, group, buttonsPanel);
                }
                buttonsPanel.invalidate();
                buttonsPanel.doLayout();
            }

            public void intervalRemoved(ListDataEvent e) {
                for (int i = e.getIndex1(); i >= e.getIndex0(); i--) {
                    AbstractButton button = (AbstractButton) buttonsPanel.getComponent(i);
                    buttonsPanel.remove(button);
                    group.remove(button);
                }
                buttonsPanel.invalidate();
                buttonsPanel.doLayout();
            }

            public void contentsChanged(ListDataEvent e) {
                if (e.getIndex0() == -1 && e.getIndex1() == -1 && e.getType() == ListDataEvent.CONTENTS_CHANGED) {
                    AbstractButton button = (AbstractButton) buttonsPanel.getButtonByName(_pageList.getCurrentPage().getTitle());
                    if (button != null) {
                        group.setSelected(button.getModel(), true);
                    }
                }
            }
        });
View Full Code Here

        return new ScrollableButtonPanel(SwingConstants.TOP, ButtonPanel.SAME_SIZE);
    }

    private JideButton addPage(int i, final ButtonGroup group, final ButtonPanel buttonsPanel) {
        AbstractDialogPage optionsPanel = _pageList.getPage(i);
        final JideButton button = createIconButton(optionsPanel.getTitle(), optionsPanel.getIcon());
        button.addActionListener(new AbstractAction(optionsPanel.getTitle(), optionsPanel.getIcon()) {
            public void actionPerformed(ActionEvent e) {
                group.setSelected(button.getModel(), true);
                setCurrentPage(_pageList.getPageByFullTitle(e.getActionCommand()), buttonsPanel);
            }
        });
        buttonsPanel.addButton(button, i);
        group.add(button);
View Full Code Here

     * @param title
     * @param icon
     * @return the button
     */
    protected JideButton createIconButton(String title, Icon icon) {
        final JideButton button = new JideButton(title, icon);
        button.setName(title);
        button.setHorizontalAlignment(SwingConstants.CENTER);
        button.setVerticalTextPosition(SwingConstants.BOTTOM);
        button.setHorizontalTextPosition(SwingConstants.CENTER);
        button.setRequestFocusEnabled(false);
        button.setFocusable(false);
        return button;
    }
View Full Code Here

        buttonsPanel.setButtonGap(0);

        final ButtonGroup group = new ButtonGroup();
        for (int i = 0; i < _pageList.getPageCount(); i++) {
            final AbstractDialogPage optionsPanel = _pageList.getPage(i);
            final JideButton button = createIconButton(optionsPanel.getTitle(), optionsPanel.getIcon());
            button.setToolTipText(optionsPanel.getDescription());
            button.setEnabled(optionsPanel.isPageEnabled());
            button.addActionListener(new AbstractAction() {
                private static final long serialVersionUID = 4451059166068761678L;

                public void actionPerformed(ActionEvent e) {
                    setCurrentPage(optionsPanel, buttonsPanel);
                    if (getCurrentPage() == optionsPanel) {
                        group.setSelected(button.getModel(), true);
                    }
                }
            });
            optionsPanel.addPropertyChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    if (AbstractDialogPage.PROPERTY_PAGE_ENABLED.equals(evt.getPropertyName())) {
                        button.setEnabled(Boolean.TRUE.equals(evt.getNewValue()));
                    }
                    else if (AbstractDialogPage.ICON_PROPERTY.equals(evt.getPropertyName())) {
                        button.setIcon((Icon) evt.getNewValue());
                    }
                    else if (AbstractDialogPage.TITLE_PROPERTY.equals(evt.getPropertyName())) {
                        button.setText((String) evt.getNewValue());
                    }
                    else if (AbstractDialogPage.DESCRIPTION_PROPERTY.equals(evt.getPropertyName())) {
                        button.setToolTipText((String) evt.getNewValue());
                    }
                }
            });
            buttonsPanel.addButton(button);
            group.add(button);
            if (_pageList.getPageCount() > 0) {
                if (getInitialPageTitle() != null && getInitialPageTitle().equals(optionsPanel.getFullTitle())) {
                    group.setSelected(button.getModel(), true);
                }
                else if (getInitialPageTitle() == null && i == 0) {
                    group.setSelected(button.getModel(), true);
                }
            }
        }

        buttonsPanel.setOpaque(false);
        buttonsPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

        final JScrollPane pane = new JScrollPane(buttonsPanel) {
            @Override
            public Dimension getPreferredSize() {
                if (buttonsPanel.getAlignment() == SwingConstants.TOP || buttonsPanel.getAlignment() == SwingConstants.BOTTOM)
                    return new Dimension(buttonsPanel.getPreferredSize().width + getVerticalScrollBar().getPreferredSize().width, 5);
                else
                    return new Dimension(5, buttonsPanel.getPreferredSize().height + getHorizontalScrollBar().getPreferredSize().height);
            }

            @Override
            public Dimension getMinimumSize() {
                return getPreferredSize();
            }
        };

        if (buttonsPanel.getAlignment() == SwingConstants.TOP || buttonsPanel.getAlignment() == SwingConstants.BOTTOM)
            pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        else
            pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);

        buttonsPanel.setOpaque(false);

        _pageList.addListDataListener(new ListDataListener() {
            public void intervalAdded(ListDataEvent e) {
                for (int i = e.getIndex0(); i <= e.getIndex1(); i++) {
                    addPage(i, group, buttonsPanel);
                }
                buttonsPanel.invalidate();
                buttonsPanel.doLayout();
            }

            public void intervalRemoved(ListDataEvent e) {
                for (int i = e.getIndex1(); i >= e.getIndex0(); i--) {
                    AbstractButton button = (AbstractButton) buttonsPanel.getComponent(i);
                    buttonsPanel.remove(button);
                    group.remove(button);
                }
                buttonsPanel.invalidate();
                buttonsPanel.doLayout();
            }

            public void contentsChanged(ListDataEvent e) {
                if (e.getIndex0() == -1 && e.getIndex1() == -1 && e.getType() == ListDataEvent.CONTENTS_CHANGED) {
                    AbstractButton button = (AbstractButton) buttonsPanel.getButtonByName(_pageList.getCurrentPage().getTitle());
                    if (button != null) {
                        group.setSelected(button.getModel(), true);
                    }
                }
            }
        });
View Full Code Here

        return new ScrollableButtonPanel(SwingConstants.TOP, ButtonPanel.SAME_SIZE);
    }

    private JideButton addPage(int i, final ButtonGroup group, final ButtonPanel buttonsPanel) {
        AbstractDialogPage optionsPanel = _pageList.getPage(i);
        final JideButton button = createIconButton(optionsPanel.getTitle(), optionsPanel.getIcon());
        button.addActionListener(new AbstractAction(optionsPanel.getTitle(), optionsPanel.getIcon()) {
            private static final long serialVersionUID = 5987367362274303556L;

            public void actionPerformed(ActionEvent e) {
                group.setSelected(button.getModel(), true);
                setCurrentPage(_pageList.getPageByFullTitle(e.getActionCommand()), buttonsPanel);
            }
        });
        buttonsPanel.addButton(button, i);
        group.add(button);
View Full Code Here

     * @param title the button title
     * @param icon  the button icon
     * @return the button
     */
    protected JideButton createIconButton(String title, Icon icon) {
        final JideButton button = new JideButton(title, icon);
        button.setName(title);
        button.setHorizontalAlignment(SwingConstants.CENTER);
        button.setVerticalTextPosition(SwingConstants.BOTTOM);
        button.setHorizontalTextPosition(SwingConstants.CENTER);
        button.setRequestFocusEnabled(false);
        button.setFocusable(false);
        return button;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jCheckBox1 = new javax.swing.JCheckBox();
        infoLinkButton = new JideButton();

        setMaximumSize(new java.awt.Dimension(32767, 26));
        setMinimumSize(new java.awt.Dimension(25, 25));
        setRequestFocusEnabled(false);
        setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 2, 0));
View Full Code Here

        booleanButtonGroup = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        itemComboBox = new javax.swing.JComboBox();
        comparisonOperatorComboBox = new javax.swing.JComboBox();
        valueTextField = new javax.swing.JTextField();
        moreButton = new JideButton();
        removeButton = new JideButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setMinimumSize(new java.awt.Dimension(530, 40));
        setPreferredSize(new java.awt.Dimension(700, 40));
        setRequestFocusEnabled(false);
View Full Code Here

        messageBox.setMinimumSize(new Dimension(135, 10));
        messageBox.setPreferredSize(new Dimension(135, 20));
        add(messageBox, JideBoxLayout.FIX);

        if (Globals.isDevelopment()) {
            cancelButton = new JideButton(IconFactory.getInstance().getIcon(IconFactory.IconID.CLOSE));
            cancelButton.setMinimumSize(new Dimension(20, 10));
            cancelButton.setPreferredSize(new Dimension(20, 20));
            cancelButton.setBorder(BorderFactory.createLineBorder(Color.black));
            add(cancelButton, JideBoxLayout.FIX);
        }
View Full Code Here

TOP

Related Classes of com.jidesoft.swing.JideButton

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.