怎么实现TextArea自动适应面板
在Panel上添加了一个TextArea,然后把这个Panel加到窗口上。怎么实现当窗口改变时,Panel上的TextArea也能跟着改变,保持原来的比例。比如原来这个TextArea是铺满整个Panel,怎么实现当窗口最大化时TextArea依然能铺满整个Panel?...还有Java中对响应窗口最大化时事件是什么?
谢谢了各位!
import java.awt.*; import java.awt.event.*; class a extends Frame{ a(){ setSize(800,600); setLayout(null); setVisible(true); addWindowStateListener(new winAdapter()); addWindowListener(new winAdapter()); TextArea te=new TextArea(); add(te); te.setBounds(30,30,750,500); } } public class aa{ public static void main(String j[]){ a r=new a(); } } class winAdapter extends WindowAdapter{ public void windowClosing(WindowEvent windowEvent) { System.exit(0); } public void windowStateChanged(WindowEvent windowEvent){ System.out.println("老子变化了"); } public void windowActivated(WindowEvent windowEvent){ System.out.println("老子变化了1"); } }