Search in sources :

Example 21 with ButtonModel

use of javax.swing.ButtonModel in project knime-core by knime.

the class AdvancedPanel method saveValuesFromPanelInto.

/**
 * Writes the current values from the components into the settings object.
 *
 * @param settings the object to write the values into
 */
void saveValuesFromPanelInto(final FileWriterSettings settings) {
    // support \t and \n
    String colSep = m_colSeparator.getText();
    colSep = FileWriterSettings.unescapeString(colSep);
    settings.setColSeparator(colSep);
    settings.setMissValuePattern(m_missValuePattern.getText());
    ButtonModel lf = m_bGroup.getSelection();
    LineEnding mode;
    if (lf == m_defEnding) {
        mode = LineEnding.SYST;
    } else if (lf == m_lfEnding) {
        mode = LineEnding.LF;
    } else if (lf == m_crlfEnding) {
        mode = LineEnding.CRLF;
    } else if (lf == m_crEnding) {
        mode = LineEnding.CR;
    } else {
        mode = LineEnding.SYST;
    }
    settings.setLineEndingMode(mode);
}
Also used : LineEnding(org.knime.base.node.io.csvwriter.FileWriterSettings.LineEnding) ButtonModel(javax.swing.ButtonModel)

Example 22 with ButtonModel

use of javax.swing.ButtonModel in project freeplane by freeplane.

the class ButtonModelStateChangeListenerForProperty method stateChanged.

@Override
public void stateChanged(ChangeEvent e) {
    ButtonModel buttonModel = (ButtonModel) e.getSource();
    ResourceController.getResourceController().setProperty(propertyName, buttonModel.isSelected());
}
Also used : ButtonModel(javax.swing.ButtonModel)

Example 23 with ButtonModel

use of javax.swing.ButtonModel in project blue by kunstmusik.

the class BlueButtonBorder method paintBorder.

/**
 * Draws a simple 3d border for the given component.
 *
 * @param c
 *            The component to draw its border.
 * @param g
 *            The graphics context.
 * @param x
 *            The x coordinate of the top left corner.
 * @param y
 *            The y coordinate of the top left corner.
 * @param w
 *            The width.
 * @param h
 *            The height.
 */
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
    if (c instanceof JToggleButton) {
        JToggleButton button = (JToggleButton) c;
        ButtonModel model = button.getModel();
        // Optimizations are welcome here!
        if (model.isEnabled()) {
            if (model.isPressed() && model.isArmed()) {
                BlueBorderUtilities.drawPressed3DBorder(g, x, y, w, h);
            } else {
                // } else {
                if (button.isRolloverEnabled()) {
                    if (model.isRollover()) {
                        BlueBorderUtilities.drawSimple3DBorder(g, x, y, w, h);
                    }
                } else {
                    BlueBorderUtilities.drawSimple3DBorder(g, x, y, w, h);
                }
            // }
            }
        } else {
            if (!button.isRolloverEnabled()) {
                BlueBorderUtilities.drawDisabledBorder(g, x, y, w - 1, h - 1);
            }
        }
        return;
    }
    JButton button = (JButton) c;
    ButtonModel model = ((JButton) c).getModel();
    // Optimizations are welcome here!
    if (model.isEnabled()) {
        if (model.isPressed() && model.isArmed()) {
            BlueBorderUtilities.drawPressed3DBorder(g, x, y, w, h);
        } else {
            if (button.isDefaultButton()) {
                BlueBorderUtilities.drawDefaultButtonBorder(g, x, y, w, h);
            } else {
                if (button.isRolloverEnabled()) {
                    if (model.isRollover()) {
                        BlueBorderUtilities.drawSimple3DBorder(g, x, y, w, h);
                    }
                } else {
                    BlueBorderUtilities.drawSimple3DBorder(g, x, y, w, h);
                }
            }
        }
    } else {
        if (!button.isRolloverEnabled()) {
            BlueBorderUtilities.drawDisabledBorder(g, x, y, w - 1, h - 1);
        }
    }
}
Also used : JToggleButton(javax.swing.JToggleButton) JButton(javax.swing.JButton) ButtonModel(javax.swing.ButtonModel)

Example 24 with ButtonModel

use of javax.swing.ButtonModel in project blue by kunstmusik.

the class BlueToggleButtonBorder method paintBorder.

/**
 * Draws a simple 3d border for the given component.
 *
 * @param c
 *            The component to draw its border.
 * @param g
 *            The graphics context.
 * @param x
 *            The x coordinate of the top left corner.
 * @param y
 *            The y coordinate of the top left corner.
 * @param w
 *            The width.
 * @param h
 *            The height.
 */
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
    JToggleButton button = (JToggleButton) c;
    ButtonModel model = button.getModel();
    // Optimizations are welcome here!
    if (model.isEnabled()) {
        if (model.isPressed() && model.isArmed()) {
            BlueBorderUtilities.drawPressed3DBorder(g, x, y, w, h);
        } else {
            // {
            if (button.isRolloverEnabled()) {
                if (model.isRollover()) {
                    BlueBorderUtilities.drawSimple3DBorder(g, x, y, w, h);
                }
            } else {
                BlueBorderUtilities.drawSimple3DBorder(g, x, y, w, h);
            }
        // }
        }
        if (button.isSelected()) {
            BlueBorderUtilities.drawPressed3DBorder(g, x, y, w, h);
        }
    } else {
        if (!button.isRolloverEnabled()) {
            BlueBorderUtilities.drawDisabledBorder(g, x, y, w - 1, h - 1);
        }
    }
}
Also used : JToggleButton(javax.swing.JToggleButton) ButtonModel(javax.swing.ButtonModel)

Example 25 with ButtonModel

use of javax.swing.ButtonModel in project kindergarten by clear-group-ausbildung.

the class AbstractToolBarButton method getCurrentColor.

private Color getCurrentColor() {
    ButtonModel m = getModel();
    String foregroundKey = m.isEnabled() ? "ToolBarButton.foreground" : "ToolBarButton.disabledForeground";
    return RESOURCES.getColor(foregroundKey);
}
Also used : ButtonModel(javax.swing.ButtonModel)

Aggregations

ButtonModel (javax.swing.ButtonModel)35 AbstractButton (javax.swing.AbstractButton)12 JToggleButton (javax.swing.JToggleButton)6 BorderLayout (java.awt.BorderLayout)3 Dimension (java.awt.Dimension)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ButtonGroup (javax.swing.ButtonGroup)3 DefaultListModel (javax.swing.DefaultListModel)3 JButton (javax.swing.JButton)3 JLabel (javax.swing.JLabel)2 JMenu (javax.swing.JMenu)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 DictionaryQueryResults (cbit.vcell.dictionary.DictionaryQueryResults)1 DBFormalSpecies (cbit.vcell.model.DBFormalSpecies)1 AerospikeException (com.aerospike.client.AerospikeException)1 Algorithm (edu.cmu.tetrad.algcomparison.algorithm.Algorithm)1 AlgorithmFactory (edu.cmu.tetrad.algcomparison.algorithm.AlgorithmFactory)1 TsImages (edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.TsImages)1