943,945 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 637
  • Java RSS
Jul 9th, 2007
0

help on whiteboard player

Expand Post »
I have the slider code and the paragraph im going to put inside.That is create a horizontal slider bar, that will display individual words, each weight along the slider. So, at each step of the slider,a different words is displayed..so i need to load it up to the website using java applet..Thank you for your time and attention..



Code: ( text )
  1. <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]import javax.swing.*;
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]import javax.swing.event.*;
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]import java.awt.*;
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]public class ScrollSlider {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] public static void main(String args[]) {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] JFrame f = new JFrame("Change Slider");
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] JSlider aJSlider = new JSlider (JSlider.HORIZONTAL, 0, 1000, 500);
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] ChangeListener aChangeListener = new BoundedChangeListener();
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] aJSlider.addChangeListener(aChangeListener);
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] Container c = f.getContentPane();
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] c.add (aJSlider, BorderLayout.SOUTH);
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] f.setSize (300, 200);
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] f.setVisible (true);
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] }
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]}
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace]class BoundedChangeListener implements ChangeListener {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] public void stateChanged(ChangeEvent changeEvent) {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] Object source = changeEvent.getSource();
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] if (source instanceof BoundedRangeModel) {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] BoundedRangeModel aModel = (BoundedRangeModel) source;
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] if (!aModel.getValueIsAdjusting()) {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] System.out.println("Changed: " + aModel.getValue());
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] }
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] } else if (source instanceof JSlider) {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] JSlider theJSlider = (JSlider) source;
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] if (!theJSlider.getValueIsAdjusting()) {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] System.out.println("Slider changed: " + theJSlider.getValue());
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] }
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] } else if (source instanceof JProgressBar) {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] JProgressBar theJProgressBar = (JProgressBar) source;
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] System.out.println("ProgressBar changed: "
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] + theJProgressBar.getValue());
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] } else {
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] System.out.println("Something changed: " + source);
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] }
    <LI style="FONT-SIZE: 8pt; BACKGROUND: #fcfcfc">[FONT='Courier New', Courier, monospace] }
  2. [FONT='Courier New', Courier, monospace]}




[Paragraph]
Java is inevitably something you have heard a lot about, but may not have heard anything very informative about. What is it, and what can it do for you? Java is a programming language created Sun Microsystems, a designer of high end computer work stations. Java is designed to be extremely robust, to work across networks, and to work across all computer platforms. Because of the cross platform abilities and the time it was created, Java is often thought of as a natural for the internet. All this has made it the darling of the computing world. Plans are currently being made to develop many of the next decades computer applications in Java.

[/Paragraph]
Last edited by dotcom123; Jul 9th, 2007 at 6:01 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dotcom123 is offline Offline
8 posts
since Jun 2007
Jul 9th, 2007
0

Re: help on whiteboard player

Any reason for posting all this nonsense code ?
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Jul 9th, 2007
0

Re: help on whiteboard player

I have the slider code and the paragraph im going to put inside.That is create a horizontal slider bar, that will display individual words, each weight along the slider. So, at each step of the slider,a different words is displayed..so i need to load it up to the website using java applet..Thank you for your time and attention..

Java Syntax (Toggle Plain Text)
  1. import javax.swing.*;
  2. import javax.swing.event.*;
  3. import java.awt.*;
  4.  
  5. public class ScrollSlider {
  6. public static void main(String args[]) {
  7. JFrame f = new JFrame("Change Slider");
  8. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  9.  
  10. JSlider aJSlider = new JSlider (JSlider.HORIZONTAL, 0, 1000, 500);
  11. ChangeListener aChangeListener = new BoundedChangeListener();
  12. aJSlider.addChangeListener(aChangeListener);
  13. Container c = f.getContentPane();
  14. c.add (aJSlider, BorderLayout.SOUTH);
  15. f.setSize (300, 200);
  16. f.setVisible (true);
  17. }
  18. }
  19. class BoundedChangeListener implements ChangeListener {
  20. public void stateChanged(ChangeEvent changeEvent) {
  21. Object source = changeEvent.getSource();
  22. if (source instanceof BoundedRangeModel) {
  23. BoundedRangeModel aModel = (BoundedRangeModel) source;
  24. if (!aModel.getValueIsAdjusting()) {
  25. System.out.println("Changed: " + aModel.getValue());
  26. }
  27. } else if (source instanceof JSlider) {
  28. JSlider theJSlider = (JSlider) source;
  29. if (!theJSlider.getValueIsAdjusting()) {
  30. System.out.println("Slider changed: " + theJSlider.getValue());
  31. }
  32. } else if (source instanceof JProgressBar) {
  33. JProgressBar theJProgressBar = (JProgressBar) source;
  34. System.out.println("ProgressBar changed: "
  35. + theJProgressBar.getValue());
  36. } else {
  37. System.out.println("Something changed: " + source);
  38. }
  39. }
  40. }

[Paragraph]
Java is inevitably something you have heard a lot about, but may not have heard anything very informative about. What is it, and what can it do for you? Java is a programming language created Sun Microsystems, a designer of high end computer work stations. Java is designed to be extremely robust, to work across networks, and to work across all computer platforms. Because of the cross platform abilities and the time it was created, Java is often thought of as a natural for the internet. All this has made it the darling of the computing world. Plans are currently being made to develop many of the next decades computer applications in Java.

[/Paragraph]
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dotcom123 is offline Offline
8 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Google API in Web Services Application
Next Thread in Java Forum Timeline: please help me





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC