Java Code Examples for com.codename1.ui.Display#DENSITY_HD
The following examples show how to use
com.codename1.ui.Display#DENSITY_HD .
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: Solitaire.java From codenameone-demos with GNU General Public License v2.0 | 6 votes |
/** * We use this method to calculate a "fake" DPI based on screen resolution rather than its actual DPI * this is useful so we can have large images on a tablet */ private int calculateDPI() { int min = Math.min(Display.getInstance().getDisplayHeight(), Display.getInstance().getDisplayWidth()); // we need 7 cards to fit in the screen, if(min > 1100) { defaultZoom = 15; return Display.DENSITY_HD; } if(min > 700) { defaultZoom = 10; return Display.DENSITY_VERY_HIGH; } if(min > 640) { defaultZoom = 6; return Display.DENSITY_HIGH; } defaultZoom = 3; return Display.DENSITY_MEDIUM; }
Example 2
Source File: PlatformDefaults.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public static int getPlatformDPI(int plaf) { switch(Display.getInstance().getDeviceDensity()) { case Display.DENSITY_HD: return 420; case Display.DENSITY_VERY_HIGH: return 320; case Display.DENSITY_HIGH: return 220; case Display.DENSITY_MEDIUM: return 150; case Display.DENSITY_LOW: return 96; case Display.DENSITY_VERY_LOW: return 72; } return 96; }
Example 3
Source File: Poker.java From codenameone-demos with GNU General Public License v2.0 | 5 votes |
/** * We use this method to calculate a "fake" DPI based on screen resolution rather than its actual DPI * this is useful so we can have large images on a tablet */ private int calculateDPI() { int pixels = Display.getInstance().getDisplayHeight() * Display.getInstance().getDisplayWidth(); if(pixels > 1000000) { return Display.DENSITY_HD; } if(pixels > 340000) { return Display.DENSITY_VERY_HIGH; } if(pixels > 150000) { return Display.DENSITY_HIGH; } return Display.DENSITY_MEDIUM; }