Bug 23033 - Swing: ActionCommand and paramString broken in most buttions, with fix
Summary: Swing: ActionCommand and paramString broken in most buttions, with fix
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-08 14:57 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2005-07-08 14:57:35 UTC
Most classes that are childs of AbstractButton(or are childs of a child...) implement the fonction paramString wrong.
They implement it like this:
  protected  String paramString()
  {
    return "NameOfClass";
  }

but they should implement it like this:

  protected  String paramString()
  {
    return super.paramString();
  }

and also the ActionCommand is wrong for nearly every Button.
They need a setActionCommand(text);
Put it in the init() if there is one, and if there is none, put it in the constructor.
Take care that sometimes, a class like JRadioButton calls the constructor of JToggleButton where we already have a setActionCommand(text); (at least there should be one if the fix of my other bugreport is applied), so there is no need for anoterh setActionCommand(text); in JRadioButton.
Comment 1 from-classpath 2005-07-13 00:27:18 UTC
Although the current implementation of paramString() is working correct according to the spec(
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JCheckBox.html#paramString()
and http://developer.classpath.org/doc/javax/swing/JCheckBox.html#paramString())

I agree that "JCheckBox" is not of much use for practical debugging sessions. The patch I committed fixes the issue in JToggleButton, JButton and JCheckBox. For the last two I added more property information to them.
Comment 2 from-classpath 2005-07-13 01:05:16 UTC
I discuss the remaining problem in bug #13691 and close it because the paramString() issue is solved now.