⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 第九次作业第二题.txt

📁 编写一个有两个文本框和一个按钮的应用程序,在一个文本框输入一个字符串按回车键或者单击按钮,另一个文本框都显示字符串中每个字符在unicode表中的顺序位置。
💻 TXT
字号:
import java.awt.event.*; 
import java.io.*; 
import javax.swing.*; 

public class Jfilechooser extends JFrame implements ActionListener 
{ 

JButton button; 
JTextArea text; 
JTextPane textpane; 
FileInputStream readfile; 
JScrollPane scroll; 
Container con; 
JFileChooser chooser=new JFileChooser(); 


public Jfilechooser() 
{ 
super("窗口"); 
button=new JButton("打开文件"); 
button.addActionListener(this); 
textpane=new JTextPane(); 
scroll=new JScrollPane(textpane); 

setSize( new Dimension(400,400)); 
setVisible(true); 
con=getContentPane(); 
con.add(button,BorderLayout.NORTH); 
con.add(scroll,BorderLayout.CENTER); 
addWindowListener(new WindowAdapter() { 
public void windowClosing(WindowEvent e) { 
dispose();System.exit(0);}}); 
} 

public void actionPerformed(ActionEvent e) 
{ 
if(e.getSource()==button) 
{ 
String s; 
int state =chooser.showOpenDialog(null); 
Process p1 = Runtime.getRuntime().exec("notepad d:\\1234.txt"); 

File file=new File("c:\\hello.txt"); 
BufferedReader br = new BufferedReader(new FileReader(read)); 
catch(IOException e1) 
{ 
e1.printStackTrace(); 
} 
} 
} 
} 
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -