| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 542 人关注过本帖
标题:与大家分享,同时感谢几位高手的指点!!!
只看楼主 加入收藏
wsjmt2334031
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2004-11-17
收藏
 问题点数:0 回复次数:4 
与大家分享,同时感谢几位高手的指点!!!

感谢大家前几天的不吝指教,小弟,前几天的程序的错误,已经完全改正了,并且程序也改了不少地方,删除了个函数!!!传上来和大家一起分享了!!
哈哈,不要发笑啊!!!!!哦,对了,程序中的 古风猫 是我的QQ名字,呵呵,!!!别见怪!!!
import java.awt.*;
import java.awt.event.*;

public class dictionary extends Frame implements ActionListener,ItemListener
{
static dictionary frm=new dictionary();
static Label lab1=new Label("中文释义为:");
static Label lab2=new Label();
static TextField tex=new TextField();
static Button btn=new Button("添加");
static Choice cho=new Choice();
String Eng[]=new String[15];String Chi[]=new String[15];
int j=0;
int a=0;

public static void main(String args[])
{
frm.setLayout(null);
frm.setTitle("o3级计算机应用与维护");
frm.setBounds(50,10,700,700);
lab1.setBounds(100,100,300,100);
lab2.setBounds(100,250,400,100);
tex.setBounds(100,400,500,100);
btn.setBounds(100,550,100,100);
cho.setBounds(250,550,300,300);
cho.add("英文单词");
tex.addActionListener(frm); // tex.addTextListener(frm);
btn.addActionListener(frm);
cho.addItemListener(frm);
frm.add(lab1);
frm.add(lab2);
frm.add(tex);
frm.add(btn);
frm.add(cho);
Font fnt=new Font("Serief",Font.BOLD,20);
lab1.setAlignment(Label.CENTER);
lab1.setFont(fnt);
lab2.setFont(fnt);
lab2.setAlignment(Label.LEFT);
tex.setFont(fnt);
btn.setFont(fnt);
lab1.setBackground(Color.orange);
lab2.setBackground(Color.yellow);
tex.setBackground(Color.blue);
btn.setBackground(Color.green);
cho.setBackground(Color.red);
lab1.setForeground(Color.red);
lab2.setForeground(Color.blue);
tex.setForeground(Color.yellow);
btn.setForeground(Color.pink);
cho.setForeground(Color.blue);

frm.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==tex)
{
//int a=0;
a++;
System.out.println(a+"次输入");
System.out.println("古风猫写");
if(a>15)
System.out.println("太多了,不能写到下拉列表里了");

}
else if(e.getSource()==btn)
{
String str;
char c;
int i=1;
str=tex.getText();
c=str.charAt(i);
while(c!='#')
{
i++;
c=str.charAt(i);
}
//
if(j<15)
{
Eng[j]=new String();
Chi[j]=new String();
Eng[j]=str.substring(0,i);
Chi[j]=str.substring(i+1);

}
if(cho.getItemCount()<=15)
cho.add(Eng[j]);
tex.setText(" ");
j++;
}
}
public void itemStateChanged(ItemEvent e)
{
int dex;
dex=cho.getSelectedIndex();
lab2.setText(Chi[dex-1]);
}
}

搜索更多相关主题的帖子: 感谢 分享 
2005-12-31 10:13
tody
Rank: 1
等 级:新手上路
威 望:2
帖 子:119
专家分:0
注 册:2005-11-17
收藏
得分:0 
运行不了?!还是有逻辑错误?!

记录就是用来破的, 自尊就是用来伤的。
2005-12-31 10:33
wsjmt2334031
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2004-11-17
收藏
得分:0 
不是吧,我运行好了才发上来的,你运行是什么错误啊,我的jdk 是1.4,你的呢??
好好看看啊,哥们!!!!
2005-12-31 11:00
rick
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-1-4
收藏
得分:0 
写的不错!
2006-01-04 21:03
bagger
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:33
帖 子:891
专家分:0
注 册:2005-8-16
收藏
得分:0 

你的程序要完成的是什么啊???
好象没有达到要达到的目的吧!


【三元毕业设计论文】
三元论文真的只有三元钱
客服QQ:742670649
http://shop35094218./
2006-01-05 09:12
快速回复:与大家分享,同时感谢几位高手的指点!!!
数据加载中...
 
   



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

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