1 /* 2 * UserInterfaceFactory.java 3 * 4 * Created on 9. Oktober 2003, 00:33 5 * Copyright (C) Azureus Software, Inc, All Rights Reserved. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 */ 19 20 package org.gudy.azureus2.ui.common; 21 22 /** 23 * 24 * @author Tobias Minich 25 */ 26 public class UserInterfaceFactory { 27 28 /** Creates a new instance of UserInterfaceFactory */ getUI(String ui)29 public static IUserInterface getUI(String ui) { 30 IUserInterface cui = null; 31 String uiclass = "org.gudy.azureus2.ui."+ui+".UI"; 32 try { 33 cui = (IUserInterface) Class.forName(uiclass).newInstance(); 34 } catch (ClassNotFoundException e) { 35 throw new Error("Could not find class: "+uiclass); 36 } catch (InstantiationException e) { 37 throw new Error("Could not instantiate User Interface: "+ uiclass); 38 } catch (IllegalAccessException e) { 39 throw new Error("Could not access User Interface: "+ uiclass); 40 } 41 return cui; 42 } 43 44 45 } 46