Is there any way to group objects in Java core SE ?
Like i have multiple JButtons, JLabels and other objects and i want to set the visibility of them to false and enable using a function.
Can i group these Java objects as a single unit so that i do not have to write each component.setVisiiblity(true) like this.
For further example i have something like this:
private void hideDashboard() {
someButton1.setVisible(false);
someButton2.setVisible(false);
someButton3.setVisible(false);
someButton4.setVisible(false);
someLabel.setVisible(false);
}
I am not using any external packages. For IDE i am using Netbeans 8.2
One option would be to store them in a Collection since they're all JComponent objects.