Java Code Examples for com.codename1.ui.util.Resources#openLayered()
The following examples show how to use
com.codename1.ui.util.Resources#openLayered() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartsDemo.java From codenameone-demos with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { try { Resources theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch(IOException e){ e.printStackTrace(); } // Pro users - uncomment this code to get crash reports sent to you automatically /*Display.getInstance().addEdtErrorHandler(new ActionListener() { public void actionPerformed(ActionEvent evt) { evt.consume(); Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown")); Log.p("OS " + Display.getInstance().getPlatformName()); Log.p("Error " + evt.getSource()); Log.p("Current Form " + Display.getInstance().getCurrent().getName()); Log.e((Throwable)evt.getSource()); Log.sendLog(); } });*/ }
Example 2
Source File: ClockDemo.java From codenameone-demos with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { try { Resources theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch(IOException e){ e.printStackTrace(); } // Pro users - uncomment this code to get crash reports sent to you automatically /*Display.getInstance().addEdtErrorHandler(new ActionListener() { public void actionPerformed(ActionEvent evt) { evt.consume(); Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown")); Log.p("OS " + Display.getInstance().getPlatformName()); Log.p("Error " + evt.getSource()); Log.p("Current Form " + Display.getInstance().getCurrent().getName()); Log.e((Throwable)evt.getSource()); Log.sendLog(); } });*/ }
Example 3
Source File: PhotoShare.java From codenameone-demos with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { try { Resources theme = Resources.openLayered("/theme"); placeholder = (EncodedImage)theme.getImage("thumbnail.png"); THUMB_URL_PREFIX = THUMB_URL_PREFIX + "w=" + placeholder.getWidth() + "&h=" + placeholder.getHeight() + "&i="; UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch(IOException e){ e.printStackTrace(); } // Pro users - uncomment this code to get crash reports sent to you automatically /*Display.getInstance().addEdtErrorHandler(new ActionListener() { public void actionPerformed(ActionEvent evt) { evt.consume(); Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown")); Log.p("OS " + Display.getInstance().getPlatformName()); Log.p("Error " + evt.getSource()); Log.p("Current Form " + Display.getInstance().getCurrent().getName()); Log.e((Throwable)evt.getSource()); Log.sendLog(); } });*/ }
Example 4
Source File: Solitaire.java From codenameone-demos with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { try { theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); int dpi = Preferences.get("dpi", calculateDPI()); cards = Resources.open("/gamedata.res",dpi); currentZoom = Preferences.get("zoom", defaultZoom); } catch(IOException e){ e.printStackTrace(); } // Pro users - uncomment this code to get crash reports sent to you automatically Display.getInstance().addEdtErrorHandler(new ActionListener() { public void actionPerformed(ActionEvent evt) { evt.consume(); Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown")); Log.p("OS " + Display.getInstance().getPlatformName()); Log.p("Error " + evt.getSource()); Log.p("Current Form " + Display.getInstance().getCurrent().getName()); Log.e((Throwable)evt.getSource()); Log.sendLog(); } }); }
Example 5
Source File: LocalNotificationTest.java From codenameone-demos with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { try { theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch(IOException e){ e.printStackTrace(); } // Pro users - uncomment this code to get crash reports sent to you automatically /*Display.getInstance().addEdtErrorHandler(new ActionListener() { public void actionPerformed(ActionEvent evt) { evt.consume(); Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown")); Log.p("OS " + Display.getInstance().getPlatformName()); Log.p("Error " + evt.getSource()); Log.p("Current Form " + Display.getInstance().getCurrent().getName()); Log.e((Throwable)evt.getSource()); Log.sendLog(); } });*/ }
Example 6
Source File: WebSocketsSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { try { theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch(IOException e){ e.printStackTrace(); } // Pro users - uncomment this code to get crash reports sent to you automatically /*Display.getInstance().addEdtErrorHandler(new ActionListener() { public void actionPerformed(ActionEvent evt) { evt.consume(); Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown")); Log.p("OS " + Display.getInstance().getPlatformName()); Log.p("Error " + evt.getSource()); Log.p("Current Form " + Display.getInstance().getCurrent().getName()); Log.e((Throwable)evt.getSource()); Log.sendLog(); } });*/ }
Example 7
Source File: CameraDemo.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
public void init(Object context) { try { Resources theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); //Enable Toolbar to all Forms by default Toolbar.setGlobalToolbar(true); } catch (IOException e) { e.printStackTrace(); } }
Example 8
Source File: PropertyCross.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
/** * This is a Codename One initialization callback that is invoked when the app is started */ public void init(Object context) { try { // loading the theme of the application Resources theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); // the specification requires that only portrait would be supported Display.getInstance().lockOrientation(true); // We load the images that are stored in the resource file here so we can use them later placeholder = (EncodedImage)theme.getImage("placeholder"); favoriteSel = theme.getImage("favorite_sel"); favoriteUnsel = theme.getImage("favorite_unsel"); // We initialize the lists of favorites and recent entries here, we load them from storage and save // them whenever we change them favoritesList = (List<Map<String, Object>>)Storage.getInstance().readObject("favoritesList"); if(favoritesList == null) { favoritesList = new ArrayList<Map<String, Object>>(); } recentSearchesList = (List<Map<String, String>>)Storage.getInstance().readObject("recentSearches"); if(recentSearchesList == null) { recentSearchesList = new ArrayList<Map<String, String>>(); } } catch(IOException e){ e.printStackTrace(); } }
Example 9
Source File: Poker.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
/** * This method is invoked by Codename One once when the application loads */ public void init(Object context) { try{ // after loading the default theme we load the card images as a resource with // a fake DPI so they will be large enough. We store them in a resource rather // than as files so we can use the MultiImage functionality Resources theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); cards = Resources.open("/gamedata.res", calculateDPI()); } catch(IOException e) { e.printStackTrace(); } }
Example 10
Source File: KitchenSink.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
public void init(Object context){ //Log.setReportingLevel(Log.REPORTING_PRODUCTION); //DefaultCrashReporter.init(true, 2); Log.p("Init"); try{ res = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(res.getTheme(res.getThemeResourceNames()[0])); } catch(IOException e){ Log.e(e); } }
Example 11
Source File: SignIn.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
public void init(Object context) { try { theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch (IOException e) { e.printStackTrace(); } }
Example 12
Source File: FBDemo.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
public void init(Object context) { System.out.println("init"); try { theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch (IOException e) { e.printStackTrace(); } }
Example 13
Source File: GeoVizDemo.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
public void init(Object context) { try { Resources theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch(IOException e){ e.printStackTrace(); } }
Example 14
Source File: UIManager.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
/** * Same as the initFirstTheme method, but unlike that method this allows specifying the theme resource name * @param resourceFile the name of the resource file starting with / and without the res extension * @param resName the name of the theme to use from the file if it contains more than one theme * @return the resource file or null in case of a failure */ public static Resources initNamedTheme(String resourceFile, String resName) { try { Resources theme = Resources.openLayered(resourceFile); UIManager.getInstance().setThemeProps(theme.getTheme(resName)); Resources.setGlobalResources(theme); return theme; } catch(IOException e){ Log.e(e); } return null; }
Example 15
Source File: SignIn.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void init(Object context) { try { theme = Resources.openLayered("/theme"); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch (IOException e) { e.printStackTrace(); } }
Example 16
Source File: UIManager.java From CodenameOne with GNU General Public License v2.0 | 3 votes |
/** * This is a shorthand notation for boilerplate code for initializing the first theme in the given resource file * and catching/doing nothing with the IOException since this would be invoked too early in the program * where we would be out of options if something like that happens. Effectively this is the same as writing: * <pre> try { theme = Resources.openLayered(resourceFile); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); } catch(IOException e){ e.printStackTrace(); } * </pre> * @param resourceFile the name of the resource file starting with / and without the res extension * @return the resource file or null in case of a failure */ public static Resources initFirstTheme(String resourceFile) { try { Resources theme = Resources.openLayered(resourceFile); UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0])); Resources.setGlobalResources(theme); return theme; } catch(IOException e){ Log.e(e); } return null; }