⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uiaccess.java

📁 j2me is based on j2mepolish, client & server for mobile application. menu sample
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    		}
        //#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

	//#if polish.midp
    /**
     * 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
    }
    //#endif
    
	//#if polish.midp
    public static void setSubtitle( javax.microedition.lcdui.Screen screen, String subtitle ) {
    		// ignore
    }
    //#endif

    //#if polish.usePolishGui
    public static void setSubtitle( Screen screen, String subtitle ) {
    		setSubtitle( screen, new StringItem(null, subtitle));
    }
    //#endif

	//#if polish.midp
    public static void setSubtitle( javax.microedition.lcdui.Screen screen, javax.microedition.lcdui.Item subtitle ) {
    		// ignore
    }
    //#endif

    //#if polish.usePolishGui
    public static void setSubtitle( Screen screen, Item subtitle ) {
    		screen.setSubTitle(subtitle);
    }
    //#endif
    
	//#if polish.midp
    /**
     * 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
    }
    //#endif

    //#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
     * @return the background for the screen
     */
    public static Background getBackground( Screen screen ) {
    	return screen.background;
    }
    //#endif

    //#if polish.usePolishGui && polish.midp
    /**
     * 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
     * @return the background for 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 && polish.midp
    /**
     * 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
     * @return the background for the item
     */
    public static Background getBackground( Item item ) {
    	return item.background;
    }
    //#endif

    //#if polish.usePolishGui && polish.midp
    /**
     * 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
     * @return the background for 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 && polish.midp
    /**
     * 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

	//#if polish.midp
    /**
     * Retrieves the command listener belonging to this screen.
     * 
     * @param screen the screen 
     * @return the associated command listener, always null for javax.microedition.lcdui.Screen objects that have not been converted to J2ME Polish components
     */
	public static CommandListener getCommandListener( javax.microedition.lcdui.Screen screen ) {
		return null;
	}
	//#endif


    //#if polish.usePolishGui
    /**
     * Retrieves the command listener belonging to this screen.
     * 
     * @param screen the screen 
     * @return the associated command listener, always null for javax.microedition.lcdui.Screen objects that have not been converted to J2ME Polish components
     */
	public static CommandListener getCommandListener( Screen screen ) {
		return screen.getCommandListener();
	}
    //#endif

	
    //#if polish.usePolishGui
	/**
	 * Sets an arbitrary attribute for the given item.
	 * 
	 * @param item the item to which the attribute should be added
	 * @param key the key for the attribute
	 * @param value the attribute value
	 */
	public static void setAttribute( Item item, Object key, Object value ) {
		item.setAttribute( key, value );
	}
    //#endif
	
    //#if polish.usePolishGui
	/**
	 * Gets an previously added attribute of the specified item.
	 * 
	 * @param item the item to which the attribute should be added
	 * @param key the key of the attribute
	 * @return the attribute value, null if none has been registered under the given key before
	 */
	public static Object getAttribute( Item item, Object key ) {
		return item.getAttribute( key );
	}
    //#endif
	
	//#if polish.usePolishGui
  /**
   * Returns a HashMap object with all registered attributes.
   * 
   * @param item the item from which the attributes should be retrieved
   * @return a HashMap object with all attribute key/value pairs, null if no attribute was stored before.
   */
  public static HashMap getAttributes( Item item ) {
	  return item.getAttributes();
  }
  //#endif

  //#if polish.usePolishGui
	/**
	 * Sets an arbitrary attribute for the specified list item.
	 * 
   * @param list a list of items
	 * @param index the index of the item to which the attribute should be added
	 * @param key the key for the attribute
	 * @param value the attribute value
	 */
	public static void setAttribute( List list, int index, Object key, Object value ) {
		Item item = list.getItem(index);
		item.setAttribute( key, value );
	}
  //#endif
	
  //#if polish.usePolishGui
	/**
	 * Gets an previously added attribute of the specified item.
	 * 
   * @param list a list of items
	 * @param index the index of item from which the attribute should be retrieved
	 * @param key the key of the attribute
	 * @return the attribute value, null if none has been registered under the given key before
	 */
	public static Object getAttribute( List list, int index, Object key ) {
		Item item = list.getItem( index );
		return item.getAttribute( key );
	}
  //#endif
	
	//#if polish.usePolishGui
	/**
	 * Returns a HashMap object with all registered attributes.
	 * 
   * @param list a list of items
	 * @param index the index of item from which the attributes should be retrieved
	 * @return a HashMap object with all attribute key/value pairs, null if no attribute was stored before.
	 */
	public static HashMap getAttributes( List list, int index ) {
		Item item = list.getItem(index);
		return item.getAttributes();
	}
	//#endif
	
	//#if polish.midp
  /**
	 * Sets an arbitrary attribute for the given item.
	 * 
	 * @param item the item to which the attribute should be added
	 * @param key the key for the attribute
	 * @param value the attribute value
	 */
	public static void setAttribute( javax.microedition.lcdui.Item item, Object key, Object value ) {
		if (attributes == null) {
			attributes = new HashMap();
		}
		HashMap itemAttributes = (HashMap) attributes.get( item );
		if (itemAttributes == null) {
			itemAttributes = new HashMap();
			attributes.put( item, itemAttributes );
		}
		itemAttributes.put( key, value );
	}
	//#endif
	
	//#if polish.midp
	/**
	 * Gets an previously added attribute of the specified item.
	 * 
	 * @param item the item from which the attribute should be retrieved
	 * @param key the key of the attribute
	 * @return the attribute value, null if none has been registered under the given key before
	 */
	public static Object getAttribute( javax.microedition.lcdui.Item item, Object key ) {
		if ( attributes == null ) {
			return null;
		}
		HashMap itemAttributes = (HashMap) attributes.get( item );
		if (itemAttributes == null) {
			return null;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -