JToolBar editor....
With all the talk of inserting joe-random subclass of widget in the GUI
designer, I was just looking at some code I wrote just now.
Currently theres no JToolBar listed on the tool palette, so I've added a
JPanel placeholder and in my bound classes constructor I have the
following:
private JToolBar toolBar;
private Action searchForPackageAction = new SearchForPackageAction();
public MainForm() {
toolBar = new JToolBar();
toolBar.add( searchForPackageAction );
toolBarPanel.add( toolBar );
getContentPane().add( mainPanel );
}
Here I have an AbstractAction subclass in my project, which I'm inserting
into the toolbar, which may also be used in a menu.
What this wants to be in the GUI designer, is the ability to put a
JToolBar onto the form at layout time, and add any Action ( or subclass )
declared class-level in the bound class.
This could then also be re-used in a menu designer.
Thoughts?
请先登录再写评论。