How to use Java to realize Chinese Chess Game
This article introduces the relevant knowledge of "how to use Java to achieve Chinese chess games". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. Interface
The chess board should first be prepared, which is an interface of the right size, the right proportion and the right position, and then draw (yes, drawLine's) n lines and slashes on the form, the specific value is set according to the size of your interface. The interface drawn in this way is neat and looks good.
Public void paint (Graphics g) {super.paint (g); / / rewrite the drawing function Font f=new Font( "Microsoft Yahei", Font.BOLD,30); g.setFont (f); g.drawRect (60,50,500,560); / / Outer ring g.drawRect (70,60,480,540); / / Inner ring / / horizontal line part int length=60 For (int iTuno Bandi)