wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Problem with JButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JButton" Watch "Problem with JButton" New topic
Author

Problem with JButton

paul beppe
Ranch Hand

Joined: Aug 09, 2012
Posts: 81
in this code i have problems with buttonPause and buttonPlay:



where is the error???
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2095
    
    7
You haven't stated what the problem is.

A couple of problems with your code:

1. I don't know what the "scroll" variable is.

2. The easiest way to do animation is to create and ImageIcon and add the Icon to a JLabel and add the JLabel to your panel. Then when you want to move the label you just invoke setLocation(...) on the label. There is no need for a custom class to keep track ofe the location.
 
wood burning stoves
 
subject: Problem with JButton
 
Similar Threads
Timer Trouble
Problems loading image into a JLabel located in a JScrollPane
Timer
Swing Animation....
Why can't my button's Image Icon change when i set Icon???