📄 uiaccess.java
字号:
* alternative decimal marks. * * @param field the text field with a DECIMAL constraint * @return either the formatted value or null, when there was no input. * @throws IllegalStateException when the TextField is not DECIMAL constrained */ public static String getDotSeparatedDecimalString( javax.microedition.lcdui.TextField field ) { //#if polish.midp2 if (( field.getConstraints() & javax.microedition.lcdui.TextField.DECIMAL)!= javax.microedition.lcdui.TextField.DECIMAL) { throw new IllegalStateException(); } //#endif String value = field.getString(); if (value == null) { return null; } return value.replace(',', '.'); } //#if polish.usePolishGui /** * Retrieves the decimal value entered with a dot as the decimal mark. * <ul> * <li>When the value has no decimal places it will be returned as it is: 12</li> * <li>When the value is null, null will be returned: null</li> * <li>When the value has decimal places, a dot will be used: 12.3</li> * </ul> * @param field the text field with a DECIMAL constraint * @return either the formatted value or null, when there was no input. * @throws IllegalStateException when the TextField is not DECIMAL constrained */ public static String getDotSeparatedDecimalString( TextField field ) { return field.getDotSeparatedDecimalString(); } //#endif /** * Adds the given command as a subcommand to the defined screen. When the J2ME Polish GUI is not used, this will just add the command to the screen like a normal command. * * @param child the sub command * @param parent the parent command * @param screen the screen. */ public static void addSubCommand( Command child, Command parent, javax.microedition.lcdui.Screen screen ) { //#if !polish.blackberry screen.addCommand( child ); //#endif } //#if polish.usePolishGui /** * Adds the given command as a subcommand to the defined screen. When the J2ME Polish GUI is not used, this will just add the command to the screen like a normal command. * * @param child the sub command * @param parent the parent command * @param screen the screen. */ public static void addSubCommand( Command child, Command parent, Screen screen ) { screen.addSubCommand( child, parent ); } //#endif //#if polish.usePolishGui /** * Adds the given command as a subcommand to the defined screen. When the J2ME Polish GUI is not used, this will just add the command to the screen like a normal command. * * @param child the sub command * @param parent the parent command * @param screen the screen. * @param style the style of the command */ public static void addSubCommand( Command child, Command parent, Screen screen, Style style ) { screen.addSubCommand( child, parent, style ); } //#endif /** * Removes all commands from the given screen * This option is only available when the "menu" fullscreen mode is activated. * * @param screen the screen. */ public static void removeAllCommands( javax.microedition.lcdui.Screen screen ) { // ignore } //#if polish.usePolishGui /** * Removes all commands from the given screen * This option is only available when the "menu" fullscreen mode is activated. * * @param screen the screen. */ public static void removeAllCommands( Screen screen ) { screen.removeAllCommands(); } //#endif /** * Checks whether the commands menu of the screen is currently opened. * Useful when overriding the keyPressed() method. * * @param screen the screen * @return true when the commands menu is opened. */ public static boolean isMenuOpened( javax.microedition.lcdui.Screen screen ) { return false; } //#if polish.usePolishGui /** * Checks whether the commands menu of the screen is currently opened. * Useful when overriding the keyPressed() method. * * @param screen the screen * @return true when the commands menu is opened. */ public static boolean isMenuOpened( Screen screen ) { return screen.isMenuOpened(); } //#endif /** * Focuses the specified item on the given screen. * * @param screen the screen * @param item the item that should be focused */ public static void focus( javax.microedition.lcdui.Screen screen, javax.microedition.lcdui.Item item ) { // ignore } //#if polish.usePolishGui /** * Focuses the specified item on the given screen. * * @param screen the screen * @param item the item that should be focused */ public static void focus( Screen screen, Item item ) { screen.focus( item ); } //#endif /** * Focuses the specified item on the given screen. * * @param screen the screen * @param index the index of the item that should be focused, first item has the index 0 */ public static void focus( javax.microedition.lcdui.Screen screen, int index ) { // ignore } //#if polish.usePolishGui /** * Focuses the specified item on the given screen. * * @param screen the screen * @param index the index of the item that should be focused, first item has the index 0 */ public static void focus( Screen screen, int index ) { screen.focus( index ); } //#endif /** * Releases all (memory) instensive resources that are currently hold by the J2ME Polish GUI. */ public static void releaseResources() { //#if polish.usePolishGui StyleSheet.releaseResources(); Displayable displayable = StyleSheet.display.getCurrent(); if ( displayable instanceof Screen ) { ((Screen)displayable).releaseResources(); } //#endif } /** * Releases all (memory) instensive resources that are currently hold by the J2ME Polish GUI when a non-J2ME Polish screen is shown. */ public static void releaseResourcesOnScreenChange() { //#if polish.usePolishGui AnimationThread.releaseResourcesOnScreenChange = true; //#endif } //#if polish.usePolishGui /** * Releases all (memory) instensive resources that are currently hold by the J2ME Polish GUI for the specified screen. * * @param screen the screen for which the resources should be released. */ public static void releaseResources( Screen screen ) { screen.releaseResources(); } //#endif /** * Releases all (memory) instensive resources that are currently hold by the J2ME Polish GUI for the specified screen. * * @param screen the screen for which the resources should be released. */ public static void releaseResources( javax.microedition.lcdui.Screen screen ) { // ignore } public static void setSubtitle( javax.microedition.lcdui.Screen screen, String subtitle ) { // ignore } //#if polish.usePolishGui public static void setSubtitle( Screen screen, String subtitle ) { setSubtitle( screen, new StringItem(null, subtitle)); } //#endif public static void setSubtitle( javax.microedition.lcdui.Screen screen, javax.microedition.lcdui.Item subtitle ) { // ignore } //#if polish.usePolishGui public static void setSubtitle( Screen screen, Item subtitle ) { screen.setSubTitle(subtitle); } //#endif /** * Scrolls the screen to the given position. * * @param screen the screen * @param yOffset the vertical offset: 0 is the very top, negative values scroll the screen towards the end. */ public static void scroll( javax.microedition.lcdui.Screen screen, int yOffset ) { // ignore } //#if polish.usePolishGui /** * Scrolls the screen to the given position. * * @param screen the screen * @param yOffset the vertical offset: 0 is the very top, negative values scroll the screen towards the end. */ public static void scroll( Screen screen, int yOffset ) { Container container = screen.container; if (container != null) { container.yOffset = yOffset; container.targetYOffset = yOffset; } } //#endif //#if polish.usePolishGui /** * Retrieves the background of the given screen. * This can be used to dynamically alter the background, e.g. by setting a different image: * <pre> * //#if polish.usePolishGui * ImageBackground ib = (ImageBackground) UiAccess.getBackground( form ); * ib.setImage( newImage ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param screen the screen */ public static Background getBackground( Screen screen ) { return screen.background; } //#endif //#if polish.usePolishGui /** * Retrieves the background of the given screen. * This can be used to dynamically alter the background, e.g. by setting a different image: * <pre> * //#if polish.usePolishGui * ImageBackground ib = (ImageBackground) UiAccess.getBackground( form ); * ib.setImage( newImage ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param screen the screen */ public static Background getBackground( javax.microedition.lcdui.Screen screen ) { return null; } //#endif //#if polish.usePolishGui /** * Sets the background for the given screen. * This can be used to dynamically alter the background: * <pre> * //#if polish.usePolishGui * SimpleBackground bg = new SimpleBackground( 0x00FF00 ); * UiAccess.setBackground( item, screen ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param screen the screen * @param background - the new background */ public static void setBackground( Screen screen, Background background ) { screen.background = background; screen.repaint(); } //#endif //#if polish.usePolishGui /** * Sets the background for the given screen. * This can be used to dynamically alter the background: * <pre> * //#if polish.usePolishGui * SimpleBackground bg = new SimpleBackground( 0x00FF00 ); * UiAccess.setBackground( item, screen ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param screen the screen * @param background - the new background */ public static void setBackground( javax.microedition.lcdui.Screen screen, Background background ) { // ignore } //#endif //#if polish.usePolishGui /** * Retrieves the background of the given item. * This can be used to dynamically alter the background, e.g. by setting a different image: * <pre> * //#if polish.usePolishGui * ImageBackground ib = (ImageBackground) UiAccess.getBackground( item ); * ib.setImage( newImage ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param item the item */ public static Background getBackground( Item item ) { return item.background; } //#endif //#if polish.usePolishGui /** * Retrieves the background of the given item. * This can be used to dynamically alter the background, e.g. by setting a different image: * <pre> * //#if polish.usePolishGui * ImageBackground ib = (ImageBackground) UiAccess.getBackground( item ); * ib.setImage( newImage ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param item the item */ public static Background getBackground( javax.microedition.lcdui.Item item ) { return null; } //#endif //#if polish.usePolishGui /** * Sets the background for the given item. * This can be used to dynamically alter the background: * <pre> * //#if polish.usePolishGui * SimpleBackground bg = new SimpleBackground( 0x00FF00 ); * UiAccess.setBackground( item, screen ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param item the item * @param background - the new background */ public static void setBackground( Item item, Background background ) { item.background = background; item.repaint(); } //#endif //#if polish.usePolishGui /** * Sets the background for the given item. * This can be used to dynamically alter the background: * <pre> * //#if polish.usePolishGui * SimpleBackground bg = new SimpleBackground( 0x00FF00 ); * UiAccess.setBackground( item, screen ); * //#endif * </pre> * Note: this method is only available when the J2ME Polish GUI is used! Check for the preprocessing symbold polish.usePolishGui. * @param item the item * @param background - the new background */ public static void setBackground( javax.microedition.lcdui.Item item, Background background ) { // ignore } //#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -