I am trying to maximize JFrame from within JMenuBar, I can not pass a reference to the frame. Is it possible to get a reference to the frame that it is used in?
i can get to the top level component but it does not have a way to maximize and minimize frame.
public Container getApplicationFrame(ActionEvent event){
JMenuItem menuItem = (JMenuItem) event.getSource();
JPopupMenu popupMenu = (JPopupMenu) menuItem.getParent();
Component invoker = popupMenu.getInvoker();
JComponent invokerAsJComponent = (JComponent) invoker;
Container topLevel = invokerAsJComponent.getTopLevelAncestor();
return topLevel;
}