/** * Pops view, resuming and returning the next view in stack * * @return next view */ public static View popView() { View popped = viewStack.pop(); popped.deinitialize(); View view = viewStack.peek(); view.resume(); calendar.setContentPane((Container) view); calendar.pack(); Utils.centerOnScreen(calendar); if (view.shouldBeFullscreen()) { calendar.setExtendedState(Frame.MAXIMIZED_BOTH); } return view; }
/** * Pushes view on {@link #viewStack}, displays and returns view afterwards. * * @param view * @return topmost view * @see no.ntnu.fp.Client#viewStack */ public static View pushView(View view) { view.initialize(); calendar.setContentPane((Container) view); if (viewStack.size() > 0) { viewStack.peek().pause(); } viewStack.push(view); calendar.repaint(); calendar.pack(); Utils.centerOnScreen(calendar); if (view.shouldBeFullscreen()) { calendar.setExtendedState(Frame.MAXIMIZED_BOTH); } return view; }