Contoh penggunaan fungsi while pada java dengan JFrame

/*
 * @NGATMIN
 * @2112R0558
 * STMIK HIMSYA SEMARANG
 */
import javax.swing.*;
import java.awt.*;
public class soal_3b extends JFrame {
    JTextArea tombol;
    int n = 0;
    public soal_3b(){
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        tombol = new JTextArea("");
        JScrollPane js = new JScrollPane(tombol);
        js.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        js.setBounds(20, 20, 320, 230);
        getContentPane().add(js);
        getContentPane().setLayout(null);
        while(n<100){
          tombol.append(" NGATMIN | STMIK HIMSYA SEMARANG\n");
          tombol.setBackground(Color.GREEN);
          tombol.setFont(new Font("Arial Black",1,12));
            n++;
      }
   
        this.setSize(370,300);
        this.setLocationRelativeTo(null);
        this.setResizable(false);
        this.setTitle("Soal 2 | while");
        setVisible(true);
    }
    public static void main(String []aa){
        new soal_3b();
    } 
}

0 Response to "Contoh penggunaan fungsi while pada java dengan JFrame"

Posting Komentar