http://expert.csdn.net/Expert/topic/2351/2351047.xml?temp=.849972
解决方案 »
- url返回xml中节点值是中文——乱码
- Java 日期和时间的问题请教
- import javax.servlet.*; 提示包没找到?
- whether input value is Chinese character and give notification
- 在servlet中怎样获得当前的URL路径?
- 求找到一个18位长的素数的算法
- 在一个普通的bean中怎么调用连接池?
- forte和jbuilder哪个更合适开发?jbuider的光标怎么回事?
- 到底错在哪? 在线等待~~~急
- 《算法》第四版java 调试归并排序,输入格式的问题?
- 将一个窗体最小化时隐藏到系统栏里,如何实现?
- applet的问题???
jb1.setActionCommand("ok");
jb1.addActionListener(this);
public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if (str.equals("ok"))
{
studentchangeinfo sci = new studentchangeinfo();
sci.init();
sci.setVisible(true); }
import java.awt.event.*;
import javax.swing.*;class aa extends JFrame implements ActionListener
{
JButton buttonFrame2;
JFrame frame2;
JPanel pane;
aa()
{
super("Frame test");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buttonFrame2=new JButton("打开Frame2");
buttonFrame2.addActionListener(this);
pane=new JPanel();
pane.add(buttonFrame2);
getContentPane().add(pane);
setSize(300,300);
show();
frame2=new JFrame("Frame2");
frame2.setSize(200,200);
frame2.setVisible(false);
}
public static void main(String[] arguments)
{
aa a=new aa();
}
public void actionPerformed(ActionEvent evt)
{
Object obj=evt.getSource();
if(obj instanceof JButton)
{
JButton source=(JButton)obj;
//注意下面的代码实现显示第2个窗口
if(source==buttonFrame2)
{
frame2.setVisible(true);
}
}
}
}