Berikut ini contoh program JAVA bagaimana membuat frame sederhana dengan action listener, sama seperti frame sebelumya tapi kali ini kita tambahkan sebuah frame jika user menekan tombol press.
cek lagi gan :
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class main {
public static void main(String[] args) {
final JFrame frame = new JFrame("dany");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 200);
frame.setLocationRelativeTo(null);
frame.setLayout(null);
JButton button = new JButton("tekan");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JDialog x = new JDialog();
x.setSize(600, 200);
x.setModal(true);
x.setLocationRelativeTo(frame);
x.setVisible(true);
}
});
button.setBounds(10, 50, 120, 40);
frame.add(button);
frame.setVisible(true);
}
}
penampakan SS nya gan :
The Best Casinos in The World - MapYRO
ReplyDeleteCasinos and 서산 출장샵 Casinos in the 부산광역 출장마사지 United States · 제천 출장샵 1. Golden 남원 출장안마 Nugget, Las Vegas · 2. The Venetian, Las Vegas · 3. Mohegan Sun, Uncasville, 안양 출장안마 CT · 4. Treasure Island