Example usage for javax.swing JDialog getPreferredSize

List of usage examples for javax.swing JDialog getPreferredSize

Introduction

In this page you can find the example usage for javax.swing JDialog getPreferredSize.

Prototype

public Dimension getPreferredSize() 

Source Link

Document

Returns the preferred size of this container.

Usage

From source file:Main.java

public static void openDialogNextToParent(final JComponent parentComponent, final JDialog dialog) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override//from w  ww .  j a va  2s.com
        public void run() {
            if (parentComponent != null) {
                Point parentLocation = parentComponent.getLocationOnScreen();
                parentLocation.x += parentComponent.getWidth();
                dialog.setLocation(parentLocation);
            }
            dialog.setVisible(true);
            dialog.setSize(dialog.getPreferredSize());
        }
    });
}

From source file:com.att.aro.ui.view.diagnostictab.GraphPanel.java

public void launchSliderDialog(int indexKey) {
    GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendViews("StartupDelayDialog");
    IVideoPlayer player = parent.getVideoPlayer();
    double maxDuration = player.getDuration();
    if (maxDuration != -1) {
        JDialog dialog = new SliderDialogBox(this, maxDuration, chunkInfo, indexKey, vcPlot.getAllChunks());
        dialog.pack();//from w  w  w  .  jav a2s . c  om
        dialog.setSize(dialog.getPreferredSize());
        dialog.validate();
        dialog.setModalityType(ModalityType.APPLICATION_MODAL);
        dialog.setVisible(true);
    }
}

From source file:com.osparking.attendant.AttListForm.java

private void displayHelpDialog(JButton PWHelpButton, String title, String helpText, boolean isPassword) {
    JDialog helpDialog = new PWHelpJDialog(this, false, title, helpText, isPassword);
    int helpHt = helpDialog.getPreferredSize().height / 2;
    Point buttonLoc = getLocationOnCurrentScreen(PWHelpButton);
    Point topLeft = new Point(buttonLoc.x + 30, buttonLoc.y - helpHt);

    helpDialog.setLocation(topLeft);/*  w  ww.j a va  2s .c  o m*/
    helpDialog.setVisible(true);
}