Java Code Examples for javax.swing.JFrame.getLocation()

The following are Jave code examples for showing how to use getLocation() of the javax.swing.JFrame class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: marathonv5   File: Framework.java   View Source Code Vote up 6 votes
public void makeNewWindow() {
    JFrame frame = new MyFrame(this);
    numWindows++;
    System.out.println("Number of windows: " + numWindows);

    if (lastLocation != null) {
        // Move the window over and down 40 pixels.
        lastLocation.translate(40, 40);
        if ((lastLocation.x > maxX) || (lastLocation.y > maxY)) {
            lastLocation.setLocation(0, 0);
        }
        frame.setLocation(lastLocation);
    } else {
        lastLocation = frame.getLocation();
    }

    System.out.println("Frame location: " + lastLocation);
    frame.setVisible(true);
}