Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package CushyPro;
- import java.awt.Color;
- import java.awt.Font;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- public class Main {
- private static int type = 0;
- public static void main(String[] args) {
- JFrame window = new JFrame("Profile");
- window.setUndecorated(false);
- window.pack();
- window.setSize(300, 250);
- window.setVisible(true);
- window.setLocationRelativeTo(null);
- window.setResizable(false);
- window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JPanel panel = new JPanel();
- window.setContentPane(panel);
- panel.setBackground(Color.BLACK);
- if (true) {
- String n = "Name: นายวรณัชญ์ สุนามะ";
- JLabel label = new JLabel();
- label.setFont(new Font(null, 0, 20));
- label.setForeground(Color.green);
- panel.add(label);
- Runing(label, n, 0);
- }
- if (true) {
- String n = "รหัส: 6132224013";
- JLabel label = new JLabel("");
- label.setFont(new Font(null, 0, 20));
- label.setForeground(Color.green);
- panel.add(label);
- Runing(label, n, 1);
- }
- if (true) {
- String n = "สาขา เทคโนโลยีสารสนเทศ";
- JLabel label = new JLabel("");
- label.setFont(new Font(null, 0, 20));
- label.setForeground(Color.green);
- panel.add(label);
- Runing(label, n, 2);
- }
- if (true) {
- JLabel label = new JLabel("");
- label.setFont(new Font(null, 0, 20));
- label.setForeground(Color.green);
- panel.add(label);
- Runing(label, n, 3);
- }
- if (true) {
- String n = "ชอบสี: ดำ";
- JLabel label = new JLabel("");
- label.setFont(new Font(null, 0, 20));
- label.setForeground(Color.green);
- panel.add(label);
- Runing(label, n, 4);
- }
- if (true) {
- String n = "ชอบสัตว์: แมว";
- JLabel label = new JLabel("");
- label.setFont(new Font(null, 0, 20));
- label.setForeground(Color.green);
- panel.add(label);
- Runing(label, n, 5);
- }
- if (true) {
- String n = "เกิดวันที่: 17/12/2541";
- JLabel label = new JLabel("");
- label.setFont(new Font(null, 0, 20));
- label.setForeground(Color.green);
- panel.add(label);
- Runing(label, n, 6);
- }
- }
- public static void Runing(JLabel label, String n, int t) {
- new Thread(new Runnable() {
- int x = 0;
- @Override
- public void run() {
- try {
- while (true) {
- if (type == t) {
- if (x > n.length()) {
- type++;
- return;
- }
- label.setText(n.substring(0, x));
- x++;
- }
- Thread.sleep(50);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }).start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment