[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中多继承问题 jsp问题,问检索与文件关联 JavaBean JSP之间传输数值乱码的问题,在线等 servlet控制线程的问题 大家帮忙看下我这个java程序是怎么错的啊?用Switch语句做出来的.. 无法实现下载 100分求问简单问题!!怎么把某一文件夹下图片文件打开并全部显示出来? 郁闷了.怎么没人能解决呢!!!!!!!!!!!!! 这道题应该选什么,以及原因,关于线程的,谢谢! 原来可以这样! 疑惑,十万火急:为什么我的所有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();
}
}