Java JFrame giveFrameHalfScreen(final JFrame frame)

Here you can find the source of giveFrameHalfScreen(final JFrame frame)

Description

give Frame Half Screen

License

LGPL

Declaration

private static void giveFrameHalfScreen(final JFrame frame) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import javax.swing.*;
import java.awt.*;

public class Main {
    private static void giveFrameHalfScreen(final JFrame frame) {
        final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

        final Rectangle winSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
        final int taskBarHeight = screenSize.height - winSize.height;

        final int width = (int) (screenSize.width * 0.505);
        final int height = screenSize.height - taskBarHeight;

        frame.setSize(width, height);/*  www  . j ava 2 s. c om*/
    }
}

Related

  1. getRootJFrame(Component component)
  2. getTheJFrame(String title, int width, int height, int x, int y)
  3. getTopJFrame(Container c)
  4. getUserInput(JFrame _frame, String arg1, String arg2, Object arg3)
  5. getViewMenu(JFrame mainFrame)
  6. igualarFormularios(JFrame destino, JFrame origen)
  7. inputFiles(JFrame argParent)
  8. installEscapeCloseOperation(final JFrame dialog)
  9. internalizeFrame(JFrame frame)