-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotHelloWorld.java
More file actions
31 lines (30 loc) · 973 Bytes
/
NotHelloWorld.java
File metadata and controls
31 lines (30 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import javax.swing.*;
import java.awt.*;
public class NotHelloWorld{
public static void main(String args[]){
EventQueue.invokeLater(()->{
JFrame frame=new NotHelloWorldFrame();
frame.setTitle("Not Hello World");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
});
}
}
class NotHelloWorldFrame extends JFrame{
public NotHelloWorldFrame(){
add(new NotHelloWorldComponent());
pack();
}
}
class NotHelloWorldComponent extends JComponent{
public static final int messagex=75;
public static final int messagey=100;
private static final int defaultwidth=300;
private static final int defaultheight=200;
public void paintComponent(Graphics g){
g.drawString("Not a Hello World Program", messagex, messagey);
}
public Dimension getPreferredSize(){
return new Dimension(defaultwidth, defaultheight);
}
}