📄 JB_042_NullLayoutJFrame.java .java dosyası
⬇️ İndir
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class JB_042_NullLayoutJFrame {
public JB_042_NullLayoutJFrame() {
JFrame frame = new JFrame("Null Layout JFrame örnek.");
frame.setLayout(null);
frame.getContentPane().setBackground(new Color(230, 200, 140));
JLabel label = new JLabel(".setLayout(null); örnek!");
label.setFont(new Font("Helvetica", Font.BOLD, 18));
label.setForeground(new Color(50, 230, 80));
label.setOpaque(true);
label.setBackground(new Color(45, 240, 240));
label.setBounds(50, 50, 400, 30);
JTextField tf = new JTextField("textField alani... Yazi yaz...");
tf.setFont(new Font("Helvetica", Font.BOLD, 18));
tf.setEditable(false);
tf.setBounds(50, 130, 400, 30);
JButton buton = new JButton("Exit");
buton.setBounds(50, 210, 70, 30);
buton.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent event ) {
System.out.println("Buton basilarak kapatildi..");
System.exit(0);
}
});
frame.add(label);
frame.add(tf);
frame.add(buton);
frame.setSize(1024, 600);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String[] args) {
new JB_042_NullLayoutJFrame();
}
}