Creating a simple Java GUI application using AWT components

preview_player
Показать описание
Create a simple Java application with user interface built using Abstract Window Toolkit. We will create a AWT window (frame) along with a label, text field and button.
Рекомендации по теме
Комментарии
Автор

Thank you so much man! For people WHO USE NOTEPAD and can't get this to work, I modified it and got it working, try this (The program was called from another file, so that's why there is no main method.) :

import java.awt.*;
import javax.swing.*;
public class JavaAWT5 extends JFrame {

static JFrame Frame = new JFrame();
static Label message;
static TextField t;
static Button b;

public static void Window() {

Frame.setSize(400, 400);
Frame.setLayout(new FlowLayout());
message = new Label("Hello there Major Tom!");
t = new TextField(16);
b = new Button("Click here!");
Frame.add(message);
Frame.add(t);
Frame.add(b);
Frame.setVisible(true);

}
}

X-VIPRIN