java滚动条不显示
importjava.awt.*;importjava.awt.event.*;publicclassAFrameextendsFrame{Labell1,l2;Text...
import java.awt.*;
import java.awt.event.*;
public class AFrame extends Frame
{
Label l1,l2;
TextField t1,t2;
TextArea ta1;
public AFrame(){
super("AFrameText");
this.setSize(400, 250);
this.setBackground(Color.lightGray);
this.setLocation(200,100);
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.add(l1=new Label("字体"));
this.add(t1=new TextField(4));
this.add(l2=new Label("颜色"));
this.add(t2=new TextField(4));
t1.setBackground(Color.LIGHT_GRAY);
t2.setBackground(Color.LIGHT_GRAY);
this.add(ta1=new TextArea("",100,100,TextArea.SCROLLBARS_VERTICAL_ONLY));
ta1.setBackground(Color.LIGHT_GRAY);
this.setVisible(true);
}
public static void main(String args[]){
new AFrame();
}
}
为什么不显示滚动条呢??没有用swing。 展开
import java.awt.event.*;
public class AFrame extends Frame
{
Label l1,l2;
TextField t1,t2;
TextArea ta1;
public AFrame(){
super("AFrameText");
this.setSize(400, 250);
this.setBackground(Color.lightGray);
this.setLocation(200,100);
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.add(l1=new Label("字体"));
this.add(t1=new TextField(4));
this.add(l2=new Label("颜色"));
this.add(t2=new TextField(4));
t1.setBackground(Color.LIGHT_GRAY);
t2.setBackground(Color.LIGHT_GRAY);
this.add(ta1=new TextArea("",100,100,TextArea.SCROLLBARS_VERTICAL_ONLY));
ta1.setBackground(Color.LIGHT_GRAY);
this.setVisible(true);
}
public static void main(String args[]){
new AFrame();
}
}
为什么不显示滚动条呢??没有用swing。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询