Java Window modifyDimensions(Window window)

Here you can find the source of modifyDimensions(Window window)

Description

modify Dimensions

License

Apache License

Declaration

public static void modifyDimensions(Window window) 

Method Source Code

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

import javax.swing.*;

import java.awt.*;

public class Main {
    public static void modifyDimensions(Window window) {
        if (window instanceof JFrame) {
            if (((JFrame) window).getExtendedState() == JFrame.MAXIMIZED_BOTH) {
                return;
            }/*from  ww  w. j  ava 2  s. c o  m*/
        }
        Dimension result = window.getSize();
        Dimension maxDimension = Toolkit.getDefaultToolkit().getScreenSize();
        if (maxDimension.width < result.width) {
            result.width = maxDimension.width;
        }
        if (maxDimension.height < result.height) {
            result.height = maxDimension.height;
        }
        window.setSize(result);
    }
}

Related

  1. getWindowTitle(Window window)
  2. growIfNecessary(Window window)
  3. hideWaitPane(Window win, Timer timer)
  4. installPrefsHandler(final Preferences prefs, final String name, Window window)
  5. isResizable(Window window)
  6. openWindow(final JPanel panel)
  7. putWindowNormalBounds(Window window, Rectangle bounds)
  8. removeWindow(Window w)
  9. repaintMnemonicsInWindow(Window w)