In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
 
            
                     
                
2025-10-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to achieve simple Chinese chess with java". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve simple Chinese chess with java".
Running effect
Code
Import java.awt.Canvas;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.awt.image.BufferedImage;import java.util.Random;import java.util.Stack;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JOptionPane Public class Chinesechese extends Canvas implements MouseListener {class Record {int fromx,fromy,tox,toy,fromindex,toindex; Record (int fromx,int fromy,int tox,int toy,int fromindex,int toindex) {this.fromx=fromx; this.fromy=fromy; this.tox=tox; this.toy=toy; this.fromindex=fromindex; this.toindex=toindex } int take_x=-1,take_y=-1,player=0; boolean isRuning=true; int table [] [] = new int [10] [11]; String name [] = {"," general "," official "," elephant "," soldier "," gun "," pawn "," handsome "," scholar "," phase "," horse "," chariot "," gun "," soldier "} Int value [] = {0pet1000, 3pyrrh, 3pje, 3pyrr5, BufferedImage map = new BufferedImage (500,600, BufferedImage.TYPE_INT_RGB); BufferedImage offScreenImage = new BufferedImage (500,600, BufferedImage.TYPE_INT_RGB); BufferedImage runImage = new BufferedImage (500,600, BufferedImage.TYPE_INT_RGB); Stack recordstk=new Stack () Chinesechese () {this.addMouseListener (this); this.setBounds (150,0550,600); this.setBackground (Color.BLACK); Graphics g=map.getGraphics (); g.setColor (Color.WHITE); g.fillRect (0,0Magne500,570); g.setColor (Color.black); g.setFont (new Font ("Dialog", 0jing35)) G.drawString ("Chu he Han Jie", 130,285); for (int item0)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about

The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r


A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from

Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





 
             
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.