Joined: Jan 29, 2011
Post Count: 2
Status:
Offline
How do I add a new button to the toolbar in the Sweet Home 3D applet?
I have only partially figured out how I add a button to the toolbar in the applet. After a lot of work, I managed to add a button without functionality. This button was really supposed to split walls. It disappears when I press another button. How do I add a button permanently to the toolbar, and how do I add functionality to a button? By the way, how do I add an icon to such a button?
If you want to program a new button, implement a new Action and its actionPerformed method, then add the action to the toolbar. If you want to change its icon use the SMALL_ICON value of an action.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Jan 29, 2011
Post Count: 2
Status:
Offline
Re: How do I add a new button to the toolbar in the Sweet Home 3D applet?
Thanks a lot. Now I can create buttons with my own actions. But I still have the problem that the SPLIT_WALL button disappears. Is it because "HomeView.ActionType.SPLIT_WALL" has no action? How do I combine this enum entry with an action?
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: How do I add a new button to the toolbar in the Sweet Home 3D applet?
It's probably because you didn't define an icon for SPLIT_WALL action. Edit src/com/eteks/sweethome3d/swing/package.properties file and define in it the HomePane.SPLIT_WALL.SmallIcon property (look at other actions to guess how it works).
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator