-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBanner.java
More file actions
80 lines (70 loc) · 2.28 KB
/
Banner.java
File metadata and controls
80 lines (70 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Label;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author tarun
*/
public class Banner extends javax.swing.JPanel implements Runnable{
/**
* Creates new form Banner
*/
Thread th;
Label l;
String str;
char ch;
public Banner() {
str = " Welcome to PR3 Training Academy ";
//setSize(400, 800);
setVisible(true);
Font f = new Font("Serif", 2, 33);
setLayout(new FlowLayout(FlowLayout.CENTER));
setBackground(Color.WHITE);
th = new Thread(this);
th.start();
l = new Label(" ");
l.setFont(f);
add(l);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 764, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 54, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
@Override
public void run() {
while(true){
try {
ch = str.charAt(0);
str = str.substring(1, str.length());
str += String.valueOf(ch);
Thread.sleep(150);
l.setText(str);
} catch (InterruptedException ex) {
System.out.println(ex);
}
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}