HZAU_Parser(六)
" ";
}
area3+="\n";
jTextArea3.setText(jTextArea3.getText()+area3);
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
}
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//删除按钮
String del=jTextArea3.getSelectedText();
String sum=jTextArea3.getText();
int i=sum.lastIndexOf(del)+del.length();
System.out.println(del);
// System.out.println(sum);
if(sum.length()==del.length())
{
jTextArea3.setText("");
}
else if(sum.indexOf(del)!=0)
{
String last=sum.substring(0,sum.indexOf(del)-1)+sum.substring(i, sum.length()-1)+"\n";
jTextArea3.setText(last);
}
else {
String last=sum.substring(i+1, sum.length()-1);
jTextArea3.setText(last);
}
}
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//保存
String []Substring=jTextArea3.getText().split("\n");
//pathName=pathName.substring(0, pathName.length()-4);
//System.out.println(pathName);
File file1=new File(pathName+jTextField4.getText());
jTextField4.setText( fileName1+"-"+count+".txt");
count++;
jTextArea3.setText("");
StringBuffer bf=new StringBuffer("");
try {
BufferedWriter bufw;
bufw = new BufferedWriter(new FileWriter(file1));
for(int i=0;i
/* If Nimbus (introduced in
Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.
html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LanguageLabel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LanguageLabel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LanguageLabel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LanguageLabel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LanguageLabel().setVisible(true);
}
});
}
//打开文件
void Open()
{
//打开文件
/*变量声明
* fileChooser:文件选择器,选择要打开的文件
* selectFile:选择的文件
* fileName:选择的文件的名字
* pathName:选择文件的路径
* tempString:文件中的内容
*/
fileChooser.showOpenDialog(this);
File selectFile = fileChooser.getSelectedFile();
if (selectFile == null) {
JOptionPane.showMessageDialog(this, "你没有选择要打开的文件!", "提示:", JOptionPane.INFORMATION_MESSAGE);
return;
} else {
BufferedReader buffRead = null;
pathName = selectFile.getPath();
fileName = selectFile.getName();
count=1;
fileName=fileName.substring(0, fileName.length()-4);
fileName1=fileName;
fileName=fileName+"-"+count+".txt";
pathName=pathName.substring(0, pathName.indexOf(fileName1));
count++;
jTextField4.setText(fileName);
//System.out.println(