-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.java
More file actions
120 lines (109 loc) · 3.42 KB
/
Main.java
File metadata and controls
120 lines (109 loc) · 3.42 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
*
* @author Aman
*/
import UI.*;
import Util.iJGuiD;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.filechooser.FileNameExtensionFilter;
public class Main extends JFrame implements ActionListener
{
JLabel lblHeader;
JButton paint,editor,guid,quit;
public Main()
{
super("GUI ARTIST AND JEDITOR");
Image myIcon = getToolkit().createImage("icons/GuiD_icon.png");
this.setIconImage(myIcon);
int x = 20;
int y = 150;
int width = 130;
int height = 100;
Container c = getContentPane();
c.setLayout( null );
c.setBackground( Color.black );
c.setForeground( Color.white );
lblHeader = new JLabel( );
lblHeader = new JLabel( new ImageIcon("images/JDEP.gif"));
lblHeader.setBackground( Color.black );
lblHeader.setForeground( Color.white );
lblHeader.setFont( new Font( "Helvetica", 0, 40 ) );
lblHeader.setBounds( 80, 50, 312, 82 );
c.add( lblHeader );
paint = new JButton();
paint= new JButton(new ImageIcon("images/PAINT.gif"));
paint.setBackground( Color.black );
paint.setBounds( x, y, width, height );
paint.addActionListener( this );
paint.setToolTipText("PAINT");
c.add(paint);
x += 150;
editor = new JButton();
editor= new JButton(new ImageIcon("images/EDITOR.gif"));
editor.setBackground( Color.black );
editor.setBounds( x, y, width, height );
editor.addActionListener( this );
editor.setToolTipText("EDITOR");
c.add(editor);
x += 150;
//y += 150;
guid= new JButton();
guid= new JButton(new ImageIcon("images/GUID.gif"));
guid.setBackground( Color.black );
guid.setBounds( x, y, width, height );
guid.addActionListener( this );
guid.setToolTipText("GUID");
c.add(guid);
//x += 150;
quit = new JButton( "Quit" );
quit.setBounds( x-150 , y+150, width, 30 );
quit.setBackground( Color.black );
quit.setForeground( Color.white );
quit.setFont( new Font( "Helvetica", 0, 10 ) );
quit.addActionListener( this );
quit.setToolTipText("QUIT");
c.add( quit );
this.pack();
this.setSize(500,450);
this.setVisible(true);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed( ActionEvent e )
{
int answer = -1;
String type = null;
if( e.getSource() == quit )
{
answer = JOptionPane.showConfirmDialog( null, "Leaving The GUI Designer so soon?",
"GuiD Confirmation", JOptionPane.YES_NO_OPTION );
if( answer == JOptionPane.YES_OPTION)
{
System.exit( 0 );
}
}
else if( e.getSource() == paint )
{
this.setVisible(false);
Painter pp=new Painter();
pp.show();
}
else if( e.getSource() == editor )
{
this.setVisible(false);
SimpleTextEditor ste=new SimpleTextEditor();
ste.init();
}
else if( e.getSource() == guid )
{
this.setVisible(false);
JGuiD gui=new JGuiD();
}
}
public static void main(String[] args)
{
Main tg = new Main();
}
}