Example usage for javax.swing JDialog setVisible

List of usage examples for javax.swing JDialog setVisible

Introduction

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

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Dialog depending on the value of parameter b .

Usage

From source file:MainClass.java

public static void main(String[] a) {
    JOptionPane optionPane = new JOptionPane("Continue printing?", JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_OPTION);
    JDialog dialog = optionPane.createDialog(null, "Manual Creation");
    dialog.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] a) {

    String msg = "<html>this is a really long message<br>this is a really long message this is a really long message this is a really long message this is a really long message this is a really long message this is a really long message";

    JOptionPane optionPane = new JOptionPane();
    optionPane.setMessage(msg);/*w  ww  .j a  v  a2 s .  c  o  m*/
    optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = optionPane.createDialog(null, "Width 100");
    dialog.setVisible(true);
}

From source file:CreateDialogFromOptionPane.java

public static void main(final String[] args) {
    JFrame parent = new JFrame();
    JOptionPane optionPane = new JOptionPane("Continue printing?", JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_OPTION);
    JDialog dialog = optionPane.createDialog(parent, "Manual Creation");
    dialog.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();

    JDialog dialog = new JDialog(frame, "Dialog");
    dialog.pack();/*w  w w .j  a  v a2 s. c om*/
    dialog.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] a) {
    JOptionPane optionPane = new JOptionPane();
    optionPane.setMessage("Set Message");
    optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
    optionPane.setOptions(new Object[] { new JButton("Button") });
    JDialog dialog = optionPane.createDialog(null, "Icon/Text Button");
    dialog.setVisible(true);
}

From source file:ComplexMessageDemo.java

public static void main(String[] a) {

    Object complexMsg[] = { "Above Message", new ImageIcon("yourFile.gif"), new JButton("Hello"), new JSlider(),
            new ImageIcon("yourFile.gif"), "Below Message" };

    JOptionPane optionPane = new JOptionPane();
    optionPane.setMessage(complexMsg);//  ww w.  j a  v a 2  s.  c o m
    optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = optionPane.createDialog(null, "Width 100");
    dialog.setVisible(true);
}

From source file:DisplayingMultilineMessages.java

public static void main(String[] a) {

    String msg = "<html>this is a really long message<br>this is a really long message this is a really long message this is a really long message this is a really long message this is a really long message this is a really long message";

    JOptionPane optionPane = new NarrowOptionPane();
    optionPane.setMessage(msg);//from  www . j a  v  a  2s .c o m
    optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = optionPane.createDialog(null, "Width 100");
    dialog.setVisible(true);
}

From source file:Main.java

    public static void main(String[] args) {
  JOptionPane pane = new JOptionPane("JOptionPane",
      JOptionPane.INFORMATION_MESSAGE);
  String dialogTitle = "Resizable Custom Dialog";
  JDialog dialog = pane.createDialog(dialogTitle);
  dialog.setResizable(true);//from ww  w .  j a va2s .com
  dialog.setVisible(true);

}

From source file:JSliderOnJOptionPane.java

public static void main(final String[] args) {
    JFrame parent = new JFrame();

    JOptionPane optionPane = new JOptionPane();
    JSlider slider = getSlider(optionPane);
    optionPane.setMessage(new Object[] { "Select a value: ", slider });
    optionPane.setMessageType(JOptionPane.QUESTION_MESSAGE);
    optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
    JDialog dialog = optionPane.createDialog(parent, "My Slider");
    dialog.setVisible(true);
    System.out.println("Input: " + optionPane.getInputValue());
}

From source file:GettingJOptionPaneSelectionDemo.java

public static void main(String[] a) {

    String multiLineMsg[] = { "Hello,", "World" };
    JOptionPane pane = new JOptionPane();
    pane.setMessage(multiLineMsg);/* ww w. jav  a 2 s  . c  o  m*/
    JDialog d = pane.createDialog(null, "title");
    d.setVisible(true);
    int selection = getSelection(pane);

    switch (selection) {
    case JOptionPane.OK_OPTION:
        System.out.println("OK_OPTION");
        break;
    case JOptionPane.CANCEL_OPTION:
        System.out.println("CANCEL");
        break;
    default:
        System.out.println("Others");
    }

}