📄 help4.java
字号:
package help;
import java.awt.*;
import java.awt.event.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.*;
public class help4 implements ActionListener{
JFrame f=new JFrame("帮助1");
JTextArea t1=new JTextArea(0,20);//文本域
JPanel p1=new JPanel();
Container ct=f.getContentPane();
JButton b1=new JButton("返 回");
File f3; //创建文件
BufferedReader source3;//文件读取缓冲区
String temp;//临时字符缓冲区
public static void main(String args[]) throws FileNotFoundException
{new help4();}
public help4() throws FileNotFoundException {
f3=new File("help","用户使用帮助.txt");//创建文件 读取文件路劲
source3=new BufferedReader(new FileReader(f3)); //读取文件中的数据到缓冲区
ct.setLayout(new BorderLayout());//括号内的内容不能为NULL
p1.setLayout(null);
p1.setBorder(BorderFactory.createTitledBorder("用户管理帮助!"));
b1.setBounds(580,520,100,30);
b1.setFont(new java.awt.Font("Dialog",0,20));
b1.addActionListener(this);
p1.add(b1);
t1.setTabSize(1);
t1.setFont(new Font("华文仿宋",Font.BOLD,15));
t1.setForeground(new Color(115,20,120));
t1.setLineWrap(true);
t1.setWrapStyleWord(true);
t1.setEditable(false);
try //将文件中的数据写入到JTextArea中
{while((temp=source3.readLine())!=null)
{ t1.append("\n"); //换行
t1.append("\t\t"+temp); //追加到文本末尾
}
source3.close();
}catch(IOException err){err.printStackTrace();}
ImageIcon icon=new ImageIcon("picture/1.jpg");
JLabel j1=new JLabel(icon,JLabel.CENTER);
JScrollPane jsp=new JScrollPane(t1);
jsp.setBounds(25,30,500,500);
p1.add(jsp,null);
j1.setText("");
j1.setBounds(10,16,780,560);
p1.add(j1);
ct.add(p1);
f.setSize(760,600);
f.setResizable(false);
f.setLocationRelativeTo(null);
f.setVisible(true);
//f.show();
//f.addWindowListener(new WindowAdapter()
//{public void windowClosing(WindowEvent e){System.exit(0);}});
}
public void actionPerformed(ActionEvent e)
{f.dispose();}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -