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

📄 help.java

📁 这是我我完成的java的课程设计,是一个宾馆管理系统
💻 JAVA
字号:
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 help implements ActionListener{
public void show() {	
	final JFrame f=new JFrame("关于宾馆信息管理系统");
	JTextArea t1=new JTextArea(20,0);//文本域
	JPanel p1=new JPanel();
	Container ct=f.getContentPane();
	JButton bt1=new JButton("返   回");
	File f1;  //创建文件
	BufferedReader source1 = null;//文件读取缓冲区
	String temp;//临时字符缓冲区
f1=new File("help","宾馆信息管理.txt");//创建文件 读取文件路劲
try {
	source1=new BufferedReader(new FileReader(f1));
} catch (FileNotFoundException e) {
	e.printStackTrace();
}  //读取文件中的数据到缓冲区	
ct.setLayout(new BorderLayout());//括号内的内容不能为NULL
p1.setLayout(null);
p1.setBorder(BorderFactory.createTitledBorder("关于宾馆信息管理系统!"));

bt1.setBounds(580,520,100,30);
bt1.setFont(new java.awt.Font("Dialog",0,20));
p1.add(bt1);

t1.setTabSize(1);
t1.setFont(new Font("华文楷体",Font.BOLD,15));
t1.setBackground(new Color(255,255,255));
t1.setLineWrap(true);
t1.setWrapStyleWord(true);
t1.setEditable(false);

try   //将文件中的数据写入到JTextArea中
{while((temp=source1.readLine())!=null)

{   t1.append("\n");  //换行
	t1.append("\t\t"+temp);  //追加到文本末尾	
}

}catch(IOException err){err.printStackTrace();}

ImageIcon icon=new ImageIcon("ICON/tp2.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,580);
f.setResizable(false);

f.setLocationRelativeTo(null);
f.setVisible(true);
bt1.addActionListener(new ActionListener(){
	public void actionPerformed(ActionEvent e) {
		f.dispose();
		}
	});


}

public void actionPerformed(ActionEvent e)
{show();}
}

⌨️ 快捷键说明

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