大家好,又见面了,我是你们的朋友全栈君。
- JOptionPane.showInputDialog(null, “Please choose a name”, “Example 1”,
- JOptionPane.QUESTION_MESSAGE, null, new Object[] {
- “Amanda”, “Colin”, “Don”, “Fred”, “Gordon”, “Janet”, “Jay”, “Joe”,
- “Judie”, “Kerstin”, “Lotus”, “Maciek”, “Mark”, “Mike”, “Mulhern”,
- “Oliver”, “Peter”, “Quaxo”, “Rita”, “Sandro”, “Tim”, “Will”}, “Joe”);
- JOptionPane.showInputDialog(null, “Please enter your name”, “Example 2”,
- JOptionPane.QUESTION_MESSAGE, null, null, “Shannon”);
- JOptionPane.showMessageDialog(null, “Have a nice day.”, “Example 3”,
- JOptionPane.INFORMATION_MESSAGE, new ImageIcon(“images/smile.gif”));
- JOptionPane.showConfirmDialog(null, “Are you sure?”, “Example 4”,
- JOptionPane.YES_NO_CANCEL_OPTION);
- JOptionPane.showInternalOptionDialog(desk, “Please select a color”,
- “Example 5”, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
- null, new Object[] {
“Red”, “Green”, “Blue”}, “Blue”); - JFrame f = new JFrame( );
- Container c = f.getContentPane( );
- c.setLayout(new BorderLayout( ));
- JOptionPane op = new JOptionPane(“Stop!”, JOptionPane.WARNING_MESSAGE);
- JPanel p = new JPanel(new FlowLayout( ));
- p.add(op);
- c.add(p);
- c.add(new JLabel(“Example 6”, JLabel.CENTER), BorderLayout.NORTH);
- f.setVisible(true);
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/151666.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...