Home Discussion Discuss: Java Programming: Section 6.4

  • Using MouseEvent with array of JButtonriel December 19, 2011 at 7:08 AM

    I have an 2d array of JButton as a grid for a battleship game. Each Jbutton on the grid is registered with MouseListener. I want to set each button, whenever player click on it,the MouseEvent will do something on it.(fill the button with color or something) My question is, how do I let the program knows when player click on that particular button. Hope someone here can help me, I need to find this urgently. Thank you in advance.

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Programming Tutorials

Java Programming: Section 6.4
Section 6.4 Mouse Events EVENTS ARE CENTRAL to programming... in general. The next section will cover keyboard events. Java also has other... in Section 5.6. (To review briefly: An interface in Java is just a list 

Java Beginners

how to print the content of file in 2d matrix having same dimension as given in file(n*m).
0.2 3.3 4.7 9.1 4.0 5.4 5.1 3.2 6.1 2.1 6.4 2.6 here in program i have 

Programming Tutorials

How to get given index value from FloatBuffer in java.
How to get given index value from FloatBuffer in java.  In this tutorial, we will discuss how to get given index value from FloatBuffer in java... C:\>java IndexValueDemo All values in float buffer. 4.2 5.1 

Java Beginners

how to find subarray from given large 2d array of arbritary dimension
4.6 5.1 0.2 3.3 4.7 9.1 4.0 5.4 5.1 3.2 6.1 2.1 6.4 2.6 1.2 2.0 3.5 6.9 3.1 

Travel

Latitude and Longitude of Sierra Leone
, Sierra Leone is home to a population of approximately 6.4 million according 

Programming Tutorials

Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.4 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook. Exercise 6.4: In Exercise 3.5, you drew a checkerboard. For this exercise 

Programming Tutorials

Voip Glossary
with the G.723.1 voice algorithm at 6.4 kbps is 24 bytes long.     VOIP 

Programming Tutorials

Java Programming: Chapter 6 Exercises
programming exercises based on material from Chapter 6 of this on-line Java textbook.... Now make a pair-of-dice applet that uses the methods discussed in Section 6.6.... to the content pane.) See the solution! Exercise 6.4: In Exercise 3.5 

Programming Tutorials

Java Programming: Section 8.2
if Java were available.) One of the examples in Section 6.4... Section 8.2 Programming with Arrays ARRAYS ARE THE MOST BASIC... -- will be covered in Section 4. This section introduces some of the basic ideas of array