DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Images & slider in applet

  1. #1
    Join Date
    Sep 2002
    Posts
    6

    Question Images & slider in applet

    Hi,

    i'm a beginner in programming in Java and i seem to be a bit stuck.
    I'm trying to create an applet in which 2 pictures are shown. If you click the picture in the upper left corner, it should change into an other picture. This works fine.
    But, i also want to use a slider! (I don't even know if this is possible, for i am a beginner ).

    The source code without the slider is:

    (see attachment panoramawithslider.java.txt)

    The pictures red.jpg & blue.jpg are basic images (74x72) made in paint. Panorama.gif can be found at: http://www.olympia360.com/art/Panorama.gif

    Now i want to add a slider (is it possible to put it anywhere i want?). I thought i could use parts of the following source code: http://grace.evergreen.edu/artofcomp...es/Slider2.php

    I placed the lines from
    JSlider slider = new JSlider(...
    through
    pane.add(slider);

    after
    addMouseListener(this);
    in my own source. I left out the changelistener and the counter. I also imported javax.swing.*; and javax.swing.event.*;.....

    Attached as Panoramawithslider.java.txt

    This doesn't work, because i get a compiling error at this.getContentPane():
    cannot resolve symbol
    symbol : method getContentPane()
    location: class panorama
    Container pane = this.getContentPane();
    ^ (under the 'g')

    I guess these are basic errors but as a beginner i seem to be a bit stuck here. So, can somebody help me? Thanks.

    Idunnootje.
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2002
    Posts
    6

    Arrow a bit further

    Well, i'm a bit further now. I'v succeeded to create the slider, BUT it only appears when you resize the window of the appletviewer to the right and click on the right side of the window (where the slider should be visible).
    Then there is the problem of the picture changing when you resize the window. But i figure something out for that problem...

    attached is my source code i have so far..

    thnx
    Attached Files Attached Files

  3. #3
    Join Date
    Sep 2002
    Posts
    6

    Question PLz?

    Nobody?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center