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:com.gargoylesoftware.htmlunit.util.WebClientUtils.java

/**
 * Attaches a visual (GUI) debugger to the specified client.
 * @param client the client to which the visual debugger is to be attached
 * @see <a href="http://www.mozilla.org/rhino/debugger.html">Mozilla Rhino Debugger Documentation</a>
 */// w  w w .j a  v a  2  s . co  m
public static void attachVisualDebugger(final WebClient client) {
    final ScopeProvider sp = null;
    final HtmlUnitContextFactory cf = client.getJavaScriptEngine().getContextFactory();
    final Main main = Main.mainEmbedded(cf, sp, "HtmlUnit JavaScript Debugger");
    main.getDebugFrame().setExtendedState(Frame.MAXIMIZED_BOTH);

    final SourceProvider sourceProvider = new SourceProvider() {
        @Override
        public String getSource(final DebuggableScript script) {
            String sourceName = script.getSourceName();
            if (sourceName.endsWith("(eval)") || sourceName.endsWith("(Function)")) {
                return null; // script is result of eval call. Rhino already knows the source and we don't
            }
            if (sourceName.startsWith("script in ")) {
                sourceName = StringUtils.substringBetween(sourceName, "script in ", " from");
                for (final WebWindow ww : client.getWebWindows()) {
                    final WebResponse wr = ww.getEnclosedPage().getWebResponse();
                    if (sourceName.equals(wr.getWebRequest().getUrl().toString())) {
                        return wr.getContentAsString();
                    }
                }
            }
            return null;
        }
    };
    main.setSourceProvider(sourceProvider);
}

From source file:com.softenido.findrepe.showgroup.ImageShowGroup.java

@Override
protected void list(final int groupId, final VirtualFile[] files, final boolean[] deleted) throws IOException {
    final ImageShowGroup sg = this;
    try {//from   w  ww.  j  av  a2s.  co  m
        java.awt.EventQueue.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                try {
                    if (frame == null) {
                        frame = new JImageDiffFrame(sg);
                        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
                        frame.setVisible(true);
                        frame.pack();
                        frame.validate();
                    }
                    frame.showImages(groupId, files, deleted);
                } catch (IOException ex) {
                    Logger.getLogger(JImageDiffFrame.class.getName()).log(Level.SEVERE, null, ex);
                } catch (ArchiveException ex) {
                    Logger.getLogger(JImageDiffFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    } catch (InterruptedException ex) {
        Logger.getLogger(ImageShowGroup.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InvocationTargetException ex) {
        Logger.getLogger(ImageShowGroup.class.getName()).log(Level.SEVERE, null, ex);
    }
    synchronized (this) {
        try {
            this.wait();
        } catch (InterruptedException ex) {
            Logger.getLogger(ImageShowGroup.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:com.haulmont.cuba.desktop.sys.MainWindowProperties.java

protected void saveProperties(Properties properties) {
    if (frame.getExtendedState() == Frame.MAXIMIZED_BOTH) {
        properties.setProperty("maximized", "true");
    } else {//from   www. ja v a 2s.  c  o m
        properties.setProperty("x", String.valueOf((int) frame.getBounds().getX()));
        properties.setProperty("y", String.valueOf((int) frame.getBounds().getY()));
        properties.setProperty("width", String.valueOf((int) frame.getBounds().getWidth()));
        properties.setProperty("height", String.valueOf((int) frame.getBounds().getHeight()));
    }
}

From source file:com.tag.FramePreferences.java

@SuppressWarnings("serial")
public FramePreferences(final JInternalFrame frame, String pathName) {
    setFrame(new Frame() {

        @Override//w  w  w  . j  a  va2 s . c o m
        public synchronized int getExtendedState() {
            if (frame.isMaximum()) {
                return Frame.MAXIMIZED_BOTH;
            } else if (frame.isIcon()) {
                return Frame.ICONIFIED;
            } else {
                return Frame.NORMAL;
            }
        }

        @Override
        public synchronized void setExtendedState(int state) {
            try {
                switch (state) {
                case Frame.MAXIMIZED_HORIZ:
                case Frame.MAXIMIZED_VERT:
                case Frame.MAXIMIZED_BOTH:
                    frame.setMaximum(true);
                    break;
                case Frame.ICONIFIED:
                    frame.setIcon(true);
                    break;
                case Frame.NORMAL:
                    frame.setIcon(false);
                    frame.setMaximum(false);
                    break;
                }
            } catch (PropertyVetoException e) {
                e.printStackTrace();
            }
        }

        @Override
        public synchronized void addWindowStateListener(final WindowStateListener l) {
            final Frame source = this;
            frame.addInternalFrameListener(new InternalFrameAdapter() {

                @Override
                public void internalFrameIconified(InternalFrameEvent e) {
                    l.windowStateChanged(new WindowEvent(source, WindowEvent.WINDOW_ICONIFIED));
                }

                @Override
                public void internalFrameDeiconified(InternalFrameEvent e) {
                    l.windowStateChanged(new WindowEvent(source, WindowEvent.WINDOW_DEICONIFIED));
                }

            });
        }

        @Override
        public synchronized void removeWindowStateListener(WindowStateListener l) {
            super.removeWindowStateListener(l);
        }

        @Override
        public GraphicsConfiguration getGraphicsConfiguration() {
            return frame.getGraphicsConfiguration();
        }

        public Point getLocation() {
            return frame.getLocation();
        }

        @Override
        public void setLocation(Point p) {
            frame.setLocation(p);
        }

        @Override
        public Dimension getSize() {
            return frame.getSize();
        }

        @Override
        public void setSize(Dimension size) {
            frame.setSize(size);
        }

        @Override
        public synchronized void addComponentListener(ComponentListener l) {
            frame.addComponentListener(l);
        }

        @Override
        public synchronized void removeComponentListener(ComponentListener l) {
            frame.addComponentListener(l);
        }

    });
    setPathName(pathName);
}

From source file:com.josescalia.tumblr.app.Bootstrap.java

public void runApp(ApplicationSplash splash) {
    //application config business process
    createAndWriteAppConfig(splash);//from  w  w  w . j a  v a2s  . c o  m
    splash.updateStatus("Reading property file");
    updateSplashProgress(splash, 50, 80, 30);

    appContext = new ClassPathXmlApplicationContext(ApplicationConstants.APP_CONTEXT);
    MainFrame frame = new MainFrame();
    frame.setContext(appContext);
    frame.setAppLookAndFeel(ReadWritePropertyFile.readAppProperty(ApplicationConstants.APP_PROPERTY_FILE,
            "application.look-and-feel"));
    frame.setTitle(
            (String) appContext.getBean("appTitle") + " Ver-" + (String) appContext.getBean("appVersion"));
    frame.setLblFooter("Created By : " + (String) appContext.getBean("appAuthor") + "@2014");

    splash.updateStatus("Loading Main Form");
    updateSplashProgress(splash, 80, 100, 30);
    splash.dispose();

    frame.doShow();
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    frame.setVisible(true);
}

From source file:net.wurstclient.hooks.FrameHook.java

public static void maximize() {
    if (frame != null)
        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
}

From source file:com.haulmont.cuba.desktop.sys.MainWindowProperties.java

protected void loadProperties(Properties properties) {
    Boolean maximized = Boolean.valueOf(properties.getProperty("maximized", "false"));
    if (maximized) {
        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    }//from  ww w .j av  a2  s.  c  o  m
    int x = Integer.parseInt(properties.getProperty("x", "0"));
    int y = Integer.parseInt(properties.getProperty("y", "0"));
    int width = Integer.parseInt(properties.getProperty("width", "1000"));
    int height = Integer.parseInt(properties.getProperty("height", "700"));

    frame.setBounds(x, y, width, height);
    if (x == 0 && y == 0)
        frame.setLocationRelativeTo(null);
}

From source file:org.pmedv.core.gui.ApplicationWindowAdvisorImpl.java

@Override
public void windowClosingHook(WindowEvent e) {

    for (ApplicationPerspective ap : perspectiveProvider.getPerspectives()) {

        AbstractPerspective a = (AbstractPerspective) ctx.getBean(ap.getId());

        if (a instanceof IMemento) {
            ((IMemento) a).saveState();/*from   ww  w.j av  a  2 s . co  m*/
        }

    }

    windowConfig.getConfig().setMaximized(win.getExtendedState() == Frame.MAXIMIZED_BOTH);
    windowConfig.getConfig().setX(win.getX());
    windowConfig.getConfig().setY(win.getY());
    windowConfig.getConfig().setHeight(win.getHeight());
    windowConfig.getConfig().setWidth(win.getWidth());
    windowConfig.storeConfig();

    new org.pmedv.blackboard.commands.BBExitCommand().execute(null);
}

From source file:ProtocolRunner.java

/** Creates new form ProtocolRunner */
public ProtocolRunner() { 
    // set the native look and feel
    try{/*w  w w .  j a va 2  s  . c o m*/
        UIManager.setLookAndFeel(
            UIManager.getSystemLookAndFeelClassName());
    }catch(Exception e) {}
        
    initComponents();
    // size it so that it appears full screen
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    this.setSize(screen.width, screen.height);
    this.pack();
    this.setExtendedState(Frame.MAXIMIZED_BOTH);
}

From source file:WindowEventDemo.java

public void checkWM() {
    Toolkit tk = frame.getToolkit();
    if (!(tk.isFrameStateSupported(Frame.ICONIFIED))) {
        displayMessage("Your window manager doesn't support ICONIFIED.");
    }//from  ww  w. ja  v  a2 s  .  com
    if (!(tk.isFrameStateSupported(Frame.MAXIMIZED_VERT))) {
        displayMessage("Your window manager doesn't support MAXIMIZED_VERT.");
    }
    if (!(tk.isFrameStateSupported(Frame.MAXIMIZED_HORIZ))) {
        displayMessage("Your window manager doesn't support MAXIMIZED_HORIZ.");
    }
    if (!(tk.isFrameStateSupported(Frame.MAXIMIZED_BOTH))) {
        displayMessage("Your window manager doesn't support MAXIMIZED_BOTH.");
    } else {
        displayMessage("Your window manager supports MAXIMIZED_BOTH.");
    }
}