Reputation: 715
how can I add a budge to that SideMenu Icon
mainToolbar.addComponentToSideMenu(avatarBox);
mainToolbar.addMaterialCommandToSideMenu(" Home", FontImage.MATERIAL_HOME, e -> {
ManagementDashboard mdas = new ManagementDashboard(this);
mdas.Home();
});
Upvotes: 2
Views: 104
Reputation: 1115
The questions is a bit vague and I am not sure that i understand what you are asking, but in my experience, the only way to customize the toolbar to do anything beyond what the out-of-the-box toolbars methods offer is to use setTitleComponent
and add your own custom container to your toolbar. The downside of this is that you will have to redesing a lot of your toolbars as you will be basically creating them again from scratch. You can center a new container with setTitleComponent
, override its calcPreferredSize
to stretch it across the entire toolbar horizontally, and stick stuff in it as you would in any Container (use any Layout, etc)
Another way of achieving your goal would be to extend the Toolbar class and manually change things within it. But the Toolbar class is quite heavy and you might spend much more time trying to figure out what to change than by using the first method
Method #1 sample code:
//stick stuff in this container to create your own toolbar
Container titleContainer = new Container(new BorderLayout()) {
@Override
protected Dimension calcPreferredSize() {
Dimension original = super.calcPreferredSize();
return new Dimension(Display.getInstance().getDisplayWidth(), original.getHeight());
}
};
form.getToolbar().setTitleComponent(titleContainer);
Here is an example of what could be achieved if you go this route (pretty much anything):
Upvotes: 2