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);
}
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());
}
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);
}
}
}
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);
}
}
}
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);
}
Aggregations