Friday, 20 May 2022

Write a java program to scroll the text from left to right and vice versa continuously.


DOWNLOAD SLIP1Q1

 SAVE CODE AS     "Slip1Q1"

TO RUN    appletviewer Slip1Q1.java



import java.applet.Applet;
import java.awt.*;

/**
* Created by : Amar Ghugare
* created on : 20-05-2022 16:02
* Purpose of class :
* Write a java program to scroll the text from
* left to right and vice versa continuously.
*/

public class Slip1Q1 extends Applet implements Runnable{
String banner="Hello I am Groot";
Thread t = null;
int x;
public void paint(Graphics g) {
Font a = new Font("Impact",Font.BOLD,14);
g.setFont(a);
g.drawString(banner, x, 100);
}
public void start() {
t = new Thread( this );
t.start();
}
    public void init(){
        setBackground(Color.black);
    setForeground(Color.green);
    }
@Override
public void run() {
try {
for(int i =0;i<400;i++){
repaint(10);
x=i;
Thread.sleep( 100);
}
}catch (Exception ignored){}
}
}
/**
* <applet code="Slip1Q1.class" width="600" height="300">
* </applet>
*/

No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...