Java examples for Swing:Insets
Insets class represents spaces that are left around a container.
Insets class has four properties named top, left, bottom, and right.
Insets class is in the java.awt package.
import java.awt.Insets; import javax.swing.JFrame; public class Main { public static void main(String[] argv) throws Exception { // Create an object of the Insets class // with Insets(top, left, bottom, right) Insets ins = new Insets(20, 5, 5, 5); JFrame frame = new JFrame("title"); // Get the insets of a JFrame ins = frame.getInsets();// ww w . j av a2s. c o m int top = ins.top; int left = ins.left; int bottom = ins.bottom; int right = ins.right; } }