想用java生成如下图界面,前提:这个界面是属于二级界面的,所以已经继承了JInternalFrame
补充:public class nwsubarea extends JInternalFrame{//窗口与面板
JInternalFrame jif;
public nwsubarea(){
System.out.println("============");
jif = this;
repaint();
}
public void paint(Graphics g) {
System.out.println("+++++++++++");
Graphics2D g2d = (Graphics2D) g;
Stroke st = g2d.getStroke();
Stroke bs;
bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL,
0, new float[] { 16, 4 }, 0);
g2d.setStroke(bs);
g2d.drawLine(10, 10, 10, 500);
g2d.setStroke(st);
}
}
这段代码中的=========可以输出,++++++就无法输出了,怎么改呢???
追问:嗯,是的,没调用到,说是repaint();可以调用,我试了试,没法调用,应该怎么调用啊?构造函数里面写上paint(),总是出错。高手,帮忙改个完整的呗,我对swing组件不熟悉,,谢谢啊!嗯,没事!