Example usage for java.awt Frame getX

List of usage examples for java.awt Frame getX

Introduction

In this page you can find the example usage for java.awt Frame getX.

Prototype

public int getX() 

Source Link

Document

Returns the current x coordinate of the components origin.

Usage

From source file:edu.ucla.stat.SOCR.motionchart.MotionMouseListener.java

protected Point getDialogLocation(JDialog dialog, Component c) {
    Frame frame = JOptionPane.getFrameForComponent(c);
    int x = frame.getX() + (frame.getWidth() - dialog.getWidth()) / 2;
    int y = frame.getY() + (frame.getHeight() - dialog.getHeight()) / 2;
    return new Point(x, y);
}

From source file:net.ontopia.topicmaps.viz.AboutFrame.java

public AboutFrame(Frame parent) {
    super(parent, Messages.getString("Viz.About", "Ontopia Vizigator"), true);

    JPanel mainPanel = new JPanel();
    mainPanel.setBackground(Color.white);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(createImagePanel());//from   ww  w .  j a v a  2s.  c  o  m
    mainPanel.add(createAboutTextPanel());

    this.getContentPane().add(mainPanel);
    this.pack();
    this.setResizable(false);
    //    Center the dialog box above its parent
    this.setLocation((parent.getX() + (parent.getWidth() - this.getWidth()) / 2),
            parent.getY() + (parent.getHeight() - this.getHeight()) / 2);
}