diff options
author | Mark Wielaard <mark@klomp.org> | 2004-09-04 20:31:20 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2004-09-04 20:31:20 +0000 |
commit | 21388732aa378c306ed7848ebacf120338a5dabf (patch) | |
tree | 5175bc521c1b76be2b43d97c87c75b91e3e6a50b /javax/swing/ButtonGroup.java | |
parent | 43fefa1e7020a3f9eb4abae77ab2e9610fad30c7 (diff) | |
download | classpath-21388732aa378c306ed7848ebacf120338a5dabf.tar.gz |
2004-09-04 Mark Wielaard <mark@klomp.org>
* examples/gnu/classpath/examples/swing/Demo.java (mkColorChooser):
New method.
2004-09-04 Graydon Hoare <graydon@redhat.com>
* javax/swing/JColorChooser.java:
Make a couple inner classes static, for jikes.
2004-09-04 Kim Ho <kho@redhat.com>
* java/awt/Color.java: Fix documentation.
(RGBtoHSB): Use floats for conversions.
* javax/swing/ButtonGroup.java: Run Jalopy.
(setSelected): Reimplement.
* javax/swing/DefaultButtonModel.java: Run Jalopy.
(changeState): Let ButtonGroup know that the button
is changing state.
* javax/swing/JColorChooser.java: Implement.
* javax/swing/JLabel.java: Run Jalopy.
* javax/swing/JSpinner.java: Run Jalopy.
(setValue): New method.
* javax/swing/JTabbedPane.java: Run Jalopy.
(removeTabAt): Call correct remove method.
* javax/swing/SpinnerNumberModel.java: Run Jalopy.
(getPreviousValue): Compare minimum value.
* javax/swing/Timer.java: Run Jalopy.
(run): Comment out println.
* javax/swing/ToolTipManager.java:
(mouseMoved): Get new tooltip text for location.
* javax/swing/colorchooser/AbstractColorChooserPanel.java:
Jalopy and Javadoc.
* javax/swing/colorchooser/ColorChooserComponentFactory.java:
Implement.
* javax/swing/colorchooser/DefaultColorSelectionModel.java:
Run Jalopy.
(setSelectedColor): Fire ChangeEvent.
* javax/swing/colorchooser/DefaultHSBChooserPanel.java:
New file. Implement.
* javax/swing/colorchooser/DefaultPreviewPanel.java:
Ditto.
* javax/swing/colorchooser/DefaultRGBChooserPanel.java:
Ditto.
* javax/swing/colorchooser/DefaultSwatchChooserPanel.java:
Ditto.
* javax/swing/plaf/basic/BasicArrowButton.java:
(getArrow): Fix size of upward pointing button.
* javax/swing/plaf/basic/BasicColorChooserUI.java:
Implement.
* javax/swing/plaf/basic/BasicSliderUI.java:
(getWidthOfWidestLabel): Use preferred dimensions.
(getHeightOfTallestLabel): Ditto.
* javax/swing/plaf/basic/BasicSpinnerUI.java:
Run Jalopy.
(mousePressed): Disable changes to spinner if it is not enabled.
Diffstat (limited to 'javax/swing/ButtonGroup.java')
-rw-r--r-- | javax/swing/ButtonGroup.java | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/javax/swing/ButtonGroup.java b/javax/swing/ButtonGroup.java index 8202fa6cb..5f6a28d86 100644 --- a/javax/swing/ButtonGroup.java +++ b/javax/swing/ButtonGroup.java @@ -42,19 +42,18 @@ import java.util.Enumeration; import java.util.Vector; -public class ButtonGroup - implements Serializable +/** + * DOCUMENT ME! + */ +public class ButtonGroup implements Serializable { + /** DOCUMENT ME! */ private static final long serialVersionUID = 4259076101881721375L; - /** - * The buttons added to this button group. - */ + /** The buttons added to this button group. */ protected Vector buttons = new Vector(); - /** - * The currently selected button model. - */ + /** The currently selected button model. */ ButtonModel sel; /** @@ -99,17 +98,24 @@ public class ButtonGroup /** * Returns the currently selected button model. * - * @return the currently selected button model, - * null if none was selected yet + * @return the currently selected button model, null if none was selected + * yet */ public ButtonModel getSelection() { return sel; } + /** + * DOCUMENT ME! + * + * @param m DOCUMENT ME! + * + * @return DOCUMENT ME! + */ AbstractButton FindButton(ButtonModel m) { - for (int i = 0;i < buttons.size(); i++) + for (int i = 0; i < buttons.size(); i++) { AbstractButton a = (AbstractButton) buttons.get(i); if (a.getModel() == m) @@ -119,46 +125,40 @@ public class ButtonGroup } /** - * Sets the currently selected button model. Only one button of a group - * can be selected at a time. + * Sets the currently selected button model. Only one button of a group can + * be selected at a time. * * @param m the model to select * @param b true if this button is to be selected, false otherwise */ public void setSelected(ButtonModel m, boolean b) { - if ((m == sel) && (b == true)) - { - // clicked on same item twice. - System.out.println("PRESSED TWICE:" + m + ", sel=" + sel); - return; - } + if ((sel != m || b) && (! b || sel == m)) + return; - if (sel != null) + if (b && sel != m) { - System.out.println("DESELECTING: " + sel); - sel.setSelected(! b); - - AbstractButton but = FindButton(sel); - if (but != null) - { - System.out.println("REPAINT-REQUEST: " + but.text); - //but.revalidate(); - but.repaint(); - } + ButtonModel old = sel; + sel = m; + + if (old != null) + old.setSelected(false); + AbstractButton button = FindButton(old); + if (button != null) + button.repaint(); } - else - System.out.println("NO SELECTION YET"); - - sel = m; + else if (! b && sel == m) + m.setSelected(true); } /** - * Checks if the given <code>ButtonModel</code> is selected - * in this button group. + * Checks if the given <code>ButtonModel</code> is selected in this button + * group. + * + * @param m DOCUMENT ME! * - * @return true of given <code>ButtonModel</code> is selected, - * false otherwise + * @return true of given <code>ButtonModel</code> is selected, false + * otherwise */ public boolean isSelected(ButtonModel m) { |