-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewImage.java
43 lines (36 loc) · 1.07 KB
/
ViewImage.java
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
package FinalAssignment;
import java.awt.FlowLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import uk.ac.leedsbeckett.oop.LBUGraphics;
public class ViewImage extends LBUGraphics
{
ViewImage()
{
JFrame view = new JFrame("Turtle Image");
view.setLayout(new FlowLayout());
view.add(this);
view.pack();
view.setVisible(true);
view.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setGUIVisible(false);
loadImg();
}
@Override
public void processCommand(String arg0)
{
// TODO Auto-generated method stub
}
public void loadImg()
{
JLabel background;
setSize(getWidth(),getHeight());
ImageIcon img = new ImageIcon("Turtle.png");
background = new JLabel("", img, JLabel.CENTER);
background.setBounds(0,0,getWidth(),(getHeight()));
add(background);
setVisible(true);
setGUIVisible(false);
}
}