Example usage for java.awt Frame NORMAL

List of usage examples for java.awt Frame NORMAL

Introduction

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

Prototype

int NORMAL

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

Click Source Link

Document

Frame is in the "normal" state.

Usage

From source file:pl.edu.icm.visnow.lib.basic.viewers.Viewer2D.Display2DPanel.java

private void showControlsFrame() {
    if (!controlsFrame.isVisible()) {
        controlsFrame.setLocation(parentFrame.getLocation().x + 30, parentFrame.getLocation().y + 30);
        controlsFrame.setTitle(parentFrame.getTitle() + " Controls");
    }//  www. j a  v a  2 s  .co m

    if ((controlsFrame.getExtendedState() | Frame.ICONIFIED) == Frame.ICONIFIED) {
        controlsFrame.setExtendedState(Frame.NORMAL);
    }

    controlsFrame.setVisible(true);
}

From source file:pl.otros.logview.gui.LogViewMainFrame.java

/**
 * @param args porgram CLI arguments/*from   www.j av a 2s .  co m*/
 * @throws InitializationException
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
public static void main(final String[] args)
        throws InitializationException, InterruptedException, InvocationTargetException {
    if (args.length > 0 && "-batch".equals(args[0])) {
        try {
            String[] batchArgs = new String[args.length - 1];
            System.arraycopy(args, 1, batchArgs, 0, batchArgs.length);
            BatchProcessor.main(batchArgs);
        } catch (IOException e) {
            System.err.println("Error during batch processing: " + e.getMessage());
            e.printStackTrace();
        } catch (ConfigurationException e) {
            System.err.println("Error during batch processing: " + e.getMessage());
            e.printStackTrace();
        }
        return;
    }
    SingleInstanceRequestResponseDelegate singleInstanceRequestResponseDelegate = SingleInstanceRequestResponseDelegate
            .getInstance();
    singleInstance = SingleInstance.request("OtrosLogViewer", singleInstanceRequestResponseDelegate,
            singleInstanceRequestResponseDelegate, args);
    if (singleInstance == null) {
        LOGGER.info("OtrosLogViewer is already running, params send using requestAction");
        System.exit(0);
    }
    GuiJulHandler handler = new GuiJulHandler();
    handler.setLevel(Level.ALL);
    Logger olvLogger = Logger.getLogger("pl.otros.logview");
    olvLogger.setLevel(Level.ALL);
    olvLogger.addHandler(handler);
    LOGGER.info("Starting application");
    OtrosSplash.setMessage("Starting application");
    OtrosSplash.setMessage("Loading configuration");
    final XMLConfiguration c = getConfiguration("config.xml");
    if (!c.containsKey(ConfKeys.UUID)) {
        c.setProperty(ConfKeys.UUID, UUID.randomUUID().toString());
    }
    IconsLoader.loadIcons();
    OtrosSplash.setMessage("Loading icons");
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            try {
                OtrosSplash.setMessage("Loading L&F");
                String lookAndFeel = c.getString("lookAndFeel",
                        "com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
                LOGGER.config("Initializing look and feelL: " + lookAndFeel);
                PlasticLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE);
                UIManager.setLookAndFeel(lookAndFeel);
            } catch (Throwable e1) {
                LOGGER.warning("Cannot initialize LookAndFeel: " + e1.getMessage());
            }
            try {
                final DataConfiguration c1 = new OtrosConfiguration(c);
                final LogViewMainFrame mf = new LogViewMainFrame(c1);
                // mf.exitAction was instantiated in the constructor (previous line)
                // Not sure retrieving this from most appropriate Apache config
                // object.
                mf.exitAction.setConfirm(c.getBoolean("generalBehavior.confirmExit", true));
                /* TODO:  Implement User Preferences screen or checkbox on exit widget
                 * that will update the same config object something like:
                 *     c.setProperty("generalBehavior.confirmExit", newValue);
                 */
                mf.addComponentListener(new ComponentAdapter() {
                    @Override
                    public void componentResized(ComponentEvent e) {
                        c.setProperty("gui.state", mf.getExtendedState());
                        if (mf.getExtendedState() == Frame.NORMAL) {
                            c.setProperty("gui.width", mf.getWidth());
                            c.setProperty("gui.height", mf.getHeight());
                        }
                    }

                    @Override
                    public void componentMoved(ComponentEvent e) {
                        c.setProperty("gui.location.x", mf.getLocation().x);
                        c.setProperty("gui.location.y", mf.getLocation().y);
                    }
                });
                mf.addWindowListener(mf.exitAction);
                SingleInstanceRequestResponseDelegate.openFilesFromStartArgs(mf.otrosApplication,
                        Arrays.asList(args), mf.otrosApplication.getAppProperties().getCurrentDir());
            } catch (InitializationException e) {
                LOGGER.log(Level.SEVERE, "Cannot initialize main frame", e);
            }
        }
    });
}

From source file:pl.otros.logview.gui.LogViewMainFrame.java

private void initPosition() {
    Dimension size = new Dimension(configuration.getInt("gui.width", 1280),
            configuration.getInt("gui.height", 780));
    Point location = new Point(configuration.getInt("gui.location.x", 100),
            configuration.getInt("gui.location.y", 100));
    int state = configuration.getInt("gui.state", Frame.NORMAL);
    Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
    if (location.x > screensize.width) {
        location.x = 0;//from  w ww  .  j  a  v  a 2 s  .  c  om
    }
    if (location.y > screensize.height) {
        location.y = 0;
    }
    size.width = Math.min(screensize.width, size.width);
    size.height = Math.min(screensize.height, size.height);
    this.setSize(size);
    this.setLocation(location);
    this.setExtendedState(state);
}