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