| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 498 人关注过本帖
标题:大家看看是怎么回事?
只看楼主 加入收藏
hbqzbl
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2011-12-21
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:1 
大家看看是怎么回事?
程序:
//
import java.awt.*;
import java.awt.event.*;
//import java.swing.*;
import *;
import *;


public class LoginDemol6 extends Frame implements ActionListener , ItemListener
{
    Label ly = new Label("请输入你的个人信息,账号和密码,单击确定");
    Label lLogin = new Label("账号:");
    Label lKey = new Label("密码:");
    Label lName = new Label("姓名:");
    Label lSex = new Label("性别:");
    Label lBd = new Label("生日:");
    Label lHobby = new Label("爱好:");
    TextField tLogin  = new TextField("",6);
    TextField tKey = new TextField("",6);
   
    TextField tName = new TextField("",6);
    CheckboxGroup nannv = new CheckboxGroup();
    Checkbox nan = new Checkbox("男",nannv,true);
    Checkbox nv = new Checkbox("女",nannv,false);
     
    Choice cn = new Choice();
    Choice cy = new Choice();
    Choice cr = new Choice();

    Checkbox c1 = new Checkbox("电影",false);
    Checkbox c2 = new Checkbox("阅读",false);
    Checkbox c3 = new Checkbox("网络",false);
    Checkbox c4 = new Checkbox("编程",false);
    Checkbox c5 = new Checkbox("艺术",false);
    Checkbox c6 = new Checkbox("旅游",false);
    Checkbox c7 = new Checkbox("游戏",false);
    Checkbox c8 = new Checkbox("其他",false);
    TextArea ta = new TextArea("",3,30);
    Button qd = new Button("确定");
    Button tc = new Button("退出");
    String Sex = "",Year = "",Month = "",Day= "";
    String Film = "",Reading = "",Network = "",Program = "",Art = "",Tourism = "",Game = "",Others = "";
    String strKey = "";
    Boolean flag = true;
    public LoginDemol6()
    {
        setTitle("用户个人信息");
        setLayout(new FlowLayout());
        add(ly);
        add(lLogin);
        add(tLogin);
        add(lKey);
        tKey.setEchoChar('*');
        add(tKey);
        add(lName);
        add(tName);
        add(lSex);
        nan.addItemListener(this);
        nv.addItemListener(this);
        add(nan);
        add(nv);
        add(lBd);
        String a[]=new String[5];
        int i, s = 0;
        for (i=1990;s<a.length;i++ )
        {
            a[s] = new String();
            a[s].append(i+"年");
            cn.add(a[s]);
        }
        cy.add("11月");
        cy.add("12月");
        cr.add("11日");
        cr.add("12日");
        cn.addItemListener(this);
        cy.addItemListener(this);
        cr.addItemListener(this);
        add(cn);
        add(cy);
        add(cr);
        add(lHobby);
        c1.addItemListener(this);
        c2.addItemListener(this);
        c3.addItemListener(this);
        c4.addItemListener(this);
        c5.addItemListener(this);
        c6.addItemListener(this);
        c7.addItemListener(this);
        c8.addItemListener(this);
        add(c1);
        add(c2);
        add(c3);
        add(c4);
        add(new Label(" "));
        add(new Label(" "));
        add(c5);
        add(c6);
        add(c7);
        add(c8);
        qd.addActionListener(this);
        tc.addActionListener(this);
        add(ta);
        add(qd);
        add(tc);
        setSize(260,320);
        setVisible(true);
        addWindowListener(new WindowAdapter()
                          {
                           public void windowClosing(WindowEvent e)
                              {
                               System.exit(0);
                              }
                          });
    }
    public void actionPerformed(ActionEvent ae)
    {
        ta.setText("");
        if (ae.getSource() == qd)
        {
            
            if (flag == true)
            {
                flag = false;
                ta.append("姓名:"+tName.getText()+"\n");
                ta.append("性别:"+Sex+"\n");
                ta.append("生日:"+Year+Month+Day+"\n");
                ta.append("爱好:"+Film+Reading+Network+Program+Art+Tourism+Game+Others+"\n");
                strKey = tKey.getText();
                tKey.setText("");
                ly.setText("请再次输入密码,然后单击确定");
            }
            else
            {
                if (tKey.getText().equals(strKey))
                {
                    ly.setText("注册成功!");
                }
                else
                {
                    ly.setText("密码与上次不符,请再次输入密码!");
                }
            }
        }
        else
        {
            System.exit(0);
        }
    }
    public void itemStateChanged(ItemEvent e)
    {
        if (nan.getState())
        {
            Sex = nan.getLabel();
        }
        if (nv.getState())
        {
            Sex = nv.getLabel();
        }
        if (e.getItemSelectable() == cn)
        {
            Year = cn.getSelectedItem();
        }
        if (e.getItemSelectable() == cy)
        {
            Month = cy.getSelectedItem();
        }
        if (e.getItemSelectable() == cr)
        {
            Day = cr.getSelectedItem();
        }
        if (c1.getState())
        {
            Film = c1.getLabel();
        }
        if (c2.getState())
        {
            Reading = c2.getLabel();
        }
        if (c3.getState())
        {
            Network = c3.getLabel();
        }
        if (c4.getState())
        {
            Program = c4.getLabel();
        }
        if (c5.getState())
        {
            Art = c5.getLabel();
        }
        if (c6.getState())
        {
            Tourism = c6.getLabel();
        }
        if (c7.getState())
        {
            Game = c7.getLabel();
        }
        if (c8.getState())
        {
            Others = c8.getLabel();
        }
    }
   
    public static void main(String args[])
    {
        new LoginDemol6();
    }
}
编译时出现如下错误:
E:\java>javac LoginDemol6.java
LoginDemol6.java:68: 找不到符号
符号: 方法 append(java.lang.String)
位置: 类 java.lang.String
            a[s].append(i+"年");
                ^
1 错误
搜索更多相关主题的帖子: 密码 生日 public import 个人信息 
2012-04-03 18:00
hsh_1987
Rank: 5Rank: 5
等 级:职业侠客
威 望:4
帖 子:92
专家分:343
注 册:2010-3-30
收藏
得分:10 
String类是没有这个方法(append)的,append它在StringBuffer类中。建议楼主多看帮助手册。

努力很重要,决心比努力更重要...........
2012-04-05 18:06
快速回复:大家看看是怎么回事?
数据加载中...
 
   



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

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