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

📄 monopolybutton.java

📁 以 applet 形式 实现大富翁 ,java 环境开发
💻 JAVA
字号:
import java.applet.Applet;import java.awt.event.*;import java.awt.image.*;import java.lang.*;import java.util.*;import java.net.*;import java.awt.*;import java.io.*;//The class the draws the buttons on the right side of the board.//in our final copy of the game we didn't used this java code. there //are many reasons buy the mainour because of our game design strategy.//however, we encourage others who will develop this game further to modify // the game using this file..//its not hard to use and if you want help you can always contact us at//ahmedobaid@hotmail.com//thankyou and enjoy..!public class MonopolyButton {	public int X = 510;	public int Y = 0;	public int Width  = 100;	public int Height = 26;	public Font font = new Font( "Helvetica", Font.PLAIN, 16 );	private FontMetrics fm;	private String label = "";	public MonopolyButton( String label ) {		this.label = label;	}	public void Draw( Graphics g ) {		g.setFont( font );		fm = g.getFontMetrics();		int w = fm.stringWidth( label );		g.setColor(Color.lightGray);		g.fill3DRect( X, Y, Width, Height, true );		g.setColor( Color.black );		if( label != "$50" )			g.drawString( label, X+Width/2-w/2, Y+18 );		else			g.drawString( label, X+Width/2-w/2, Y+13 );		g.setColor( Color.red );		if( label != "$50" )			g.drawString( label.substring(0,1), X+Width/2-w/2, Y+18 );		else			g.drawString( label.substring(0,1), X+Width/2-w/2, Y+13 );	}	public boolean isInside( int x, int y ) {		if( x>X && x<X+Width && y>Y && y<Y+Height )			return true;		return false;	}	public void actionPerformed( ActionEvent e ) {	    }}

⌨️ 快捷键说明

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