public class Temp { JFrame frame1 = new JFrame("frame1");
JFrame frame2 = new JFrame("frame2");
JMenuBar jMenuBar1 = new JMenuBar();
JMenu jMenu1 = new JMenu("MENU");
JMenuItem menuItem = new JMenuItem("ShowGirl"); public Temp() {
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame1.setVisible(false);
frame2.show();
}
});
frame2.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
frame2.dispose();
frame1.setVisible(true);
}
}); jMenu1.add(menuItem);
jMenuBar1.add(jMenu1);
frame1.setJMenuBar(jMenuBar1);
frame1.setBounds(100,100,300,300);
frame2.setBounds(200,200,200,200);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame1.show();
}
public static void main(String[] args) {
new Temp();
}
JFrame frame2 = new JFrame("frame2");
JMenuBar jMenuBar1 = new JMenuBar();
JMenu jMenu1 = new JMenu("MENU");
JMenuItem menuItem = new JMenuItem("ShowGirl"); public Temp() {
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame1.setVisible(false);
frame2.show();
}
});
frame2.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
frame2.dispose();
frame1.setVisible(true);
}
}); jMenu1.add(menuItem);
jMenuBar1.add(jMenu1);
frame1.setJMenuBar(jMenuBar1);
frame1.setBounds(100,100,300,300);
frame2.setBounds(200,200,200,200);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame1.show();
}
public static void main(String[] args) {
new Temp();
}
解决方案 »
- 生产者与消费者:Scala的Actor实现
- 字符串排序
- 懂DES 加密算法的进
- oracle 如何提高查询速度
- 1、如何的到某个字符的指定的编码比方说“中国”的gb2312或uf8或unicode或iso8859-1编码?2、一个程序的不理解
- 求救:哪位有树结点显示成checkbox的javascript代吗!!
- 很简单的程序,但是有大麻烦
- 会聚csdn中的所有java jni 高手可能都解决不了这jni问题,我一天发一问连续三个星期,坚持再坚持还没有碰到jni 高手,高手太少了,这一帖
- 在JTextArea中能否用两种以上的Font???
- java的原理是什么?
- 关于JNI中java调用本地dll的问题
- 请问:Jwindows\Jdialog\JFrame各自有什么不同之处?
<body ONUNLOAD="exit1();">
<SCRIPT LANGUAGE="Javascript"> <!-- HIDE SCRIPT FORM OLD BROWSERS// OPEN EXIT CONSOLEvar q=1;function exit1() {if (q==1) window.open("www.sina.com.cn","timexet"); self.focus();}// STOP HIDING SCRIPT FROM OLD BROWSERS --> </SCRIPT>
这样就可以了
就尽量在客户端完成。除了有效性验证。
毕竟客户端不是很安全,可以绕过去。
JFrame.NORMAL=Frame.NORMAL
for JFrame extends Frame在frame1中这样做
frame2 temp=new frame2();
当然temp里面的显示啊什么的你在Class frame2里面定义就可以了
frame1.setVisable(false);事先frame1应该是打开着的.在frame2中这样做
temp.setVisable(true);
frame2.dispose();