Search in sources :

Example 46 with JToggleButton

use of javax.swing.JToggleButton in project jabref by JabRef.

the class JabRefFrame method createToolBar.

private void createToolBar() {
    tlb.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    tlb.setBorder(null);
    tlb.setRollover(true);
    tlb.setFloatable(false);
    if (Globals.prefs.getBoolean(JabRefPreferences.BIBLATEX_DEFAULT_MODE)) {
        tlb.addAction(newBiblatexDatabaseAction);
    } else {
        tlb.addAction(newBibtexDatabaseAction);
    }
    tlb.addAction(getOpenDatabaseAction());
    tlb.addAction(save);
    tlb.addAction(saveAll);
    tlb.addSeparator();
    tlb.addAction(cut);
    tlb.addAction(copy);
    tlb.addAction(paste);
    tlb.addAction(undo);
    tlb.addAction(redo);
    tlb.addSeparator();
    tlb.addAction(getBackAction());
    tlb.addAction(getForwardAction());
    tlb.addSeparator();
    tlb.addAction(newEntryAction);
    tlb.addAction(editEntry);
    tlb.addAction(editStrings);
    tlb.addAction(deleteEntry);
    tlb.addSeparator();
    tlb.addAction(makeKeyAction);
    tlb.addAction(cleanupEntries);
    tlb.addAction(mergeEntries);
    tlb.addAction(pullChangesFromSharedDatabase);
    tlb.addAction(openConsole);
    tlb.addSeparator();
    tlb.addAction(mark);
    tlb.addAction(unmark);
    if (Globals.prefs.getBoolean(JabRefPreferences.SPECIALFIELDSENABLED)) {
        if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_RANKING)) {
            JButton button = SpecialFieldDropDown.generateSpecialFieldButtonWithDropDown(SpecialField.RANKING, this);
            tlb.add(button);
            specialFieldButtons.add(button);
        }
        if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_RELEVANCE)) {
            tlb.addAction(toggleRelevance);
        }
        if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_QUALITY)) {
            tlb.addAction(toggleQualityAssured);
        }
        if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_PRIORITY)) {
            JButton button = SpecialFieldDropDown.generateSpecialFieldButtonWithDropDown(SpecialField.PRIORITY, this);
            tlb.add(button);
            specialFieldButtons.add(button);
        }
        if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_PRINTED)) {
            tlb.addAction(togglePrinted);
        }
        if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_READ)) {
            JButton button = SpecialFieldDropDown.generateSpecialFieldButtonWithDropDown(SpecialField.READ_STATUS, this);
            tlb.add(button);
            specialFieldButtons.add(button);
        }
    }
    tlb.addSeparator();
    tlb.addJToggleButton(new JToggleButton(generalFetcher.getToggleAction()));
    previewToggle = new JToggleButton(togglePreview);
    tlb.addJToggleButton(previewToggle);
    tlb.addJToggleButton(new JToggleButton(groupSidePane.getToggleAction()));
    tlb.addSeparator();
    tlb.add(pushExternalButton.getComponent());
    tlb.addSeparator();
    tlb.add(donationAction);
    tlb.add(forkMeOnGitHubAction);
    createDisabledIconsForButtons(tlb);
}
Also used : JToggleButton(javax.swing.JToggleButton) JButton(javax.swing.JButton)

Example 47 with JToggleButton

use of javax.swing.JToggleButton in project JMRI by JMRI.

the class IconAdder method getDefaultIconNodeFromMap.

private CatalogTreeNode getDefaultIconNodeFromMap() {
    if (log.isDebugEnabled()) {
        log.debug("getDefaultIconNodeFromMap for node= " + _type + ", _order.size()= " + _order.size());
    }
    _defaultIcons = new CatalogTreeNode(_type);
    Iterator<Entry<String, JToggleButton>> it = _iconMap.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, JToggleButton> e = it.next();
        NamedIcon icon = (NamedIcon) e.getValue().getIcon();
        _defaultIcons.addLeaf(new CatalogTreeLeaf(e.getKey(), icon.getURL(), _order.indexOf(e.getKey())));
    }
    return _defaultIcons;
}
Also used : Entry(java.util.Map.Entry) NamedIcon(jmri.jmrit.catalog.NamedIcon) CatalogTreeLeaf(jmri.jmrit.catalog.CatalogTreeLeaf) JToggleButton(javax.swing.JToggleButton) CatalogTreeNode(jmri.jmrit.catalog.CatalogTreeNode)

Example 48 with JToggleButton

use of javax.swing.JToggleButton in project JMRI by JMRI.

the class IconAdder method getIconMap.

/**
     * Returns a new Hashtable of only the icons selected for display.
     *
     * @return a map of icons using the icon labels as keys
     */
public Hashtable<String, NamedIcon> getIconMap() {
    log.debug("getIconMap: _allowDeletes= {}", _allowDeletes);
    Hashtable<String, NamedIcon> iconMap = new Hashtable<>();
    Iterator<String> iter = _iconMap.keySet().iterator();
    while (iter.hasNext()) {
        String key = iter.next();
        JToggleButton button = _iconMap.get(key);
        if (log.isDebugEnabled()) {
            log.debug("getIconMap: key= " + key + ", button.isSelected()= " + button.isSelected());
        }
        if (!_allowDeletes || !button.isSelected()) {
            iconMap.put(key, new NamedIcon((NamedIcon) button.getIcon()));
        }
    }
    return iconMap;
}
Also used : NamedIcon(jmri.jmrit.catalog.NamedIcon) JToggleButton(javax.swing.JToggleButton) Hashtable(java.util.Hashtable)

Example 49 with JToggleButton

use of javax.swing.JToggleButton in project JMRI by JMRI.

the class VSDManagerFrame method muteButtonPressed.

/**
     * Handle "Mute" button press
     */
protected void muteButtonPressed(ActionEvent e) {
    JToggleButton b = (JToggleButton) e.getSource();
    log.debug("Mute button pressed. value = " + b.isSelected());
    firePropertyChange(PropertyChangeID.MUTE, !b.isSelected(), b.isSelected());
}
Also used : JToggleButton(javax.swing.JToggleButton)

Example 50 with JToggleButton

use of javax.swing.JToggleButton in project JMRI by JMRI.

the class EditCircuitPaths method makeContentPanel.

private JPanel makeContentPanel() {
    JPanel pathPanel = new JPanel();
    pathPanel.setLayout(new BoxLayout(pathPanel, BoxLayout.Y_AXIS));
    pathPanel.add(Box.createVerticalStrut(STRUT_SIZE));
    JPanel panel = new JPanel();
    panel.add(new JLabel(Bundle.getMessage("PathTitle", _block.getDisplayName())));
    pathPanel.add(panel);
    _pathListModel = new PathListModel();
    _pathList = new JList<OPath>();
    _pathList.setModel(_pathListModel);
    _pathList.addListSelectionListener(this);
    _pathList.setCellRenderer(new PathCellRenderer());
    JScrollPane pane = new JScrollPane(_pathList);
    pathPanel.add(pane);
    pathPanel.add(Box.createVerticalStrut(STRUT_SIZE));
    panel = new JPanel();
    panel.setLayout(new FlowLayout());
    JButton clearButton = new JButton(Bundle.getMessage("buttonClearSelection"));
    clearButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            clearListSelection();
        }
    });
    clearButton.setToolTipText(Bundle.getMessage("ToolTipClearList"));
    panel.add(clearButton);
    pathPanel.add(panel);
    pathPanel.add(Box.createVerticalStrut(STRUT_SIZE));
    panel = new JPanel();
    panel.add(CircuitBuilder.makeTextBoxPanel(false, _pathName, "pathName", true, "TooltipPathName"));
    _pathName.setPreferredSize(new Dimension(300, _pathName.getPreferredSize().height));
    pathPanel.add(panel);
    panel = new JPanel();
    JButton addButton = new JButton(Bundle.getMessage("buttonAddPath"));
    addButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            addPath();
        }
    });
    addButton.setToolTipText(Bundle.getMessage("ToolTipAddPath"));
    panel.add(addButton);
    JButton changeButton = new JButton(Bundle.getMessage("buttonChangeName"));
    changeButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            changePathName();
        }
    });
    changeButton.setToolTipText(Bundle.getMessage("ToolTipChangeName"));
    panel.add(changeButton);
    JButton deleteButton = new JButton(Bundle.getMessage("buttonDeletePath"));
    deleteButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            deletePath();
        }
    });
    deleteButton.setToolTipText(Bundle.getMessage("ToolTipDeletePath"));
    panel.add(deleteButton);
    pathPanel.add(panel);
    pathPanel.add(Box.createVerticalStrut(STRUT_SIZE));
    JPanel pp = new JPanel();
    //      pp.setLayout(new BoxLayout(pp, BoxLayout.X_AXIS));
    _length.setText("0.0");
    pp.add(CircuitBuilder.makeTextBoxPanel(false, _length, "Length", true, "TooltipPathLength"));
    _length.setPreferredSize(new Dimension(100, _length.getPreferredSize().height));
    _length.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            _pathChange = true;
        }
    });
    _units = new JToggleButton("", !_block.isMetric());
    _units.setToolTipText(Bundle.getMessage("TooltipPathUnitButton"));
    _units.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            changeUnits();
        }
    });
    pp.add(_units);
    pathPanel.add(pp);
    pathPanel.add(Box.createVerticalStrut(STRUT_SIZE));
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    JLabel l = new JLabel(Bundle.getMessage("enterNewPath"));
    l.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    panel.add(l);
    l = new JLabel(Bundle.getMessage("selectPathIcons"));
    l.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    panel.add(l);
    l = new JLabel(Bundle.getMessage("pressAddButton", Bundle.getMessage("buttonAddPath")));
    l.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    panel.add(l);
    panel.add(Box.createVerticalStrut(STRUT_SIZE / 2));
    l = new JLabel(Bundle.getMessage("selectPath"));
    l.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    panel.add(l);
    l = new JLabel(Bundle.getMessage("editPathIcons"));
    l.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    panel.add(l);
    panel.add(Box.createVerticalStrut(STRUT_SIZE / 2));
    l = new JLabel(Bundle.getMessage("throwPathTO"));
    l.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    panel.add(l);
    l = new JLabel(Bundle.getMessage("holdShiftDown"));
    l.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    panel.add(l);
    JPanel p = new JPanel();
    p.add(panel);
    pathPanel.add(p);
    pathPanel.add(Box.createVerticalStrut(STRUT_SIZE));
    pathPanel.add(MakeButtonPanel());
    changeUnits();
    return pathPanel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) OPath(jmri.jmrit.logix.OPath) Dimension(java.awt.Dimension) ActionListener(java.awt.event.ActionListener) JToggleButton(javax.swing.JToggleButton)

Aggregations

JToggleButton (javax.swing.JToggleButton)59 ActionEvent (java.awt.event.ActionEvent)21 ActionListener (java.awt.event.ActionListener)21 ImageIcon (javax.swing.ImageIcon)20 JPanel (javax.swing.JPanel)19 JLabel (javax.swing.JLabel)16 Dimension (java.awt.Dimension)14 JButton (javax.swing.JButton)13 Insets (java.awt.Insets)11 JScrollPane (javax.swing.JScrollPane)8 ChangeEvent (javax.swing.event.ChangeEvent)8 ChangeListener (javax.swing.event.ChangeListener)8 GridBagLayout (java.awt.GridBagLayout)7 BoxLayout (javax.swing.BoxLayout)7 GridBagConstraints (java.awt.GridBagConstraints)6 JCheckBox (javax.swing.JCheckBox)6 JSlider (javax.swing.JSlider)6 JTabbedPane (javax.swing.JTabbedPane)6 Component (java.awt.Component)5 GridLayout (java.awt.GridLayout)5