Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 4
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4065 times and has 3 replies Next Thread
Bluman
Newbie




Joined: Jan 29, 2011
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
confused 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?
[Jan 29, 2011, 3:54:02 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9426
Status: Offline
Reply to this Post  Reply with Quote 
Re: How do I add a new button to the toolbar in the Sweet Home 3D applet?

In the method createHomeController of the com.eteks.sweethome3d.applet.AppletApplication class, you should call:
toolBar.add(getToolBarAction(homeView, HomeView.ActionType.SPLIT_WALL));
at the place you want to insert the 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
[Jan 29, 2011, 5:18:06 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Bluman
Newbie




Joined: Jan 29, 2011
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
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?
[Jan 30, 2011, 1:54:37 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9426
Status: Offline
Reply to this Post  Reply with Quote 
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
[Jan 30, 2011, 7:04:43 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

  Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads  
© Copyright 2024 Space Mushrooms - All rights reserved