• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSlider works but doesn't "slide"

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to where we usually discuss GIU questions.
 
reply
    Bookmark Topic Watch Topic
  • New Topic