-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInterface2
142 lines (106 loc) · 3.2 KB
/
Interface2
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.awt.Container;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.ImageIcon;
public class userInterface extends JFrame implements ActionListener
{
public JLabel name;
public JLabel Search;
public JLabel Credit;
public JLabel Help;
public JLabel backGround;
public JButton btnHelp;
public JButton btnBegin;
public JButton btnCredit;
public JButton btnExit;
public ImageIcon helpImage;
public ImageIcon FoodFinderImg;
public ImageIcon SearchImage;
public ImageIcon BackImage;
public ImageIcon CreditImage;
public ImageIcon ExitImage;
public ImageIcon CreditLabelImg;
public ImageIcon HelpLabelImg;
public ImageIcon SearchLabelImg;
public userInterface()
{
//new backGroundCheck();
setLayout(null);
setSize(600,900);
setBackground(Color.black);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
FoodFinderImg = new ImageIcon(getClass().getResource("Food-Finder.png"));
name = new JLabel(FoodFinderImg);
name.setBounds(150,5,301,376);
add(name);
validate();
CreditLabelImg = new ImageIcon(getClass().getResource("Credits-Big-Button.png"));
Credit = new JLabel(CreditLabelImg);
Credit.setBounds(190,717,371,128);
add(Credit);
HelpLabelImg = new ImageIcon(getClass().getResource("Help-Big-Button.png"));
Help = new JLabel(HelpLabelImg);
Help.setBounds(190,566,371,128);
add(Help);
validate();
SearchLabelImg = new ImageIcon(getClass().getResource("Save-Big-Button.png"));
Search = new JLabel(SearchLabelImg);
Search.setBounds(190,415,371,128);
add(Search);
validate();
helpImage = new ImageIcon(getClass().getResource("Help-Small-Button.png"));
btnHelp = new JButton(helpImage);
btnHelp.setBounds(36,415,128,128);
btnHelp.addActionListener(this);
add(btnHelp);
SearchImage = new ImageIcon(getClass().getResource("Magnify-Small-Button.png"));
btnBegin = new JButton(SearchImage);
btnBegin .setBounds(36,566,128,128);
btnBegin.addActionListener(this);
add(btnBegin);
CreditImage = new ImageIcon(getClass().getResource("Credits-Small-Button.png"));
btnCredit = new JButton(CreditImage);
btnCredit.setBounds(36,717,128,128);
btnCredit.addActionListener(this);
add(btnCredit);
ExitImage = new ImageIcon(getClass().getResource("X-Button.png"));
btnExit = new JButton(ExitImage);
btnExit.setBounds(500,5,36,36);
btnExit.addActionListener(this);
add(btnExit);
BackImage = new ImageIcon(getClass().getResource("Background.png"));
backGround = new JLabel(BackImage);
backGround.setBounds(0,0,600,900);
add(backGround);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == btnHelp)
{
System.out.println("help");
}
if (e.getSource() == btnBegin)
{
Search s = new Search();
s.setVisible(true);
}
if (e.getSource() == btnCredit)
{
System.out.println("credit");
}
if (e.getSource() == btnExit)
{
System.exit(0);
}
}
}