Java JComponent Container getInsetBounds(JComponent comp)

Here you can find the source of getInsetBounds(JComponent comp)

Description

get Inset Bounds

License

Open Source License

Declaration

public static Rectangle getInsetBounds(JComponent comp) 

Method Source Code


//package com.java2s;
/*/*from w w w .j  av  a2s  .com*/
 * This file is part of the Jose Project
 * see http://jose-chess.sourceforge.net/
 * (c) 2002-2006 Peter Sch?fer
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 */

import javax.swing.*;

import java.awt.*;

public class Main {
    public static Rectangle getInsetBounds(JComponent comp) {
        Rectangle bounds = comp.getBounds();
        Insets ins = comp.getInsets();
        if (ins != null) {
            bounds.x += ins.left;
            bounds.y += ins.top;
            bounds.width -= ins.right + ins.left;
            bounds.height -= ins.top + ins.bottom;
        }
        return bounds;
    }
}

Related

  1. getFirstChildComponentOfType(Component component, Class childComponentType)
  2. getGlassPane(JComponent comp)
  3. getGtkStyle(Object styleFactory, JComponent component, String regionName)
  4. getGtkStyle(Object styleFactory, JComponent component, String regionName)
  5. getInputHint(JComponent comp)
  6. getInterior(JComponent comp)
  7. getLocalInsetBounds(JComponent component)
  8. getMandatoryPanel(JComponent c)
  9. getMaxVisibleY(JComponent comp)