ali*_*rco 0 java swing joptionpane
所以我有这段代码。
String input;
input = JOptionPane.showInputDialog("Type words:");
Run Code Online (Sandbox Code Playgroud)
JFrame如果此代码位于我的内部,如何显示输入mouseListener?
我没有使用,System.out.println()因为它仅在控制台中打印。
怎么样这个?
String input;
input = JOptionPane.showInputDialog("Type words:");
JOptionPane.showMessageDialog(null, input);
Run Code Online (Sandbox Code Playgroud)
如果您确实需要在新产品上显示它JFrame,您可以创建一个新产品JFrame并添加input到JLabel;
JFrame frame = new JFrame("The Title");
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setSize(100,100);
frame.getContentPane().add(new JLabel(input));
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5235 次 |
| 最近记录: |