Reputation: 1588
I have this code this is very basic and it's used to close all tabs in a TabPane.
MenuItem item4 = new MenuItem("Close All Tabs");
item4.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
System.out.println("Close All Tabs");
int ee = tabPane.getTabs().size();
tabPane.getTabs().remove(0, ee);
}
});
I want to optimize this part of the code:
int ee = tabPane.getTabs().size();
tabPane.getTabs().remove(0, ee);
Is there any other clear and optimized solution?
Upvotes: 1
Views: 2396