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">

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


[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]

Recommended Answers

All 2 Replies

Any reason for posting all this nonsense code ?

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]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.