Example usage for java.awt GraphicsEnvironment getScreenDevices

List of usage examples for java.awt GraphicsEnvironment getScreenDevices

Introduction

In this page you can find the example usage for java.awt GraphicsEnvironment getScreenDevices.

Prototype

public abstract GraphicsDevice[] getScreenDevices() throws HeadlessException;

Source Link

Document

Returns an array of all of the screen GraphicsDevice objects.

Usage

From source file:GuiScreens.java

public static void main(String[] args) {
    Rectangle virtualBounds = new Rectangle();
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    JFrame frame[][] = new JFrame[gs.length][];
    for (int j = 0; j < gs.length; j++) {
        GraphicsDevice gd = gs[j];
        System.out.println("Device " + j + ": " + gd);
        GraphicsConfiguration[] gc = gd.getConfigurations();
        frame[j] = new JFrame[gc.length];

        for (int i = 0; i < gc.length; i++) {
            System.out.println("  Configuration " + i + ": " + gc[i]);
            System.out.println("    Bounds: " + gc[i].getBounds());
            virtualBounds = virtualBounds.union(gc[i].getBounds());
            frame[j][i] = new JFrame("Config: " + i, gc[i]);
            frame[j][i].setBounds(50, 50, 400, 100);
            frame[j][i].setLocation((int) gc[i].getBounds().getX() + 50, (int) gc[i].getBounds().getY() + 50);
            frame[j][i].getContentPane().add(new JTextArea("Config:\n" + gc[i]));
            frame[j][i].setVisible(true);
        }/*w  w  w  .j  a  v a  2 s .  c  o  m*/
        System.out.println("Overall bounds: " + virtualBounds);
    }
}

From source file:br.com.ant.system.app.AntSystemApp.java

public static void main(String[] args) {

    try {//  ww  w  .  j av  a 2 s .com
        if (SystemUtils.IS_OS_WINDOWS) {
            UIManager.setLookAndFeel(WindowsClassicLookAndFeel.class.getName());
        } else {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }

        ColoniaFormigasView frame = new ColoniaFormigasView();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] devices = env.getScreenDevices();

        DisplayMode mode = devices[0].getDisplayMode();
        int height = mode.getHeight();
        int width = mode.getWidth();

        frame.setSize(width, height - 30);
        frame.setVisible(true);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:Main.java

public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

    Rectangle vBounds = new Rectangle();

    GraphicsDevice[] gdArray = ge.getScreenDevices();

    for (int i = 0; i < gdArray.length; i++) {
        GraphicsDevice gd = gdArray[i];

        GraphicsConfiguration[] gcArray = gd.getConfigurations();

        for (int j = 0; j < gcArray.length; j++)
            vBounds = vBounds.union(gcArray[j].getBounds());
    }//from   ww  w.j a  v a  2 s .  co  m

    Point origin = vBounds.getLocation();
    System.out.println("Virtual x = " + origin.x);
    System.out.println("Virtual y = " + origin.y);

    Dimension size = vBounds.getSize();
    System.out.println("Virtual width = " + size.width);
    System.out.println("Virtual height = " + size.height);
}

From source file:MainClass.java

public static void main(String[] args) {
    GraphicsEnvironment ge;
    ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

    Rectangle vBounds = new Rectangle();

    GraphicsDevice[] gdArray = ge.getScreenDevices();

    for (int i = 0; i < gdArray.length; i++) {
        GraphicsDevice gd = gdArray[i];

        GraphicsConfiguration[] gcArray = gd.getConfigurations();

        for (int j = 0; j < gcArray.length; j++)
            vBounds = vBounds.union(gcArray[j].getBounds());
    }//w  w w .ja  v  a 2s . c  o m

    Point origin = vBounds.getLocation();
    System.out.println("Virtual x = " + origin.x);
    System.out.println("Virtual y = " + origin.y);

    Dimension size = vBounds.getSize();
    System.out.println("Virtual width = " + size.width);
    System.out.println("Virtual height = " + size.height);
}

From source file:GCWrapper.java

public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = ge.getScreenDevices();
    for (int i = 0; i < devices.length; i++) {
        CapabilitiesTest tst = new CapabilitiesTest(devices[i]);
        tst.pack();/*from  ww w .ja  va2 s . com*/
        tst.setVisible(true);
    }
}

From source file:DisplayModeModel.java

public static void main(String[] args) {
    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = env.getScreenDevices();
    // REMIND : Multi-monitor full-screen mode not yet supported
    for (int i = 0; i < 1 /* devices.length */; i++) {
        DisplayModeTest test = new DisplayModeTest(devices[i]);
        test.initComponents(test.getContentPane());
        test.begin();/*  www  .j a va  2 s  .co m*/
    }
}

From source file:com.jug.MotherMachine.java

/**
 * PROJECT MAIN/*from   w  ww.ja v a2s. co  m*/
 * ============
 *
 * @param args
 *            muh!
 */
public static void main(final String[] args) {
    try {

        final MotherMachine main = new MotherMachine();
        guiFrame = new JFrame("Interactive MotherMachine");
        main.initMainWindow(guiFrame);

        props = main.loadParams();
        BGREM_TEMPLATE_XMIN = Integer
                .parseInt(props.getProperty("BGREM_TEMPLATE_XMIN", Integer.toString(BGREM_TEMPLATE_XMIN)));
        BGREM_TEMPLATE_XMAX = Integer
                .parseInt(props.getProperty("BGREM_TEMPLATE_XMAX", Integer.toString(BGREM_TEMPLATE_XMAX)));
        BGREM_X_OFFSET = Integer
                .parseInt(props.getProperty("BGREM_X_OFFSET", Integer.toString(BGREM_X_OFFSET)));
        GL_OFFSET_BOTTOM = Integer
                .parseInt(props.getProperty("GL_OFFSET_BOTTOM", Integer.toString(GL_OFFSET_BOTTOM)));
        GL_OFFSET_TOP = Integer.parseInt(props.getProperty("GL_OFFSET_TOP", Integer.toString(GL_OFFSET_TOP)));
        GL_OFFSET_LATERAL = Integer
                .parseInt(props.getProperty("GL_OFFSET_LATERAL", Integer.toString(GL_OFFSET_LATERAL)));
        MIN_CELL_LENGTH = Integer
                .parseInt(props.getProperty("MIN_CELL_LENGTH", Integer.toString(MIN_CELL_LENGTH)));
        MIN_GAP_CONTRAST = Double
                .parseDouble(props.getProperty("MIN_GAP_CONTRAST", Double.toString(MIN_GAP_CONTRAST)));
        SIGMA_PRE_SEGMENTATION_X = Double.parseDouble(
                props.getProperty("SIGMA_PRE_SEGMENTATION_X", Double.toString(SIGMA_PRE_SEGMENTATION_X)));
        SIGMA_PRE_SEGMENTATION_Y = Double.parseDouble(
                props.getProperty("SIGMA_PRE_SEGMENTATION_Y", Double.toString(SIGMA_PRE_SEGMENTATION_Y)));
        SIGMA_GL_DETECTION_X = Double
                .parseDouble(props.getProperty("SIGMA_GL_DETECTION_X", Double.toString(SIGMA_GL_DETECTION_X)));
        SIGMA_GL_DETECTION_Y = Double
                .parseDouble(props.getProperty("SIGMA_GL_DETECTION_Y", Double.toString(SIGMA_GL_DETECTION_Y)));
        DEFAULT_PATH = props.getProperty("DEFAULT_PATH", DEFAULT_PATH);

        GUI_POS_X = Integer.parseInt(props.getProperty("GUI_POS_X", Integer.toString(DEFAULT_GUI_POS_X)));
        GUI_POS_Y = Integer.parseInt(props.getProperty("GUI_POS_Y", Integer.toString(DEFAULT_GUI_POS_X)));
        GUI_WIDTH = Integer.parseInt(props.getProperty("GUI_WIDTH", Integer.toString(GUI_WIDTH)));
        GUI_HEIGHT = Integer.parseInt(props.getProperty("GUI_HEIGHT", Integer.toString(GUI_HEIGHT)));
        GUI_CONSOLE_WIDTH = Integer
                .parseInt(props.getProperty("GUI_CONSOLE_WIDTH", Integer.toString(GUI_CONSOLE_WIDTH)));
        // Iterate over all currently attached monitors and check if sceen position is actually possible,
        // otherwise fall back to the DEFAULT values and ignore the ones coming from the properties-file.
        boolean pos_ok = false;
        final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        final GraphicsDevice[] gs = ge.getScreenDevices();
        for (int i = 0; i < gs.length; i++) {
            final DisplayMode dm = gs[i].getDisplayMode();
            if (gs[i].getDefaultConfiguration().getBounds()
                    .contains(new java.awt.Point(GUI_POS_X, GUI_POS_Y))) {
                pos_ok = true;
            }
        }
        // None of the screens contained the top-left window coordinates --> fall back onto default values...
        if (!pos_ok) {
            GUI_POS_X = DEFAULT_GUI_POS_X;
            GUI_POS_Y = DEFAULT_GUI_POS_Y;
        }

        String path = props.getProperty("import_path", System.getProperty("user.home"));
        final File fPath = main.showStartupDialog(guiFrame, path);
        path = fPath.getAbsolutePath();
        props.setProperty("import_path", fPath.getAbsolutePath());

        // Setting up console window and window snapper...
        main.initConsoleWindow();
        main.showConsoleWindow();
        final JFrameSnapper snapper = new JFrameSnapper();
        snapper.addFrame(main.frameConsoleWindow);
        snapper.addFrame(guiFrame);

        // ---------------------------------------------------
        main.processDataFromFolder(path);
        // ---------------------------------------------------

        System.out.print("Build and show GUI...");
        // show loaded and annotated data
        ImageJFunctions.show(main.imgRaw, "Rotated & cropped raw data");
        ImageJFunctions.show(main.imgTemp, "Temporary");
        ImageJFunctions.show(main.imgAnnotated, "Annotated ARGB data");

        final MotherMachineGui gui = new MotherMachineGui(new MotherMachineModel(main));
        gui.setVisible(true);

        main.ij = new ImageJ();
        guiFrame.add(gui);
        guiFrame.setSize(GUI_WIDTH, GUI_HEIGHT);
        guiFrame.setLocation(GUI_POS_X, GUI_POS_Y);
        guiFrame.setVisible(true);

        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                snapper.snapFrames(main.frameConsoleWindow, guiFrame, JFrameSnapper.EAST);
            }
        });

        System.out.println(" done!");
    } catch (final UnsatisfiedLinkError ulr) {
        JOptionPane.showMessageDialog(MotherMachine.guiFrame,
                "Could initialize Gurobi.\n"
                        + "You might not have installed Gurobi properly or you miss a valid license.\n"
                        + "Please visit 'www.gurobi.com' for further information.\n\n" + ulr.getMessage(),
                "Gurobi Error?", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.jug.MoMA.java

/**
 * PROJECT MAIN/*w w w. ja va  2  s .  c  om*/
 *
 * @param args
 */
public static void main(final String[] args) {
    if (showIJ)
        new ImageJ();

    //      // ===== set look and feel ========================================================================
    //      try {
    //         // Set cross-platform Java L&F (also called "Metal")
    //         UIManager.setLookAndFeel(
    //               UIManager.getCrossPlatformLookAndFeelClassName() );
    //      } catch ( final UnsupportedLookAndFeelException e ) {
    //         // handle exception
    //      } catch ( final ClassNotFoundException e ) {
    //         // handle exception
    //      } catch ( final InstantiationException e ) {
    //         // handle exception
    //      } catch ( final IllegalAccessException e ) {
    //         // handle exception
    //      }

    // ===== command line parsing ======================================================================

    // create Options object & the parser
    final Options options = new Options();
    final CommandLineParser parser = new BasicParser();
    // defining command line options
    final Option help = new Option("help", "print this message");

    final Option headless = new Option("h", "headless", false,
            "start without user interface (note: input-folder must be given!)");
    headless.setRequired(false);

    final Option timeFirst = new Option("tmin", "min_time", true, "first time-point to be processed");
    timeFirst.setRequired(false);

    final Option timeLast = new Option("tmax", "max_time", true, "last time-point to be processed");
    timeLast.setRequired(false);

    final Option optRange = new Option("orange", "opt_range", true, "initial optimization range");
    optRange.setRequired(false);

    final Option numChannelsOption = new Option("c", "channels", true,
            "number of channels to be loaded and analyzed.");
    numChannelsOption.setRequired(true);

    final Option minChannelIdxOption = new Option("cmin", "min_channel", true,
            "the smallest channel index (usually 0 or 1, default is 1).");
    minChannelIdxOption.setRequired(false);

    final Option infolder = new Option("i", "infolder", true, "folder to read data from");
    infolder.setRequired(false);

    final Option outfolder = new Option("o", "outfolder", true,
            "folder to write preprocessed data to (equals infolder if not given)");
    outfolder.setRequired(false);

    final Option userProps = new Option("p", "props", true, "properties file to be loaded (mm.properties)");
    userProps.setRequired(false);

    options.addOption(help);
    options.addOption(headless);
    options.addOption(numChannelsOption);
    options.addOption(minChannelIdxOption);
    options.addOption(timeFirst);
    options.addOption(timeLast);
    options.addOption(optRange);
    options.addOption(infolder);
    options.addOption(outfolder);
    options.addOption(userProps);
    // get the commands parsed
    CommandLine cmd = null;
    try {
        cmd = parser.parse(options, args);
    } catch (final ParseException e1) {
        final HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(
                "... [-p props-file] -i in-folder [-o out-folder] -c <num-channels> [-cmin start-channel-ids] [-tmin idx] [-tmax idx] [-orange num-frames] [-headless]",
                "", options, "Error: " + e1.getMessage());
        System.exit(0);
    }

    if (cmd.hasOption("help")) {
        final HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("... -i <in-folder> -o [out-folder] [-headless]", options);
        System.exit(0);
    }

    if (cmd.hasOption("h")) {
        System.out.println(">>> Starting MM in headless mode.");
        HEADLESS = true;
        if (!cmd.hasOption("i")) {
            final HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("Headless-mode requires option '-i <in-folder>'...", options);
            System.exit(0);
        }
    }

    File inputFolder = null;
    if (cmd.hasOption("i")) {
        inputFolder = new File(cmd.getOptionValue("i"));

        if (!inputFolder.isDirectory()) {
            System.out.println("Error: Input folder is not a directory!");
            System.exit(2);
        }
        if (!inputFolder.canRead()) {
            System.out.println("Error: Input folder cannot be read!");
            System.exit(2);
        }
    }

    File outputFolder = null;
    if (!cmd.hasOption("o")) {
        if (inputFolder == null) {
            System.out.println(
                    "Error: Output folder would be set to a 'null' input folder! Please check your command line arguments...");
            System.exit(3);
        }
        outputFolder = inputFolder;
        STATS_OUTPUT_PATH = outputFolder.getAbsolutePath();
    } else {
        outputFolder = new File(cmd.getOptionValue("o"));

        if (!outputFolder.isDirectory()) {
            System.out.println("Error: Output folder is not a directory!");
            System.exit(3);
        }
        if (!inputFolder.canWrite()) {
            System.out.println("Error: Output folder cannot be written to!");
            System.exit(3);
        }

        STATS_OUTPUT_PATH = outputFolder.getAbsolutePath();
    }

    fileUserProps = null;
    if (cmd.hasOption("p")) {
        fileUserProps = new File(cmd.getOptionValue("p"));
    }

    if (cmd.hasOption("cmin")) {
        minChannelIdx = Integer.parseInt(cmd.getOptionValue("cmin"));
    }
    if (cmd.hasOption("c")) {
        numChannels = Integer.parseInt(cmd.getOptionValue("c"));
    }

    if (cmd.hasOption("tmin")) {
        minTime = Integer.parseInt(cmd.getOptionValue("tmin"));
    }
    if (cmd.hasOption("tmax")) {
        maxTime = Integer.parseInt(cmd.getOptionValue("tmax"));
    }

    if (cmd.hasOption("orange")) {
        initOptRange = Integer.parseInt(cmd.getOptionValue("orange"));
    }

    // ******** CHECK GUROBI ********* CHECK GUROBI ********* CHECK GUROBI *********
    final String jlp = System.getProperty("java.library.path");
    //      System.out.println( jlp );
    try {
        new GRBEnv("MoMA_gurobi.log");
    } catch (final GRBException e) {
        final String msgs = "Initial Gurobi test threw exception... check your Gruobi setup!\n\nJava library path: "
                + jlp;
        if (HEADLESS) {
            System.out.println(msgs);
        } else {
            JOptionPane.showMessageDialog(MoMA.guiFrame, msgs, "Gurobi Error?", JOptionPane.ERROR_MESSAGE);
        }
        e.printStackTrace();
        System.exit(98);
    } catch (final UnsatisfiedLinkError ulr) {
        final String msgs = "Could initialize Gurobi.\n"
                + "You might not have installed Gurobi properly or you miss a valid license.\n"
                + "Please visit 'www.gurobi.com' for further information.\n\n" + ulr.getMessage()
                + "\nJava library path: " + jlp;
        if (HEADLESS) {
            System.out.println(msgs);
        } else {
            JOptionPane.showMessageDialog(MoMA.guiFrame, msgs, "Gurobi Error?", JOptionPane.ERROR_MESSAGE);
            ulr.printStackTrace();
        }
        System.out.println("\n>>>>> Java library path: " + jlp + "\n");
        System.exit(99);
    }
    // ******* END CHECK GUROBI **** END CHECK GUROBI **** END CHECK GUROBI ********

    final MoMA main = new MoMA();
    if (!HEADLESS) {
        guiFrame = new JFrame();
        main.initMainWindow(guiFrame);
    }

    System.out.println("VERSION: " + VERSION_STRING);

    props = main.loadParams();
    BGREM_TEMPLATE_XMIN = Integer
            .parseInt(props.getProperty("BGREM_TEMPLATE_XMIN", Integer.toString(BGREM_TEMPLATE_XMIN)));
    BGREM_TEMPLATE_XMAX = Integer
            .parseInt(props.getProperty("BGREM_TEMPLATE_XMAX", Integer.toString(BGREM_TEMPLATE_XMAX)));
    BGREM_X_OFFSET = Integer.parseInt(props.getProperty("BGREM_X_OFFSET", Integer.toString(BGREM_X_OFFSET)));
    GL_WIDTH_IN_PIXELS = Integer
            .parseInt(props.getProperty("GL_WIDTH_IN_PIXELS", Integer.toString(GL_WIDTH_IN_PIXELS)));
    MOTHER_CELL_BOTTOM_TRICK_MAX_PIXELS = Integer.parseInt(props.getProperty(
            "MOTHER_CELL_BOTTOM_TRICK_MAX_PIXELS", Integer.toString(MOTHER_CELL_BOTTOM_TRICK_MAX_PIXELS)));
    GL_FLUORESCENCE_COLLECTION_WIDTH_IN_PIXELS = Integer
            .parseInt(props.getProperty("GL_FLUORESCENCE_COLLECTION_WIDTH_IN_PIXELS",
                    Integer.toString(GL_FLUORESCENCE_COLLECTION_WIDTH_IN_PIXELS)));
    GL_OFFSET_BOTTOM = Integer
            .parseInt(props.getProperty("GL_OFFSET_BOTTOM", Integer.toString(GL_OFFSET_BOTTOM)));
    if (GL_OFFSET_BOTTOM == -1) {
        GL_OFFSET_BOTTOM_AUTODETECT = true;
    } else {
        GL_OFFSET_BOTTOM_AUTODETECT = false;
    }
    GL_OFFSET_TOP = Integer.parseInt(props.getProperty("GL_OFFSET_TOP", Integer.toString(GL_OFFSET_TOP)));
    GL_OFFSET_LATERAL = Integer
            .parseInt(props.getProperty("GL_OFFSET_LATERAL", Integer.toString(GL_OFFSET_LATERAL)));
    MIN_CELL_LENGTH = Integer.parseInt(props.getProperty("MIN_CELL_LENGTH", Integer.toString(MIN_CELL_LENGTH)));
    MIN_GAP_CONTRAST = Float
            .parseFloat(props.getProperty("MIN_GAP_CONTRAST", Float.toString(MIN_GAP_CONTRAST)));
    SIGMA_PRE_SEGMENTATION_X = Float.parseFloat(
            props.getProperty("SIGMA_PRE_SEGMENTATION_X", Float.toString(SIGMA_PRE_SEGMENTATION_X)));
    SIGMA_PRE_SEGMENTATION_Y = Float.parseFloat(
            props.getProperty("SIGMA_PRE_SEGMENTATION_Y", Float.toString(SIGMA_PRE_SEGMENTATION_Y)));
    SIGMA_GL_DETECTION_X = Float
            .parseFloat(props.getProperty("SIGMA_GL_DETECTION_X", Float.toString(SIGMA_GL_DETECTION_X)));
    SIGMA_GL_DETECTION_Y = Float
            .parseFloat(props.getProperty("SIGMA_GL_DETECTION_Y", Float.toString(SIGMA_GL_DETECTION_Y)));
    SEGMENTATION_MIX_CT_INTO_PMFRF = Float.parseFloat(props.getProperty("SEGMENTATION_MIX_CT_INTO_PMFRF",
            Float.toString(SEGMENTATION_MIX_CT_INTO_PMFRF)));
    SEGMENTATION_CLASSIFIER_MODEL_FILE = props.getProperty("SEGMENTATION_CLASSIFIER_MODEL_FILE",
            SEGMENTATION_CLASSIFIER_MODEL_FILE);
    CELLSIZE_CLASSIFIER_MODEL_FILE = props.getProperty("CELLSIZE_CLASSIFIER_MODEL_FILE",
            CELLSIZE_CLASSIFIER_MODEL_FILE);
    DEFAULT_PATH = props.getProperty("DEFAULT_PATH", DEFAULT_PATH);

    GUROBI_TIME_LIMIT = Double
            .parseDouble(props.getProperty("GUROBI_TIME_LIMIT", Double.toString(GUROBI_TIME_LIMIT)));
    GUROBI_MAX_OPTIMALITY_GAP = Double.parseDouble(
            props.getProperty("GUROBI_MAX_OPTIMALITY_GAP", Double.toString(GUROBI_MAX_OPTIMALITY_GAP)));

    GUI_POS_X = Integer.parseInt(props.getProperty("GUI_POS_X", Integer.toString(DEFAULT_GUI_POS_X)));
    GUI_POS_Y = Integer.parseInt(props.getProperty("GUI_POS_Y", Integer.toString(DEFAULT_GUI_POS_X)));
    GUI_WIDTH = Integer.parseInt(props.getProperty("GUI_WIDTH", Integer.toString(GUI_WIDTH)));
    GUI_HEIGHT = Integer.parseInt(props.getProperty("GUI_HEIGHT", Integer.toString(GUI_HEIGHT)));
    GUI_CONSOLE_WIDTH = Integer
            .parseInt(props.getProperty("GUI_CONSOLE_WIDTH", Integer.toString(GUI_CONSOLE_WIDTH)));

    if (!HEADLESS) {
        // Iterate over all currently attached monitors and check if sceen
        // position is actually possible,
        // otherwise fall back to the DEFAULT values and ignore the ones
        // coming from the properties-file.
        boolean pos_ok = false;
        final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        final GraphicsDevice[] gs = ge.getScreenDevices();
        for (int i = 0; i < gs.length; i++) {
            if (gs[i].getDefaultConfiguration().getBounds()
                    .contains(new java.awt.Point(GUI_POS_X, GUI_POS_Y))) {
                pos_ok = true;
            }
        }
        // None of the screens contained the top-left window coordinates -->
        // fall back onto default values...
        if (!pos_ok) {
            GUI_POS_X = DEFAULT_GUI_POS_X;
            GUI_POS_Y = DEFAULT_GUI_POS_Y;
        }
    }

    String path = props.getProperty("import_path", System.getProperty("user.home"));
    if (inputFolder == null || inputFolder.equals("")) {
        inputFolder = main.showStartupDialog(guiFrame, path);
    }
    System.out.println("Default filename decoration = " + inputFolder.getName());
    defaultFilenameDecoration = inputFolder.getName();
    path = inputFolder.getAbsolutePath();
    props.setProperty("import_path", path);

    GrowthLineSegmentationMagic.setClassifier(SEGMENTATION_CLASSIFIER_MODEL_FILE, "");

    if (!HEADLESS) {
        // Setting up console window...
        main.initConsoleWindow();
        main.showConsoleWindow(true);
    }

    // ------------------------------------------------------------------------------------------------------
    // ------------------------------------------------------------------------------------------------------
    final MoMAModel mmm = new MoMAModel(main);
    instance = main;
    try {
        main.processDataFromFolder(path, minTime, maxTime, minChannelIdx, numChannels);
    } catch (final Exception e) {
        e.printStackTrace();
        System.exit(11);
    }
    // ------------------------------------------------------------------------------------------------------
    // ------------------------------------------------------------------------------------------------------

    // show loaded and annotated data
    if (showIJ) {
        new ImageJ();
        ImageJFunctions.show(main.imgRaw, "Rotated & cropped raw data");
        // ImageJFunctions.show( main.imgTemp, "Temporary" );
        // ImageJFunctions.show( main.imgAnnotated, "Annotated ARGB data" );

        // main.getCellSegmentedChannelImgs()
        // ImageJFunctions.show( main.imgClassified, "Classification" );
        // ImageJFunctions.show( main.getCellSegmentedChannelImgs(), "Segmentation" );
    }

    gui = new MoMAGui(mmm);

    if (!HEADLESS) {
        System.out.print("Build GUI...");
        main.showConsoleWindow(false);

        //         final JFrameSnapper snapper = new JFrameSnapper();
        //         snapper.addFrame( main.frameConsoleWindow );
        //         snapper.addFrame( guiFrame );

        gui.setVisible(true);
        guiFrame.add(gui);
        guiFrame.setSize(GUI_WIDTH, GUI_HEIGHT);
        guiFrame.setLocation(GUI_POS_X, GUI_POS_Y);
        guiFrame.setVisible(true);

        //         SwingUtilities.invokeLater( new Runnable() {
        //
        //            @Override
        //            public void run() {
        //               snapper.snapFrames( main.frameConsoleWindow, guiFrame, JFrameSnapper.EAST );
        //            }
        //         } );
        System.out.println(" done!");
    } else {
        //         final String name = inputFolder.getName();

        gui.exportHtmlOverview();
        gui.exportDataFiles();

        instance.saveParams();

        System.exit(0);
    }
}

From source file:Main.java

public static Rectangle computeVirtualGraphicsBounds() {
    Rectangle virtualBounds = new Rectangle();
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    for (GraphicsDevice gd : gs) {
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        virtualBounds = virtualBounds.union(gc.getBounds());
    }/*from www . j a v a 2 s .c  o m*/
    return virtualBounds;
}

From source file:Main.java

/** Returns the Screen resolution of all available displays. If ther's only one display you might use: {@link #getScreenSize()}
 * @return Screen resolution of all available displays.
 * @see #getScreenSize()/*from w  w  w .  j a  va  2s . co m*/
 */
public static Dimension[] getScreenSizes() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices(); // Get size of each screen
    Dimension[] dimension = new Dimension[gs.length];
    for (int i = 0; i < gs.length; i++) {
        DisplayMode dm = gs[i].getDisplayMode();
        dimension[i] = new Dimension(dm.getWidth(), dm.getHeight());
    }
    return dimension;
}