Example usage for javax.swing JInternalFrame getY

List of usage examples for javax.swing JInternalFrame getY

Introduction

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

Prototype

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

Source Link

Document

Returns the current y 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  ava 2 s. com*/
    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));
}