I’ve read the Java trail oracle provides and they said that the objects properties are set to match the actions properties. I would like to know if this is a limited set of properties that is shared, or if the Action is casted to the same class as the object you are setting the action to.
Another question I have is such… is it possible to set the Action to have the same properties as the Component that I’m setting it to so that it doesn’t reset everything? The only work around that I can think of is either setting the action for the object before doing anything with the object, or passing the object through the actions methods or constructor and setting all the values you want at that point. I was hoping however I could set the actions at a later time in the program without disturbing anything, it be more convenient.
Example …
JMenuItem myItem = new JMenuItem("someText");
myItem.setAction(myAction);// Clears the text from my menu item which is the problem
Thanks
Me:
You:
Solution:
Also you can set the button’s text via the Action’s NAME property: