Content deleted Content added
fix the incoherent descriptive nature of the hello world example code snippet |
m fix bad code examples for swing especially by putting everything in a run() instead of a init constructor |
||
Line 138:
public class SwingExample implements Runnable {
@Override▼
▲ public void run() {
// Create the window
JFrame f = new JFrame("Hello, !");
Line 148 ⟶ 147:
// Add a label and a button
f.add(new JLabel("Hello, world!"));
f.add(new JButton("Press me!"));
}
▲ @Override
public void run() {
// Arrange the components inside the window
f.pack();
Line 156 ⟶ 159:
public static void main(String[] args) {
// Schedules the application to be run at the correct time in the event queue.
SwingUtilities.invokeLater(
}
|