• 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

Help!!! - Intermitent display of JSlider

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
I am developing a gui application using swing, and in one of my gui classes i use the JSlider with a subclass of DefaultBoundedRangeModel as its model. Another gui class contains at least two of the above class at any one time.
The problem is that if i run the application one time the JSliders may be visible, but the next time i load it, they most likely wont be visible. There appears to be no pattern to this changing of visibility, and i am at a complete loss to explain it.
Does anyone have any idea what the problem may be, or a suggestion of what i should do to work around it?
Thanks in advance
Dave
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what layoutmanager are you using? how are you adding the components and to what container are you adding them?
chantal
 
Dave Turner
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the JSlider is in the centre of a BorderLayout in a JPanel (A) that is itself located in the centre of another JPanel (B). Another JPanel (C) contains a number of (B) JPanels in a GridLayout. JPanel (C) is the viewport view of a JScrollPane. The ScrollPane is located at the centre of another JPanel (D). This JPanel (D) is part of a JTabbedPane that is at the centre of another JPanel (E). The JPanel (E) is at the centre of the ContentPane of an InternalFrame held in a DesktopPane at the centre of a JFrame.
The only part that seems to display at random is the JSlider.
I have tried changing layout managers, and recompiling entire packages, yet nothing seems to have an effect.
Dave
 
Dave Turner
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am convinced that the issue here is not with the layout of the components, as i can run the application a number of times without any recompilation and observe a random pattern of visibility of the JSliders.
Also, when the sliders are not visible, clicking on the grey space that they should occupy, still fires ChangeEvents.
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hm, I haven't worked with jslider before. what i can say from some strange experience i had with jtable is: the problem is most likely the model. writing a complex model from scratch can cause problems in the interaction of the view and the model.
have you written a little test app with just the jslider in it, using a very simple model (e.g. an example out of some documentation)? try to experiment with this test app and extend it to the needs of your big app. then use it with your big app.
chantal
 
Dave Turner
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi chantal
ive tried writing a simple test of JSlider as you suggested and it works fine, even with my subclass model.
Also i tried removing my subclass model from the sliders in my application, but this had no effect on the visibility problem.
i think my next step will be to redesign the Components of my app that use the JSliders from scratch, and hope that the problem does not present itself again.
thanks
Dave
 
Dave Turner
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I seem to have solved the problem , though i am unsure of the exact explanation.
I had previously been experimenting with creating a jar file of my classes, which was located on my classpath, although i have now deleted it.
I have been able to load ten instances of my application concurrently and each one functioned without fault.
I am certain that the jar file was the cause of my problem but i dont know why...
thanks for your help
Dave
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic