打字练习软件源代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
打字练习软件源代码
1
2
import javax.swing.*;
3
import java.awt.*;
4
5
6
/**
7
* This code was edited or generated using CloudGarden's Jigloo
8
* SWT/Swing GUI Builder, which is free for non-commercial
9
* use. If Jigloo is being used commercially (ie, by a corporation,
10
* company or business for any purpose whatever) then you
11
* should purchase a license for each developer using Jigloo.
12
* Please visit for details.
13
* Use of Jigloo implies acceptance of these licensing terms.
14
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
15
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
16
* LEGALL Y FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
17
18
public class Chat extends JInternalFrame{
19
MainFrame parent;
private JTextPane jtp;
20
21
private JTextField txtData;
22
23
public Chat(MainFrame parent){
24
this.parent=parent;
25
26
setLayer(4);
27
setBounds(1,326,0,0);
28
this.setPreferredSize(new java.awt.Dimension(140, 223));
29
((javax.swing.plaf.basic.BasicInternalFrameUI) this.getUI()).setNorthPane(null);
30
this.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
31
GridBagLayout thisLayout = new GridBagLayout();
32
thisLayout.rowWeights = new double[] {0.1, 0.1, 0.0, 0.0};
thisLayout.rowHeights = new int[] {7, 7, 49, 56};
33
34
thisLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 0.0};
35
thisLayout.columnWidths = new int[] {0, 45, 45, 48};
getContentPane().setLayout(thisLayout);
36
37
setVisible(true);
38
pack();
39
{
40
jtp = new JTextPane();
41
getContentPane().add(jtp, new GridBagConstraints(1, 0, 4, 5, 0.0, 0.0,
42
GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
43
jtp.setPreferredSize(new Dimension(140, 160));
44
jtp.setEditable(false);
45
}
46
{
47
txtData = new JTextField();
48
getContentPane().add(txtData, new GridBagConstraints(1, 7, 3, 1, 0.0, 0.0, 49
GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
txtData.setColumns(10);
50
51
}
52
}
53
}
54
55
import java.io.*;
56
public class DistillText {
57
public static String getData(String fileName,int segment){
58
int i=0;
59
if((fileName==null) || (fileName.length()==0))
60
return"";
61
File f;
62
FileReader in=null;
63
String s="";
64
try{
65
f=new File(fileName);
66
in=new FileReader(f);
67
char[] buffer=new char[312];
68
int len;
69
if(ng.equals("English")){
70
if(segment>=(int)(f.length()/312))
71
PublicData.textTag=0;
72
}
73
if(ng.equals("Chinese")){
74
if(segment>=(int)(f.length()/312-1)+1)
75
PublicData.textTag=0;
76
}
77
while((len=in.read(buffer))!=-1){
78
s=new String(buffer,0,len);
79
i++;
80
if(i==segment){
81
PublicData.textTag++;
82
break;
83
}
84
}
85
}