Minggu, 10 April 2011

Menambahkan Label(JLabel) pada java

import java.awt.*;
import javax.swing.*;

public class TambahKomponen1 extends JFrame{

public TambahKomponen1() {
Container content= this.getContentPane();
content.setLayout(new FlowLayout());
JLabel lbl=new JLabel("COBA");
content.add(lbl);
setSize(200,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);

}
public static void main(String args []){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
new TambahKomponen1().setVisible(true);
}
});
}

}

Tidak ada komentar:

Posting Komentar