• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSlider works but doesn't "slide"

 
Joshua Amy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm currently learning how swing works and trying to write a program that allows a user to add stars to a canvas (an exercise set forth in Roberts' Art and Science of Java). Everything works except the slider, which doesn't actually "slide" when I run it from eclipse. It does what it's supposed to do, (resize the stars), but the slider button itself doesn't move when you grab it and slide left or right. Is this a problem with the code or something strange in Eclipse, perhaps? Any help is appreciated.

 
Joshua Amy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Furthermore, when you use the JComboBox, it will select the right color, but only shows the default "White" in the combo box.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both the comboBox and slider worked OK for me.

problem is likely to be in your custom classes
 
Joshua Amy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I'm using Eclipse 4.1; do you have any idea what I might try to change? I think everything is default, since I don't really know enough to mess around with the settings (often I change the application size, but that's all).
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doubtful the problem is in eclipse. more likely to be in
extends GraphicsProgram or
addMouseListeners();

perhaps addMouseListeners() removes/overrides the slider/sliderUI listeners
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to where we usually discuss GIU questions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic