Example usage for javax.swing JInternalFrame getX

List of usage examples for javax.swing JInternalFrame getX

Introduction

In this page you can find the example usage for javax.swing JInternalFrame getX.

Prototype

@BeanProperty(bound = false)
public int getX() 

Source Link

Document

Returns the current x coordinate of the component's origin.

Usage

From source file:Main.java

public Main() {
    JInternalFrame frame1 = new JInternalFrame("Frame 1", true, true, true, true);

    JInternalFrame frame2 = new JInternalFrame("Frame 2", true, true, true, true);

    frame1.getContentPane().add(new JLabel("Frame 1  contents..."));
    frame1.pack();/*  w w  w .  j a va 2  s  . c  o m*/
    frame1.setVisible(true);

    frame2.getContentPane().add(new JLabel("Frame 2  contents..."));
    frame2.pack();
    frame2.setVisible(true);

    int x2 = frame1.getX() + frame1.getWidth() + 10;
    int y2 = frame1.getY();
    frame2.setLocation(x2, y2);

    desktopPane.add(frame1);
    desktopPane.add(frame2);

    this.add(desktopPane, BorderLayout.CENTER);

    this.setMinimumSize(new Dimension(300, 300));
}