主题:[讨论]container类明明有个具体类,为什么不能显示了?
import javax.swing.JFrame;
import java.awt.*;
public class Driver1 {
public Driver1(){
JFrame theWin=new JFrame("sdfa");
theWin.setBounds(0,0,200,200);
theWin.setVisible(true);
Container pp1=new Container();
pp1.setBounds(50,50,100,100);
pp1.setBackground(Color.red);
theWin.add(pp1,0);//这里明明添加了container对象,为什么没看见红色的矩形框了,而我在container对象上放其他对象,就又显示pp1矩形,这个疑问怎么解决落,请各位说说理由,或者怎么让container对象显示~~~~~~重分酬谢 [em2]
theWin.repaint();
}
public static void main(String[] args){
Driver1 pp=new Driver1();
}
}
import java.awt.*;
public class Driver1 {
public Driver1(){
JFrame theWin=new JFrame("sdfa");
theWin.setBounds(0,0,200,200);
theWin.setVisible(true);
Container pp1=new Container();
pp1.setBounds(50,50,100,100);
pp1.setBackground(Color.red);
theWin.add(pp1,0);//这里明明添加了container对象,为什么没看见红色的矩形框了,而我在container对象上放其他对象,就又显示pp1矩形,这个疑问怎么解决落,请各位说说理由,或者怎么让container对象显示~~~~~~重分酬谢 [em2]
theWin.repaint();
}
public static void main(String[] args){
Driver1 pp=new Driver1();
}
}