• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 75721
354
  • 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.
 
Hold that thought. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic