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

📄 richman.java

📁 辛苦一个星期才写出来的
💻 JAVA
字号:
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;

class RichMan extends JFrame implements Runnable
{
 ImageIcon[] play_imgs = new ImageIcon[4];
 Player[] player = new Player[4];  
 Player user;
 ArrayList playing = new ArrayList();
 boolean restart=false, is_user_active=true;
 int round;
 
 ClassLoader cl = this.getClass().getClassLoader();
 Toolkit tk = Toolkit.getDefaultToolkit();
 
 PlayInformation play_information = new PlayInformation();
 AudioClip clip = Applet.newAudioClip(cl.getResource("pattern/ting.au"));
 AudioClip back_music = Applet.newAudioClip(cl.getResource("pattern/music.mid"));
	
 JRadioButtonMenuItem music_on = new JRadioButtonMenuItem("秨币", true);
 JRadioButtonMenuItem music_off = new JRadioButtonMenuItem("闽超");

 Icon dice_icon = new ImageIcon(cl.getResource("pattern/dice.gif"));
 JButton dice = new JButton(dice_icon);

 int territory_size=24;
 Territory territory[] = new Territory[territory_size];
 Bank bank;

 public RichMan()
 {
  super("Taiwan RichMan");

  bank= new Bank(this);

  for(int i=0; i<play_imgs.length; i++) 		
   play_imgs[i]= new ImageIcon(cl.getResource("pattern/"+i+".gif"));		

  JPanel game_map_top = new JPanel();
  JPanel game_map_top1 = new JPanel();
  JPanel game_map_down = new JPanel();
  JPanel game_map_down1 = new JPanel();
  JPanel game_map_left = new JPanel();
  JPanel game_map_left1 = new JPanel();
  JPanel game_map_right = new JPanel();
  JPanel game_map_right1 = new JPanel();

  game_map_top.setLayout(new GridLayout(1, 7, 0, 0));
  game_map_down.setLayout(new GridLayout(1, 7, 0, 0));
  game_map_left.setLayout(new GridLayout(5, 1, 0, 0));
  game_map_right.setLayout(new GridLayout(5, 1, 0, 0));

  Vector vector = Script.loadTerritoryData();
  Hashtable table =null;
  String temp_name;
  int temp_price;
  
  for(int i=0; i<territory_size; i++)
  {
   table = (Hashtable) vector.get(i);

   temp_name= (String)table.get("name");
   temp_price =Integer.parseInt((String)table.get("price"));

   territory[i] = new Territory(i, temp_name, temp_price);

   if(i<=6)
    game_map_top.add(territory[i], BorderLayout.CENTER);
   else if(i>=7 && i<=11)
    game_map_right.add(territory[i], BorderLayout.CENTER);
   else if(i>=12 && i<=18)
   {
    game_map_down.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    game_map_down.add(territory[i], BorderLayout.CENTER);
   }
   else if(i==23)
   {
    for(int z=23; z>=19; z--)
     game_map_left.add(territory[z], BorderLayout.CENTER);
   }
  }

  dice.setEnabled(false);
  dice.addActionListener
  (
   new ActionListener() 
   { 
    public void actionPerformed(ActionEvent event)
    {  
     StartThread();
    }
   }
  );

  Box tt = Box.createHorizontalBox();
  tt.add(dice, BorderLayout.CENTER);
  tt.add(Box.createHorizontalStrut(10));

  Box game_map_center = Box.createVerticalBox();
  game_map_center.add(Box.createVerticalStrut(130));
  game_map_center.add(tt);
  game_map_center.add(Box.createVerticalStrut(30));
  game_map_center.add(play_information, BorderLayout.CENTER);
  game_map_center.add(Box.createVerticalStrut(24));

  game_map_top1.add(game_map_top, BorderLayout.CENTER);
  game_map_down1.add(game_map_down, BorderLayout.CENTER);
  game_map_left1.add(game_map_left, BorderLayout.CENTER);
  game_map_right1.add(game_map_right, BorderLayout.CENTER);

  Box game_map_center1 = Box.createHorizontalBox();

  game_map_center1.add(game_map_left1);
  game_map_center1.add(Box.createHorizontalStrut(105));
  game_map_center1.add(game_map_center);  
  game_map_center1.add(Box.createHorizontalStrut(92));
  game_map_center1.add(game_map_right1);

  JMenuBar menu = new JMenuBar();
  setJMenuBar(menu);

  JMenu game_menu = new JMenu("笴栏");
  menu.add(game_menu);
  JMenuItem start_game = new JMenuItem("

⌨️ 快捷键说明

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