A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
24
Task/Hello-world-Graphical/Java/hello-world-graphical.java
Normal file
24
Task/Hello-world-Graphical/Java/hello-world-graphical.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OutputSwing {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
public void run() {
|
||||
JOptionPane.showMessageDialog (null, "Goodbye, World!"); // in alert box
|
||||
JFrame frame = new JFrame("Goodbye, World!"); // on title bar
|
||||
JTextArea text = new JTextArea("Goodbye, World!"); // in editable area
|
||||
JButton button = new JButton("Goodbye, World!"); // on button
|
||||
|
||||
frame.setLayout(new FlowLayout());
|
||||
frame.add(button);
|
||||
frame.add(text);
|
||||
frame.pack();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue