IconProperties.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * General Robotix Inc.
00008  * National Institute of Advanced Industrial Science and Technology (AIST) 
00009  */
00010 package com.generalrobotix.ui.util;
00011 
00012 import java.util.*;
00013 import java.net.*;
00014 import javax.swing.ImageIcon;
00015 
00016 public class IconProperties {
00017     protected static IconProperties this_;
00018     protected static ResourceBundle resource_;
00019 
00020     public static final int WIDTH = 27;
00021     public static final int HEIGHT = 27;
00022 
00023     private IconProperties() {
00024         resource_ = ResourceBundle.getBundle("resources.icon");
00025     }
00026 
00027     public static ImageIcon get(String key) {
00028         if (this_ == null) {
00029             this_ = new IconProperties();
00030         }
00031 
00032         String str = resource_.getString(key);
00033         if (str.equals("none")) {
00034             return new ImageIcon();
00035         } else {
00036             URL url = IconProperties.class.getResource(str);
00037             if (url == null) {
00038                 return new ImageIcon();
00039             }
00040             return new ImageIcon(url);
00041         }
00042     }
00043 }
00044 


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:17