Java JComponent Container getLocalInsetBounds(JComponent component)

Here you can find the source of getLocalInsetBounds(JComponent component)

Description

get Local Inset Bounds

License

Open Source License

Parameter

Parameter Description
component The JComponent to work with.

Return

The local, inset, bounds of the specified .

Declaration

public static Rectangle getLocalInsetBounds(JComponent component) 

Method Source Code

//package com.java2s;
/*//from w w  w.j  av a 2  s.c o  m
 * Copyright (c) 1998-2017 by Richard A. Wilkes. All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, version 2.0. If a copy of the MPL was not distributed with
 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This Source Code Form is "Incompatible With Secondary Licenses", as
 * defined by the Mozilla Public License, version 2.0.
 */

import java.awt.Insets;

import java.awt.Rectangle;

import javax.swing.JComponent;

public class Main {
    /**
     * @param component The {@link JComponent} to work with.
     * @return The local, inset, bounds of the specified {@link JComponent}.
     */
    public static Rectangle getLocalInsetBounds(JComponent component) {
        Insets insets = component.getInsets();
        return new Rectangle(insets.left, insets.top, component.getWidth() - (insets.left + insets.right),
                component.getHeight() - (insets.top + insets.bottom));
    }
}

Related

  1. getGtkStyle(Object styleFactory, JComponent component, String regionName)
  2. getGtkStyle(Object styleFactory, JComponent component, String regionName)
  3. getInputHint(JComponent comp)
  4. getInsetBounds(JComponent comp)
  5. getInterior(JComponent comp)
  6. getMandatoryPanel(JComponent c)
  7. getMaxVisibleY(JComponent comp)
  8. getModelObject(JComponent c)
  9. getOutermostRootPane(Component c)