blob: 67293a3932d177a33f23aca1d10b951b5da1be82 [file] [log] [blame]
Francesco Furfariec7e1752006-10-02 13:37:04 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
Francesco Furfari91af5da2006-04-04 23:44:23 +00009 *
Francesco Furfariec7e1752006-10-02 13:37:04 +000010 * http://www.apache.org/licenses/LICENSE-2.0
Francesco Furfari91af5da2006-04-04 23:44:23 +000011 *
Francesco Furfariec7e1752006-10-02 13:37:04 +000012 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
Francesco Furfari91af5da2006-04-04 23:44:23 +000018 */
19
20package org.apache.felix.upnp.tester;
21
22import java.awt.Image;
23import java.net.URL;
24
25import javax.swing.ImageIcon;
26import javax.swing.JFrame;
27import javax.swing.JLabel;
28import javax.swing.JPanel;
Francesco Furfarif2a67912006-07-17 17:08:02 +000029/*
Karl Paulsd312acc2007-06-18 20:38:33 +000030* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
Francesco Furfarif2a67912006-07-17 17:08:02 +000031*/
Francesco Furfari91af5da2006-04-04 23:44:23 +000032
33public class test extends JFrame {
34
35 Image image;
36
37 public test(String filename) {
38 super(filename);
39 setDefaultCloseOperation(EXIT_ON_CLOSE);
40 //image = getToolkit().getImage(filename);
41 ImageIcon image =loadIcon("EventedStateVariable");
42 //image.setImageObserver(this);
43 JPanel panel = new JPanel();
44
45 panel.add(new JLabel(image));
46 JLabel lab = new JLabel();
47 lab.setIcon(image);
48 panel.add(lab);
49 this.getContentPane().add(panel);
50 }
51
52 /*public void paint(Graphics g) {
53 super.paint(g);
54 g.drawImage(image, 25, 25, this);
55 }*/
56
57 public static void main(String args[]) {
58 if (args.length > 0) {
59 JFrame f = new test(args[0]);
60 f.setSize(300, 300);
61 f.show();
62 } else {
63 System.err.println(
64 "You must specify an image filename to display");
65 }
66 }
67
68
69 public static ImageIcon loadIcon(String name)
70 {
71 try {
72 //System.out.println("loading image ..."+path);
73 URL eventIconUrl = test.class.getResource("images/" + name + ".gif");
74 return new ImageIcon(eventIconUrl,name);
75 }
76 catch (Exception ex){
77 System.out.println("Resource:" + name + " not found : " + ex.toString());
78 return null;
79 }
80 }
81
Karl Paulsd312acc2007-06-18 20:38:33 +000082}