-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageFrame.java
More file actions
63 lines (53 loc) · 1.9 KB
/
Copy pathImageFrame.java
File metadata and controls
63 lines (53 loc) · 1.9 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
package cop5556fa17;
import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
public class ImageFrame {
public static String desc = "Lcop5556fa17/ImageFrame;";
public static String JFrameDesc = "Ljavax/.swing/JFrame;";
public static String className = "cop5556fa17/ImageFrame";
// public JFrame frame; //FIX THIS
// public JLabel label;
// BufferedImage image;
//
// public ImageFrame(BufferedImage image){
// frame = new JFrame();
// frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
//// frame.setSize(image.getWidth() , image.getHeight());
//// System.out.println("*******ImageFrame: w=" + image.getWidth() + ", h="+image.getHeight());
// label = new JLabel(new ImageIcon(image));
// frame.add(label);
// frame.pack();
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// frame.setVisible(true);
// }
// });
//
// }
//
public static final String makeFrameSig = "(" +ImageSupport.ImageDesc + ")" + desc;
// public static ImageFrame makeFrame(BufferedImage image) {
// ImageFrame frame = new ImageFrame(image);
// return frame;
// }
public static final JFrame makeFrame(BufferedImage image) throws InvocationTargetException, InterruptedException {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setSize(image.getWidth() , image.getHeight());
JLabel label = new JLabel(new ImageIcon(image));
frame.add(label);
frame.pack();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
}
});
return frame;
}
}