[Swing求助]JOptionPane.showOptionDialog获取用户输入 use JOptionPane.showInputDialog() 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 那个好像只有一个 textField吧我想有多个怎么办??谢了!! 那你就干脆用JDialog,然后你就可以在上面加你想加的Component! 对,继承一个JDialog,给个例子你class AboutDialog extends JDialog implements ActionListener { public AboutDialog(Frame parent, String title, String message) { super(parent, title, true); if (parent != null) { Dimension parentSize = parent.getSize(); Point p = parent.getLocation(); setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4); } JPanel messagePane = new JPanel(); messagePane.add(new JLabel(message)); getContentPane().add(messagePane); JPanel buttonPane = new JPanel(); JButton button = new JButton("OK"); buttonPane.add(button); button.addActionListener(this); getContentPane().add(buttonPane, BorderLayout.SOUTH); setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.pack(); this.setVisible(true); } public void actionPerformed(ActionEvent e) { this.setVisible(false); this.dispose(); } } JAVA如何实现可配置的EXE程序? 问一个问题 可以帮我看看吗?? 哪位帮传一个JAVA与SQL2000的驱动程序,小弟笨了点没有找到 一群按钮都要注册一个事件怎么办啊 ,如果挨个注册太慢,加入ButtonGroup又无法注册监听器?? Vector java.io java.awt这些类具体藏在哪 急问表单提交中的空字符问题 question on java awt中有树形组件吗?像swing中的JTree. 如何实现java2 中表的打印? 疑惑,十万火急:为什么我的所有java程序都不能运行了? 谁有O'Reilly出版的《Java Virtual Machine》的ebook?
class AboutDialog
extends JDialog
implements ActionListener { public AboutDialog(Frame parent, String title, String message) {
super(parent, title, true);
if (parent != null) {
Dimension parentSize = parent.getSize();
Point p = parent.getLocation();
setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4);
}
JPanel messagePane = new JPanel();
messagePane.add(new JLabel(message));
getContentPane().add(messagePane); JPanel buttonPane = new JPanel();
JButton button = new JButton("OK");
buttonPane.add(button);
button.addActionListener(this);
getContentPane().add(buttonPane, BorderLayout.SOUTH);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.pack();
this.setVisible(true);
} public void actionPerformed(ActionEvent e) {
this.setVisible(false);
this.dispose();
}
}