List of usage examples for javax.swing JOptionPane showInternalInputDialog
public static String showInternalInputDialog(Component parentComponent, Object message)
parentComponent
. From source file:Main.java
public static void main(String[] args) { JDesktopPane dp = new JDesktopPane(); JInternalFrame inf = new JInternalFrame("Help", true, true, true, true); inf.setSize(200, 200);//from w w w . j a v a 2 s. c o m inf.setVisible(true); dp.add(inf); JButton btn = new JButton("Click"); btn.addActionListener(e -> JOptionPane.showInternalInputDialog(inf, "Hit me")); inf.add(btn); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); f.add(dp); f.setSize(400, 400); f.setVisible(true); }
From source file:MainClass.java
public MainClass(String title) { super(title); setDefaultCloseOperation(EXIT_ON_CLOSE); final JDesktopPane desk = new JDesktopPane(); setContentPane(desk);//from w w w. ja va 2 s . c o m JOptionPane.showInternalInputDialog(desk, "Enter Name"); }
From source file:DialogDesktop.java
public DialogDesktop(String title) { super(title); setDefaultCloseOperation(EXIT_ON_CLOSE); final JDesktopPane desk = new JDesktopPane(); setContentPane(desk);//from www . j a v a 2 s . c o m // Create our "real" application container; use any layout manager we // want. final JPanel p = new JPanel(new GridBagLayout()); // Listen for desktop resize events so we can resize p. This will ensure // that // our container always fills the entire desktop. desk.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent ev) { Dimension deskSize = desk.getSize(); p.setBounds(0, 0, deskSize.width, deskSize.height); p.validate(); } }); // Add our application panel to the desktop. Any layer below the // MODAL_LAYER // (where the dialogs will appear) is fine. We'll just use the default // in // this example. desk.add(p); // Fill out our app with a few buttons that create dialogs JButton input = new JButton("Input"); JButton confirm = new JButton("Confirm"); JButton message = new JButton("Message"); p.add(input); p.add(confirm); p.add(message); input.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JOptionPane.showInternalInputDialog(desk, "Enter Name"); } }); confirm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JOptionPane.showInternalConfirmDialog(desk, "Is this OK?"); } }); message.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JOptionPane.showInternalMessageDialog(desk, "The End"); } }); }