/** * <b>refreshWindow()</b></br> <i>Updates window boundaries, sets the current panel, and turns the * Window visible. A general method used to update things pertaining to the Window that the * WindowManager cares for.</i></br> * * @version Slap 0.1 */ public void refreshWindow() { LOG.setSubSection("Refresh"); if (CURRENT_PANEL != null) { WINDOW.repaint(); LOG.log("Current panel exists. Setting up information."); if (CURRENT_PANEL.getTrackProgress() == true) { LOG.log("Progress tracking turned on, setting next panel."); setTrackProgress(true); setNextPanel(CURRENT_PANEL.getNextPanelName()); } else { LOG.log("Progress tracking turned off."); setTrackProgress(false); } LOG.log("Setting current panel."); WINDOW.setCurrentPanel(CURRENT_PANEL); if (BOUND_HEIGHT != WINDOW.getBoundLength() || BOUND_WIDTH != WINDOW.getBoundWidth()) { LOG.log("Forcing window visiblity to false to update boundaries."); WINDOW.setVisible(false); LOG.log("Updating boundaries."); WINDOW.setBoundaries(BOUND_HEIGHT, BOUND_WIDTH); try { SwingUtilities.invokeAndWait( new Runnable() { @Override public void run() { WINDOW.updateBoundaries(); } }); } catch (Exception ex) { ex.printStackTrace(); } } LOG.log("Applying window attributes."); WINDOW.setTitle(TITLE); LOG.log("Forcing window visibility to true."); WINDOW.setVisible(true); LOG.log("Forcing window to move to centered position."); WINDOW.setLocationRelativeTo(null); LOG.log("Repainting window."); WINDOW.repaint(); } else { LOG.log("No current panel, window cannot be refreshed."); } LOG.useSubSection(false); }
public void center() { boundaryPanel.clear(); int left = (Window.getClientWidth() - windowPanel.getOffsetWidth()) >> 1; int top = (Window.getClientHeight() - windowPanel.getOffsetHeight()) >> 1; boundaryPanel.add(windowPanel, Window.getScrollLeft() + left, Window.getScrollTop() + top); left = (Window.getClientWidth() - windowPanel.getOffsetWidth()) >> 1; top = (Window.getClientHeight() - windowPanel.getOffsetHeight()) >> 1; boundaryPanel.clear(); boundaryPanel.add(windowPanel, Window.getScrollLeft() + left, Window.getScrollTop() + top); // hide <embeds> FrameUtils.toggleEmbedVisibility(false); }
public void setPixelSize(int width, int height) { windowPanel.setPixelSize(width, height); }
public void setTitle(String title) { windowPanel.setTitle(title); }
public void setText(String text) { windowPanel.setText(text); }