📄 60ae7db477fa001c187a96d076d31f00
字号:
package com.sans.ninemen.test;
import java.applet.*;
//required to paint on screen
import java.awt.*;
//the start of an applet - HelloWorld will be the executable class
//Extends applet means that you will build the code on the standard Applet class
public class GameManager extends Applet
{
public static boolean gameStatus=true;
public static int posArray;
public static String initialPosition="xxxxxxxxxxxxxxxxxxxxxxx";
//The method that will be automatically called when the applet is started
public void init()
{
// It is required but does not need anything.
}
//This method gets called when the applet is terminated
//That's when the user goes to another page or exits the browser.
public void stop()
{
// required but no actions neede here now.
}
//The standard method that you have to use to paint things on screen
//This overrides the empty Applet method, you can't called it "display" for example.
public void paint(Graphics g)
{
//method to draw text on screen
// String first, then x and y coordinate.
//g.drawString("Nine Men Morris",20,20);
int offset=100;
g.drawRect(0+offset, 0+offset, 500, 500);
g.drawRect(50+offset, 50+offset, 400, 400);
g.drawRect(100+offset, 100+offset, 300, 300);
g.drawLine(0+offset,0+offset, 100+offset, 100+offset);
g.drawLine(0+offset,500+offset, 100+offset, 400+offset);
g.drawLine(500+offset,0+offset, 400+offset, 100+offset);
g.drawLine(500+offset,500+offset, 400+offset, 400+offset);
g.drawLine(250+offset, 0+offset, 250+offset, 100+offset);
g.drawLine(0+offset, 250+offset, 100+offset, 250+offset);
g.drawLine(250+offset, 500+offset, 250+offset, 450+offset);
g.drawLine(500+offset, 250+offset, 400+offset, 250+offset);
while(gameStatus==false) {
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -