Frame frame = new Frame("A Frame"); public class MyForm extends Frame {
package com.java.myapp; import java.awt.Frame; import java.awt.event.WindowEvent; public class MyForm { public static void main(String[] args) { Frame frame = new Frame("A Frame"); frame.setSize(250, 250); frame.setLocation(300,200); frame.setVisible(true); // Close frame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); } }
package com.java.myapp; import java.awt.EventQueue; import java.awt.Frame; import java.awt.Label; import java.awt.event.WindowEvent; public class MyForm extends Frame { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { MyForm form = new MyForm(); form.setVisible(true); } }); } public MyForm() { // Create Form Frame super("ThaiCreate.Com Java GUI Tutorial"); setSize(434, 216); setLocation(500, 280); setLayout(null); // Label Label label = new Label(); label.setAlignment(java.awt.Label.CENTER); label.setText("ThaiCreate.Com"); label.setBounds(150, 100, 150, 20); add(label); // Close addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); } }
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท