Example usage for java.awt Frame MAXIMIZED_BOTH

List of usage examples for java.awt Frame MAXIMIZED_BOTH

Introduction

In this page you can find the example usage for java.awt Frame MAXIMIZED_BOTH.

Prototype

int MAXIMIZED_BOTH

To view the source code for java.awt Frame MAXIMIZED_BOTH.

Click Source Link

Document

This state bit mask indicates that frame is fully maximized (that is both horizontally and vertically).

Usage

From source file:GUI.ListOfOffres1.java

static void openListOfOffresFrame() throws IOException {

    new SwingWorker<Void, Void>() {
        @Override//www. j  a va  2s  .  c  o m
        protected Void doInBackground() throws Exception {

            // do some processing here while the progress bar is running
            f.setSize(500, 500);
            f.setLocation(300, 200);
            f.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
            f.setLayout(new GridLayout(1, 1, 5, 5));
            try {
                f3.add(createListOfOffresPanel(0, "", 0));
                f.add(f3);
            } catch (IOException ex) {
                Logger.getLogger(ListOfOffres1.class.getName()).log(Level.SEVERE, null, ex);
            }

            return null;
        }

        // this is called when doInBackground finished
        @Override
        protected void done() {
            //Background processing done
            //Crate new Frale and confagurated
            ListOfOffresFrame = new JFrame();
            ListOfOffresFrame.setMaximizedBounds(null);
            ListOfOffresFrame.setMinimumSize(new Dimension(300, 400));
            ListOfOffresFrame.setTitle("Offre");
            ListOfOffresFrame.setLayout(new GridLayout(1, 1, 20, 20));
            Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
            ListOfOffresFrame.setLocation((dim.height / 2) + 150, 150);
            ListOfOffresFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            ListOfOffresFrame.add(f);
            ListOfOffresFrame.setPreferredSize(dim);
            ListOfOffresFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
            ListOfOffresFrame.setVisible(true);
            prog.setVisible(false);
        }
    }.execute();
}

From source file:com.qspin.qtaste.ui.MainPanel.java

public void genUI() {
    try {/*from w  ww . ja  va2 s .c o  m*/
        getContentPane().setLayout(new BorderLayout());
        // prepare the top panel that contains the following panes:
        //   - logo
        //   - ConfigInfopanel
        //   - Current Date/time
        JPanel topanel = new JPanel(new BorderLayout());
        JPanel center = new JPanel(new GridBagLayout());
        ImageIcon topLeftLogo = ResourceManager.getInstance().getImageIcon("main/qspin");
        JLabel iconlabel = new JLabel(topLeftLogo);

        mHeaderPanel = new ConfigInfoPanel(this);
        mTestCasePanel = new TestCasePane(this);
        mTestCampaignPanel = new TestCampaignMainPanel(this);

        mHeaderPanel.init();

        GridBagLineAdder centeradder = new GridBagLineAdder(center);
        JLabel sep = new JLabel("  ");
        sep.setFont(ResourceManager.getInstance().getSmallFont());
        sep.setUI(new FillLabelUI(ResourceManager.getInstance().getLightColor()));
        centeradder.setWeight(1.0f, 0.0f);
        centeradder.add(mHeaderPanel);

        // prepare the right panels containg the main information:
        // the right pane is selected through the tabbed pane:
        //    - Test cases: management of test cases and test suites
        //    - Test campaign: management of test campaigns
        //    - Interactive: ability to invoke QTaste verbs one by one

        mRightPanels = new JPanel(new CardLayout());

        mRightPanels.add(mTestCasePanel, "Test Cases");
        mRightPanels.add(mTestCampaignPanel, "Test Campaign");

        final TestCaseInteractivePanel testInterractivePanel = new TestCaseInteractivePanel();
        mRightPanels.add(testInterractivePanel, "Interactive");

        mTreeTabsPanel = new JTabbedPane(JTabbedPane.BOTTOM);
        mTreeTabsPanel.setPreferredSize(new Dimension(TREE_TABS_WIDTH, HEIGHT));

        TestCaseTree tct = new TestCaseTree(mTestCasePanel);
        JScrollPane sp2 = new JScrollPane(tct);
        mTreeTabsPanel.addTab("Test Cases", sp2);

        // add tree view for test campaign definition
        com.qspin.qtaste.ui.testcampaign.TestCaseTree mtct = new com.qspin.qtaste.ui.testcampaign.TestCaseTree(
                mTestCampaignPanel.getTreeTable());
        JScrollPane sp3 = new JScrollPane(mtct);
        mTreeTabsPanel.addTab("Test Campaign", sp3);

        genMenu(tct);

        // add another tab contain used for Interactive mode
        TestAPIDocsTree jInteractive = new TestAPIDocsTree(testInterractivePanel);
        JScrollPane spInter = new JScrollPane(jInteractive);
        mTreeTabsPanel.addTab("Interactive", spInter);

        // init will do the link between the tree view and the pane
        testInterractivePanel.init();

        // Define the listener to display the pane depending on the selected tab
        mTreeTabsPanel.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                String componentName = mTreeTabsPanel.getTitleAt(mTreeTabsPanel.getSelectedIndex());
                CardLayout rcl = (CardLayout) mRightPanels.getLayout();
                rcl.show(mRightPanels, componentName);
            }
        });
        mTestCampaignPanel.addTestCampaignActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (e.getID() == TestCampaignMainPanel.RUN_ID) {
                    if (e.getActionCommand().equals(TestCampaignMainPanel.STARTED_CMD)) {
                        // open the tab test cases
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                mTreeTabsPanel.setSelectedIndex(0);
                                mTestCasePanel.setSelectedTab(TestCasePane.RESULTS_INDEX);
                            }
                        });

                        // update the buttons
                        mTestCasePanel.setExecutingTestCampaign(true,
                                ((TestCampaignMainPanel) e.getSource()).getExecutionThread());
                        mTestCasePanel.updateButtons(true);
                    } else if (e.getActionCommand().equals(TestCampaignMainPanel.STOPPED_CMD)) {
                        mTestCasePanel.setExecutingTestCampaign(false, null);
                        mTestCasePanel.updateButtons();
                    }
                }
            }
        });

        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTreeTabsPanel, mRightPanels);
        splitPane.setDividerSize(4);
        GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
        int mainHorizontalSplitDividerLocation = guiConfiguration
                .getInt(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, 285);
        splitPane.setDividerLocation(mainHorizontalSplitDividerLocation);

        splitPane.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals("dividerLocation")) {
                    GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
                    if (evt.getSource() instanceof JSplitPane) {
                        JSplitPane splitPane = (JSplitPane) evt.getSource();
                        guiConfiguration.setProperty(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY,
                                splitPane.getDividerLocation());
                        try {
                            guiConfiguration.save();
                        } catch (ConfigurationException ex) {
                            logger.error("Error while saving GUI configuration: " + ex.getMessage());
                        }
                    }
                }
            }
        });

        topanel.add(iconlabel, BorderLayout.WEST);
        topanel.add(center);

        getContentPane().add(topanel, BorderLayout.NORTH);
        getContentPane().add(splitPane);
        this.pack();

        this.setExtendedState(Frame.MAXIMIZED_BOTH);
        if (mTestSuiteDir != null) {
            DirectoryTestSuite testSuite = DirectoryTestSuite.createDirectoryTestSuite(mTestSuiteDir);
            if (testSuite != null) {
                testSuite.setExecutionLoops(mNumberLoops, mLoopsInHour);
                setTestSuite(testSuite.getName());
                mTestCasePanel.runTestSuite(testSuite, false);
            }
        }
        setVisible(true);
        //treeTabs.setMinimumSize(new Dimension(100, this.HEIGHT));

    } catch (Exception e) {
        logger.fatal(e);
        e.printStackTrace();
        TestEngine.shutdown();
        System.exit(1);
    }

}

From source file:gmgen.GMGenSystem.java

private void setCloseSettings() {
    SettingsHandler.setGMGenOption(SETTING_WINDOW_X, this.getX());
    SettingsHandler.setGMGenOption(WINDOW_Y, this.getY());
    SettingsHandler.setGMGenOption(SETTING_WINDOW_WIDTH, this.getSize().width);
    SettingsHandler.setGMGenOption(SETTING_WINDOW_HEIGHT, this.getSize().height);

    // Maximized state of the window
    if ((getExtendedState() & Frame.MAXIMIZED_BOTH) != 0) {
        SettingsHandler.setGMGenOption(SETTING_WINDOW_STATE, Frame.MAXIMIZED_BOTH);
    } else if ((getExtendedState() & Frame.MAXIMIZED_HORIZ) != 0) {
        SettingsHandler.setGMGenOption(SETTING_WINDOW_STATE, Frame.MAXIMIZED_HORIZ);
    } else if ((getExtendedState() & Frame.MAXIMIZED_VERT) != 0) {
        SettingsHandler.setGMGenOption(SETTING_WINDOW_STATE, Frame.MAXIMIZED_VERT);
    } else {/*w  ww  .  j  a va  2s .co  m*/
        SettingsHandler.setGMGenOption(SETTING_WINDOW_STATE, Frame.NORMAL);
    }
}

From source file:org.ngrinder.recorder.Recorder.java

/**
 * Initialize global message handlers./*w  w  w .ja va2s .c  o m*/
 * 
 * @param tabbedPane
 *            tabbedPane
 */
protected void initMessageHandler(final TabbedPane tabbedPane) {
    final File home = recorderConfig.getHome().getDirectory();
    final MessageBus messageBusInstance = MessageBus.getInstance();
    MessageBusConnection connect = messageBusInstance.connect();
    connect.subscribe(Topics.HOME, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            Browser browser = cast(evt.getSource());
            browser.navigate(toURL(tempFile).toString());
        }
    });
    connect.subscribe(Topics.APPLICATION_CLOSE, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            proxy.stopProxy();
            frame.setExtendedState(Frame.NORMAL);
            File frameInfoFile = recorderConfig.getHome().getFile("last_frame");
            try {
                Pair<Dimension, Point> pair = Pair.of(frame.getSize(), frame.getLocation());
                String frameInfo = gson.toJson(pair);
                FileUtils.writeStringToFile(frameInfoFile, frameInfo);
            } catch (Exception e) {
                LOGGER.error("Failed to save the frame info", e);
            }

            messageBusInstance.getPublisher(Topics.PREPARE_TO_CLOSE)
                    .propertyChange(new PropertyChangeEvent(this, "PREPARE_TO_CLOSE", null, home));

            tabbedPane.disposeAllTabs();
            frame.setVisible(false);
            frame.dispose();

            System.exit(0);
        }
    });
    connect.subscribe(Topics.WINDOW_MAXIMIZE, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (frame.getExtendedState() == Frame.MAXIMIZED_BOTH) {
                frame.setExtendedState(Frame.NORMAL);
            } else {
                frame.setExtendedState(Frame.MAXIMIZED_BOTH);
            }
        }
    });

    connect.subscribe(Topics.WINDOW_MINIMIZE, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (frame.getExtendedState() == Frame.ICONIFIED) {
                frame.setExtendedState(Frame.NORMAL);
            } else {
                frame.setExtendedState(Frame.ICONIFIED);
            }
        }
    });

    connect.subscribe(Topics.SHOW_ABOUT_DIALOG, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            AboutDialog dialog = AboutDialog.getInstance(frame, recorderConfig);
            dialog.setVisible(true);
        }
    });
}

From source file:net.pms.newgui.components.WindowProperties.java

private boolean updateWindowBounds(@Nullable Window eventWindow) {
    if (eventWindow != window) {
        return false;
    }/*  w  w w  . j a v a2s  .co  m*/
    int state = eventWindow instanceof Frame ? ((Frame) eventWindow).getExtendedState() : 0;
    Rectangle bounds;
    if (state == 0) {
        bounds = eventWindow.getBounds();
    } else if ((state & Frame.MAXIMIZED_BOTH) != Frame.MAXIMIZED_BOTH) {
        bounds = eventWindow.getBounds();
        // Don't store maximized dimensions
        if ((state & Frame.MAXIMIZED_HORIZ) != 0) {
            bounds.x = windowBounds.x;
            bounds.width = windowBounds.width;
        } else if ((state & Frame.MAXIMIZED_VERT) != 0) {
            bounds.y = windowBounds.y;
            bounds.height = windowBounds.height;
        }
    } else {
        bounds = windowBounds;
    }
    boolean changed = !bounds.equals(windowBounds);
    if (changed) {
        windowBounds = bounds;
    }
    if (windowState != (byte) state) {
        windowState = (byte) state;
        changed = true;
    }
    return changed;
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * @param frame to be positioned//from w  w w. java  2  s  .  co  m
 * 
 * positions frame on screen relative to position of TOPFRAME.
 * Sets frame.alwaysOnTop to true if TOPFRAME is maximized.
 */
public static void positionFrameRelativeToTopFrame(final JFrame frame) {
    // not sure of safest surest way to get main window???
    JFrame topFrame = (JFrame) UIRegistry.getTopWindow();

    // for now this just sets the top of frame to the top of topFrame
    // if there is room on the left side of topFrame, frame is set so it's right edge is next to topFrame's left edge.
    // otherwise, if frame will fit, frame's left edge is aligned with topFrame's right edge.
    // If it won't fit then frame's right edge is aligned with right of edge of screen.
    if (topFrame != null) {
        int x = 0;
        int y = topFrame.getY();
        Rectangle screenRect = topFrame.getGraphicsConfiguration().getBounds();
        if (topFrame.getX() >= frame.getWidth()) {
            x = topFrame.getX() - frame.getWidth();
        } else if (screenRect.width - topFrame.getX() - topFrame.getWidth() >= frame.getWidth()) {
            x = topFrame.getWidth();
        } else {
            x = screenRect.width - frame.getWidth();
        }
        frame.setBounds(x, y, frame.getWidth(), frame.getHeight());

        frame.setAlwaysOnTop(topFrame.getExtendedState() == Frame.MAXIMIZED_BOTH
                || topFrame.getExtendedState() == Frame.MAXIMIZED_VERT
                || topFrame.getExtendedState() == Frame.MAXIMIZED_HORIZ);
    }
}

From source file:org.argouml.application.Main.java

/**
 * Do a part of the initialization that is very much GUI-stuff.
 *
 * @param splash the splash screeen/*from  w  ww .j ava2  s . c  o  m*/
 */
private static ProjectBrowser initializeGUI(SplashScreen splash) {
    // make the projectbrowser
    JPanel todoPane = new ToDoPane();
    ProjectBrowser pb = ProjectBrowser.makeInstance(splash, true, todoPane);

    JOptionPane.setRootFrame(pb);

    pb.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    // Set the screen layout to what the user left it before, or
    // to reasonable defaults.
    Rectangle scrSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();

    int configFrameWidth = Configuration.getInteger(Argo.KEY_SCREEN_WIDTH, scrSize.width);
    int w = Math.min(configFrameWidth, scrSize.width);
    if (w == 0) {
        w = 600;
    }

    int configFrameHeight = Configuration.getInteger(Argo.KEY_SCREEN_HEIGHT, scrSize.height);
    int h = Math.min(configFrameHeight, scrSize.height);
    if (h == 0) {
        h = 400;
    }

    int x = Configuration.getInteger(Argo.KEY_SCREEN_LEFT_X, 0);
    int y = Configuration.getInteger(Argo.KEY_SCREEN_TOP_Y, 0);
    pb.setLocation(x, y);
    pb.setSize(w, h);
    pb.setExtendedState(
            Configuration.getBoolean(Argo.KEY_SCREEN_MAXIMIZED, false) ? Frame.MAXIMIZED_BOTH : Frame.NORMAL);

    UIManager.put("Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "ENTER", "pressed",
            "released ENTER", "released", "SPACE", "pressed", "released SPACE", "released" }));
    return pb;
}

From source file:tvbrowser.TVBrowser.java

private static void initUi(Splash splash, boolean startMinimized) {
    mainFrame = MainFrame.getInstance();
    PluginProxyManager.getInstance().setParentFrame(mainFrame);
    TvDataServiceProxyManager.getInstance().setParamFrame(mainFrame);

    // Set the program icon
    ArrayList<Image> iconImages = new ArrayList<Image>(2);
    iconImages.add(ImageUtilities.createImage("imgs/tvbrowser128.png"));
    iconImages.add(ImageUtilities.createImage("imgs/tvbrowser48.png"));
    iconImages.add(ImageUtilities.createImage("imgs/tvbrowser32.png"));
    iconImages.add(ImageUtilities.createImage("imgs/tvbrowser16.png"));
    mainFrame.setIconImages(iconImages);

    mTray = new SystemTray();

    if (mTray.initSystemTray()) {
        mTray.createMenus();/*from   w w  w  .java 2 s. c o m*/
    } else {
        mLog.info("platform independent mode is ON");
        addTrayWindowListener();
    }

    // Set the right size
    mLog.info("Setting frame size and location");

    int windowWidth = Settings.propWindowWidth.getInt();
    int windowHeight = Settings.propWindowHeight.getInt();
    mainFrame.setSize(windowWidth, windowHeight);
    int windowX = Settings.propWindowX.getInt();
    int windowY = Settings.propWindowY.getInt();

    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

    if ((windowX == -1 && windowY == -1) || windowX + windowWidth < 0 || windowX > screen.width + 10
            || windowY + windowHeight < 0 || windowY > screen.height + 10 || windowWidth < 200
            || windowHeight < 200) {
        UiUtilities.centerAndShow(mainFrame);
    } else {
        mainFrame.setLocation(windowX, windowY);

    }

    mainFrame.setVisible(true);
    ErrorHandler.setFrame(mainFrame);

    splash.hideSplash();

    mainFrame.repaint();

    // maximize the frame if wanted
    if (Settings.propIsWindowMaximized.getBoolean()) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                mainFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
            }
        });
    }

    // minimize the frame if wanted
    if (startMinimized) {
        mainFrame.setExtendedState(Frame.ICONIFIED);
    }

    if (mFullscreen || Settings.propIsUsingFullscreen.getBoolean()) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                mainFrame.switchFullscreenMode();
            }
        });
    }

    if (Settings.propShowAssistant.getBoolean()) {
        mLog.info("Running setup assistant");
        mainFrame.runSetupAssistant();
    }
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

public FindingsListFrame(boolean fullscreen) {
    super();/*  w  w  w .  j  av  a 2  s .  co m*/

    this.fullscreen = fullscreen;
    this.nativeFullscrSupported = gd.isFullScreenSupported();

    /*
     * Because of some problems do not use the native fullscreen
     * functionality
     */
    if (UI.getInstance().getPlatform() == UI.Platform.WINDOWS
            || UI.getInstance().getPlatform() == UI.Platform.MAC) {
        nativeFullscrSupported = false;
    }

    UI.getInstance().getProtocolClockWorker().addPropertyChangeListener(evt -> {
        Object value = evt.getNewValue();
        if (value instanceof Integer) {
            updateClock((int) value);
            updateCurrentTime();
        }
    });

    setTitle(translate("List of Findings"));
    setStatusMessage(translate("List of findings successfully loaded."), false);

    getContentPane().setLayout(new BorderLayout());
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    /*
     * Format bottom panel in org tab
     */
    bottomOrgPanel.setBackground(UI.TABLE_ALT_COLOR);
    bottomOrgPanel.setBorder(new EmptyBorder(20, 0, 30, 0));

    GUITools.addComponent(tabPanelOrg, gbl, attPanel, 0, 0, 1, 1, 1.0, 1.0, 0, 0, 20, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelOrg, gbl, new JSeparator(), 0, 1, 1, 1, 1.0, 0.0, 0, 0, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelOrg, gbl, bottomOrgPanel, 0, 2, 1, 1, 1.0, 0.0, 0, 0, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

    createToolBar();

    setLocationToCenter();

    if (fullscreen) {
        setUndecorated(true);

        if (!nativeFullscrSupported) {
            setMinimumSize(Toolkit.getDefaultToolkit().getScreenSize());
            setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize());
            setSize(Toolkit.getDefaultToolkit().getScreenSize());

            setLocation(0, 0);

            setResizable(false);
            setAlwaysOnTop(true);
        }

        toFront();

        // Dimension screenSize =
        // Toolkit.getDefaultToolkit().getScreenSize();
        // setPreferredSize(screenSize);
    } else {
        setMinimumSize(new Dimension(900, 710));
        setPreferredSize(new Dimension(900, 710));

        pack();
    }

    setExtendedState(Frame.MAXIMIZED_BOTH);

    createHints();

    addWindowListener(new WindowListener() {
        @Override
        public void windowActivated(WindowEvent e) {
        }

        @Override
        public void windowClosed(WindowEvent e) {
        }

        @Override
        public void windowClosing(WindowEvent e) {
            if (StringUtils.isBlank(protCommTxtArea.getText())) {
                currentProt.setComments("");
            }
            GUITools.executeSwingWorker(new ImageEditorWriteWorker(currentProt));
            setVisible(false);
        }

        @Override
        public void windowDeactivated(WindowEvent e) {
        }

        @Override
        public void windowDeiconified(WindowEvent e) {
        }

        @Override
        public void windowIconified(WindowEvent e) {
            if (isFullscreen()) {
                setExtendedState(MAXIMIZED_BOTH);
            }
        }

        @Override
        public void windowOpened(WindowEvent e) {
        }
    });

    GUITools.executeSwingWorker(updateWorker);
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

@Override
public void setVisible(boolean vis) {
    updateClockButtons();/*from  w  w  w.j a  v  a  2 s  . c o  m*/

    setExtendedState(Frame.MAXIMIZED_BOTH);

    if (fullscreen && nativeFullscrSupported) {
        if (vis) {
            gd.setFullScreenWindow(this);
        } else {
            gd.setFullScreenWindow(null);
        }
    }

    // Show fullscreen button in toolbar
    try {
        if (appData.getSettingValue(AppSettingKey.APP_ALLOW_FULLSCREEN) == AppSettingValue.TRUE) {
            tbFullscreen.setVisible(true);
        } else {
            tbFullscreen.setVisible(false);
        }
    } catch (DataException exc) {
        // Ignore
    }

    if (vis) {
        clockWorker.startClock();
        updateClockButtons();

        Data.getInstance().getResiData().addObserver(this);

        UI.getInstance().getAutoBackupWorker().addObserverFrame(this);
        UI.getInstance().getAutoSaveWorker().addObserverFrame(this);

        update(null, null);
    } else {
        clockWorker.stopClock();
        updateClockButtons();

        Data.getInstance().getResiData().deleteObserver(this);

        UI.getInstance().getAutoBackupWorker().removeObserverFrame(this);
        UI.getInstance().getAutoSaveWorker().removeObserverFrame(this);
    }

    super.setVisible(vis);

    boolean protFrameVisible = UI.getInstance().getProtocolFrame().isVisible();

    UI.getInstance().getMainFrame().setVisible(!protFrameVisible);
    Dashboard.getInstance();
}