jb1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JFrame jf1 = new JFrame();
myjpanel mj = new myjpanel(); //this will call paintComponent method
jf1.jf1.getContentPane().add(mj);
jf1.setSize(300,150);
jf1.setVisible(true);
//Graphics g = getGraphics();
//mj.paintComponent(g);
}
});
public void actionPerformed(ActionEvent e){
JFrame jf1 = new JFrame();
myjpanel mj = new myjpanel(); //this will call paintComponent method
jf1.jf1.getContentPane().add(mj);
jf1.setSize(300,150);
jf1.setVisible(true);
//Graphics g = getGraphics();
//mj.paintComponent(g);
}
});
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货