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

📄 recordview.java

📁 该程序源码是我大二暑假时用Java语言写的一个贪食蛇游戏
💻 JAVA
字号:
package SnakeGame;

import java.awt.*;
import javax.swing.*;
import java.util.Properties;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Enumeration;
import java.awt.Rectangle;
import java.awt.Font;


public class recordView extends JFrame
{

  JLabel PAI = new JLabel("排名榜");
  JLabel sort = new JLabel("名次");
  JLabel name = new JLabel("姓名");
  JLabel score = new JLabel("分数");
  JPanel jNorth = new JPanel();
  JPanel jCenter = new JPanel();
  JLabel lSort = new JLabel("1");
  JLabel lName = new JLabel();
  JLabel lScore = new JLabel();
  public recordView()
  {
    super();
    this.setTitle("The Best Grade");
    this.setSize(250,150);
    this.setResizable(false);
    this.setAlwaysOnTop(true);
    this.setLocation(350,300);
    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    Container con = this.getContentPane();
    con.setLayout(new BorderLayout());

    PAI.setFont(new Font("Dialog",Font.PLAIN,25));
    PAI.setForeground(Color.RED);

    con.add(jNorth,BorderLayout.NORTH);
    con.add(jCenter,BorderLayout.CENTER);
    jNorth.setLayout(new FlowLayout());
    jNorth.add(PAI,FlowLayout.LEFT);
    jCenter.setLayout(new GridLayout(2,3));
    jCenter.add(sort);
    jCenter.add(name);
    jCenter.add(score);
    jCenter.add(lSort);
    jCenter.add(lName);
    jCenter.add(lScore);
    }
  public void getRecord()
  {
    Properties pp = new Properties();
    try{
      pp.load(new FileInputStream("miracle.ini"));
      Enumeration enumt= pp.propertyNames();
      String name=new String("");
      String score=new String("");
      while(enumt.hasMoreElements())
      {
        name = (String)enumt.nextElement();
        score = (String)(pp.getProperty(name));
      }
      lName.setText(name);
      lScore.setText(score);
    }catch(Exception e)
    {
      System.out.println("Cann't find the file");
      System.out.println(e.getMessage());
    }
  }

}

⌨️ 快捷键说明

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