📄 zuoye3.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author Administrator */import java.awt.*;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;import javax.swing.*;import java.awt.event.*;public class ZuoYe3 extends JFrame implements ActionListener{ JButton button; JTextArea text ; public ZuoYe3(){ JPanel p1=new JPanel(); JPanel p2=new JPanel(); Container container= getContentPane(); container.setLayout(new BorderLayout()); p2.setLayout(new BorderLayout()); p1.setLayout(new FlowLayout()); p1.add(button=new JButton("Open file")); container.add(p1,BorderLayout.NORTH); container.add(text=new JTextArea(),BorderLayout.CENTER); button.addActionListener(this); } public void actionPerformed(ActionEvent e){ if(e.getSource() == button){ FileDialog d=new FileDialog(new ZuoYe3()," FileDialog "); d.setVisible(true); String fiilename=d.getFile(); text.append(d.getDirectory()+"\n"); } } public static void main(String[] args){ ZuoYe3 frame=new ZuoYe3(); frame.setTitle("example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400,250); frame.setVisible(true);}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -