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

📄 help2.java

📁 运动会成绩管理系统
💻 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 help2 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 f2;  //创建文件
	BufferedReader source2;//文件读取缓冲区
	String temp;//临时字符缓冲区

public static void main(String args[]) throws FileNotFoundException
{new help2();}

public help2() throws FileNotFoundException {
		
f2=new File("help","成绩管理帮助.txt");//创建文件 读取文件路劲
source2=new BufferedReader(new FileReader(f2));  //读取文件中的数据到缓冲区
	
	
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=source2.readLine())!=null)

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


ImageIcon icon=new ImageIcon("picture/11.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.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 + -