ScrollPane與TextArea組件
/**?* @(#)TestScrollPane.java
?*
?* TestScrollPane application
?*
?* @author
?* @version 1.00 2007/1/20
?*/
?import java.awt.*;
?import java.awt.event.*;
public class TestScrollPane extends Frame
{
??? public TestScrollPane()
??? {
??? ?TextArea ta=new TextArea("",10,50,TextArea.SCROLLBARS_NONE);
??? ?ScrollPane sp=new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
??? ?add(sp);
??? ?sp.add(ta);
??? ?addWindowListener(new WindowAdapter()
??? ?{
??? ??public void windowClosing(WindowEvent e)
??? ??{
??? ???e.getWindow().dispose();
??? ??}
??? ?});
??? }
??? public static void main(String[] args)
??? {
??? ?
??? ?// TODO, add your application code
??? ?System.out.println("Hello World!");
??? ?TestScrollPane mainFrame=new TestScrollPane();
??? ?mainFrame.setTitle("TestScrollPane");
??? ?mainFrame.setBounds(300,200,200,200);
??? ?mainFrame.setVisible(true);
??? }
}
posted on 2007-01-20 20:14 大頭劍客 閱讀(1042) 評論(0) 編輯 收藏 所屬分類: 學習筆記