import java.awt.*;
import java.awt.event.*;
public class text1 extends WindowAdapter
{
private TextArea text;
public static void main(String argv[])
{
text1 t = new text1();
}
public text1()
{
Frame fra = new Frame("TEXT");
fra.setSize(700, 600);
fra.setLocation(200, 140);
fra.setBackground(Color.LIGHT_GRAY);
fra.setVisible(true);
text = new TextArea("", 40, 40, TextArea.SCROLLBARS_VERTICAL_ONLY);
fra.add(text);
fra.addWindowListener(this);
} public void windowOpened(WindowEvent e)
{
text.setFont(new Font("Dialog", 0, 18));
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}运行时,为什么要改变一下窗体大小才能看到?
import java.awt.event.*;
public class text1 extends WindowAdapter
{
private TextArea text;
public static void main(String argv[])
{
text1 t = new text1();
}
public text1()
{
Frame fra = new Frame("TEXT");
fra.setSize(700, 600);
fra.setLocation(200, 140);
fra.setBackground(Color.LIGHT_GRAY);
fra.setVisible(true);
text = new TextArea("", 40, 40, TextArea.SCROLLBARS_VERTICAL_ONLY);
fra.add(text);
fra.addWindowListener(this);
} public void windowOpened(WindowEvent e)
{
text.setFont(new Font("Dialog", 0, 18));
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}运行时,为什么要改变一下窗体大小才能看到?
解决方案 »
- 静态数组怎么转换成ArrayList?
- 请问有什么方法提高使用大量浮点运算时的性能
- 有人用opencms的标签吗?
- candlestick如何定位到图中的item?
- 如何在java中将exl的数据导入数据库?
- Oracle连接的简单问题,在线等待!
- 一个关于运行时间的疑惑
- 关于FileDialog类,简单问题 ,高分求助
- 请问各位高手,基于swing框架的,有什么好的开源的组件?
- Javaj是伪泛型, 为什么可以做到消除强制类型转化
- 请教各位高手callablestatement的out参数用法
- 我扩展一个JFrame类,不想通过getContentPane()来获得内容框,而是用rootPane.contentPane.add()来添加JPanel,却不可以通过编译,怎么回事呀
{
Frame fra = new Frame("TEXT");
fra.setLocation(200, 140);
fra.setBackground(Color.LIGHT_GRAY);
text = new TextArea("", 40, 40, TextArea.SCROLLBARS_VERTICAL_ONLY);
fra.add(text);
fra.addWindowListener(this);
// 换了下位置
fra.setSize(700, 600);
fra.setVisible(true);
}