想做这样的一个窗口,在窗口中间调用applet显示动画效果,该如何做呢?
解决方案 »
- LINUX 下运行Tomcat出错,命令出现乱码
- 帮我写写这简单的sql
- foreach语句......不懂
- 怎么运行不了的JSP
- 表单验证后该怎样返回错误信息?
- 解析xml文件时,在得到dom树的同时,如何得到各元素在xml文件的位置信息(某元素的开始标签在第几行第几列?
- 有谁帮帮小弟:有道程序改一下,简单的。。
- My first Java PG :Anyone can help me to add the print function ?
- 有scjp证书,大学英语四级,六级证书.希望在上海找一份JAVA程序员的工作,哪位老兄可以给介绍引荐一下.拜托了!
- 字符串效率低,有没有办法像C一样用字符串宏来代表数字?
- 运行下面的代码试试、dialog.setVisible(true);有没有这句、拖动窗体(win xp下)、窗体不能正确绘制、ubuntu能正常绘制
- 知道了 数据库用户ID 和 密码 怎样判断能否连接上
import java.awt.event.*;
import javax.swing.*;
public class MyApplet extends JApplet
{
public void init ()
{
JButton btnOK = new JButton ("OK");
final JTextField txt = new JTextField ();
btnOK.addActionListener (new ActionListener ()
{
public void actionPerformed (ActionEvent arg0)
{
PopFrame main = new PopFrame ();
main.setSize(200, 100);
main.setModal(true);
main.show();
String strValue = main.getValue();
txt.setText(strValue);
}
});
getContentPane ().add(txt, BorderLayout.NORTH);
getContentPane ().add(btnOK, BorderLayout.SOUTH);
}
public class PopFrame extends JDialog
{
JTextField txt = null;
JButton btnOK = null;
PopFrame ()
{
txt = new JTextField ();
getContentPane ().add(txt, BorderLayout.NORTH);
btnOK = new JButton("OK");
getContentPane ().add(btnOK, BorderLayout.SOUTH);
btnOK.addActionListener (new ActionListener ()
{
public void actionPerformed (ActionEvent arg0)
{
hide ();
}
});
}
public String getValue ()
{
return (txt.getText());
}
}
}