I am new to game programming in Java, especially on the graphics front, hence I would like to seek some advice on how to implement the following game graphically in Java.
The game is very simple, it displays a square which is further divided into a 2×2 boxes, and the game playing is to put a total of 44 chips into these 4 boxes, and the user should be able to drag and drop the chips from one box to another.
That’s it! My questions:
- is there ready-made library I can use for drawing the square consists of the 4 boxes as well as the chips?
- if the answer to 1) is no, then is there any tutorial I can follow to program them myself?
- How to implement the drag and drop part graphically?
Many thanks.
Chips can be represented by an Icon added to a JLabel.
Squares can be represented by a JPanel.
Start by reading the section from the Swing tutorial on How to Use Icons. There are other section of interest as well: How to Use Panels, Using Layout Managers, How to Write a MouseListener, The section on drag and drop maybe.