| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 809 人关注过本帖
标题:AWT 的问题
取消只看楼主 加入收藏
zhao9302
Rank: 1
等 级:新手上路
帖 子:170
专家分:0
注 册:2007-5-10
收藏
 问题点数:0 回复次数:2 
AWT 的问题
import java.awt.*;
import java.awt.event.*;


public class ChatClient extends Frame
{
    public static void main(String agrs[])
    {
        new ChatClient().getFrame();
    }
    
    private void getFrame()
    {
        this.setLocation(400, 200);
        this.setSize(300, 400);
        this.setVisible(true);
        this.setResizable(false);
        this.setTitle("ChatWindow");
        
        this.addWindowListener(new WindowAdapter()
        {
            public void windowClosing(WindowEvent e)
            {
                System.exit(0);
            }
        });
        
        getTextArea();
        getTextField();
        getCancelButton();
        getSendButton();
    }
    
    private void getTextArea()
    {
        TextArea ta = new TextArea();
        ta.setSize(280,250);
        ta.setLocation(10, 40);
    
        this.add(ta);
    }
    
    private void getTextField()
    {
        TextField tf = new TextField();
        tf.setSize(280, 40);
        tf.setLocation(10, 300);
        
        this.add(tf);    
    }
    
    private void getCancelButton()
    {
        Button cancelButton = new Button();
        cancelButton.setLocation(170,350);
        cancelButton.setSize(60, 30);
        cancelButton.setLabel("取消");
        
        cancelButton.addActionListener(new ActionListener()
        {

            public void actionPerformed(ActionEvent arg0)
            {
                // TODO Auto-generated method stub
                System.exit(0);
                
            }
                
        });
        
        this.add(cancelButton);    
    }
    
    private void getSendButton()
    {
        Button sendButton = new Button();
        sendButton.setLocation(70, 350);
        sendButton.setSize(60, 30);
        sendButton.setLabel("发送");
        
        this.add(sendButton);
    }
}

上面是我的代码
 我现在有两个问题
1.如何使得TextField 和 TextArea能够自动的换行
2.this.setResizable(false);这句话不要的话 将会导致页面变的乱七八糟 有啥办法可以使得最大化页面的大体样子不变么 难道只能用 设计划分页面为N个模块
搜索更多相关主题的帖子: AWT void awt public java 
2008-08-16 14:10
zhao9302
Rank: 1
等 级:新手上路
帖 子:170
专家分:0
注 册:2007-5-10
收藏
得分:0 
咋没人来看下呢?

我要一步一步往上爬……
2008-08-16 22:05
zhao9302
Rank: 1
等 级:新手上路
帖 子:170
专家分:0
注 册:2007-5-10
收藏
得分:0 
谢谢啦

我要一步一步往上爬……
2008-08-19 22:48
快速回复:AWT 的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016783 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved