📄 uiaccess.java
字号:
* Retrieves the internal y position of the given item.
* The internal position is useful for items that have a large content which
* needs to be scrolled, e.g. containers.
*
* @param item the item
* @return the internal y position of this item's currently selected content.
* @see #getInternalX(javax.microedition.lcdui.Item)
*/
public static int getInternalY( javax.microedition.lcdui.Item item ) {
return -1;
}
//#endif
//#if polish.midp
/**
* Retrieves the internal width of the given item.
* The internal position is useful for items that have a large content which
* needs to be scrolled, e.g. containers.
*
* @param item the item
* @return the internal width of this item's currently selected content.
* @see #getInternalX(javax.microedition.lcdui.Item)
*/
public static int getInternalWidth( javax.microedition.lcdui.Item item ) {
return -1;
}
//#endif
//#if polish.midp
/**
* Retrieves the internal height of the given item.
* The internal position is useful for items that have a large content which
* needs to be scrolled, e.g. containers.
*
* @param item the item
* @return the internal height of this item's currently selected content.
* @see #getInternalX(javax.microedition.lcdui.Item)
*/
public static int getInternalHeight( javax.microedition.lcdui.Item item ) {
return -1;
}
//#endif
//#if polish.usePolishGui
/**
* Retrieves the internal x position of the given item.
* When it is equal -9999 this item's internal position is not known.
* The internal position is useful for items that have a large content which
* needs to be scrolled, e.g. containers.
*
* @param item the item
* @return the internal x position of this item's currently selected content, -9999 when it is unknown.
*/
public static int getInternalX( Item item ) {
return item.internalX;
}
//#endif
//#if polish.usePolishGui
/**
* Retrieves the internal y position of the given item.
* The internal position is useful for items that have a large content which
* needs to be scrolled, e.g. containers.
*
* @param item the item
* @return the internal y position of this item's currently selected content.
* @see #getInternalX(Item)
*/
public static int getInternalY( Item item ) {
return item.internalY;
}
//#endif
//#if polish.usePolishGui
/**
* Retrieves the internal width of the given item.
* The internal position is useful for items that have a large content which
* needs to be scrolled, e.g. containers.
*
* @param item the item
* @return the internal width of this item's currently selected content.
* @see #getInternalX(Item)
*/
public static int getInternalWidth( Item item ) {
return item.internalWidth;
}
//#endif
//#if polish.usePolishGui
/**
* Retrieves the internal height of the given item.
* The internal position is useful for items that have a large content which
* needs to be scrolled, e.g. containers.
*
* @param item the item
* @return the internal height of this item's currently selected content.
* @see #getInternalX(Item)
*/
public static int getInternalHeight( Item item ) {
return item.internalHeight;
}
//#endif
//#if polish.usePolishGui
public static Style focus( Item item, int direction, Style style ) {
return item.focus(style, direction);
}
//#endif
//#if polish.usePolishGui
public static void defocus( Item item, Style style ) {
item.defocus(style);
}
//#endif
//#if polish.midp
/**
* Sets the focus to the given index of the specified list.
* When the list is not shown, it will be shown in this call.
* When the J2ME Polish GUI is not used, only the list will be shown.
*
* @param display the display
* @param list the list
* @param index the index
*/
public static void setCurrentListIndex( Display display, javax.microedition.lcdui.List list, int index ) {
//#if !polish.blackberry && polish.usePolishGui
display.setCurrent( list );
//#endif
}
//#endif
//#if polish.usePolishGui
/**
* Sets the focus to the given index of the specified list.
* When the list is not shown, it will be shown in this call.
* When the J2ME Polish GUI is not used, only the list will be shown.
*
* @param display the display
* @param list the list
* @param index the index
*/
public static void setCurrentListIndex( Display display, List list, int index ) {
Item item = list.getItem( index );
item.show( display );
}
//#endif
//#if polish.midp
/**
* Applies a style to the given item if used in conjunction with the //#style preprocessing directive.
*
* Example:
* <pre>
* //#style myStyle
* UiAccess.setStyle( myItem );
* </pre>
* @param item the item which should get the new style
*/
public static void setStyle( javax.microedition.lcdui.Item item ) {
// ignore
}
//#endif
//#if polish.midp
/**
* Applies a style to the given screen if used in conjunction with the //#style preprocessing directive.
*
* Example:
* <pre>
* //#style myStyle
* UiAccess.setStyle( myScreen );
* </pre>
* @param screen the screen which should get the new style
*/
public static void setStyle( javax.microedition.lcdui.Screen screen ) {
// ignore
}
//#endif
//#if polish.usePolishGui
/**
* Applies a style to the given item if used in conjunction with the //#style preprocessing directive.
*
* Example:
* <pre>
* //#style myStyle
* UiAccess.setStyle( myItem );
* </pre>
* @param item the item which should get the new style
*/
public static void setStyle( Item item ) {
// ignore
}
//#endif
//#if polish.usePolishGui
/**
* Applies a style to the given screen if used in conjunction with the //#style preprocessing directive.
*
* Example:
* <pre>
* //#style myStyle
* UiAccess.setStyle( myScreen );
* </pre>
* @param screen the screen which should get the new style
*/
public static void setStyle( Screen screen ) {
// ignore
}
//#endif
//#if polish.usePolishGui
/**
* Applies a style to the given item.
*
* @param item the item which should get the new style
* @param style the style
*/
public static void setStyle( Item item, Style style ) {
item.setStyle( style );
}
//#endif
//#if polish.usePolishGui
/**
* Applies a style to the given screen.
*
* @param screen the screen which should get the new style
* @param style the style
*/
public static void setStyle( Screen screen, Style style ) {
screen.setStyle( style );
}
//#endif
//#if polish.midp
/**
* Applies a style to the specified list item.
*
* @param list the list
* @param itemIndex the index of the list
*/
public static void setStyle(javax.microedition.lcdui.List list, int itemIndex) {
// ignore
}
//#endif
//#if polish.usePolishGui
/**
* Applies a style to the specified list item.
*
* @param list the list
* @param itemIndex the index of the list
*/
public static void setStyle(List list, int itemIndex) {
// ignore
}
//#endif
//#if polish.usePolishGui
/**
* Applies a style to the specified list item.
*
* @param list the list
* @param itemIndex the index of the list
* @param style the new style of the item
*/
public static void setStyle(List list, int itemIndex, Style style) {
Item item = list.getItem(itemIndex);
item.setStyle(style);
}
//#endif
//#if polish.usePolishGui && polish.midp
/**
* Gets the current style of the given item.
*
* Example:
* <pre>
* //#if polish.usePolishGui
* Style style = UiAccess.getStyle( myItem );
* if (style != null) }
* style.background = new SimpleBackground( 0x00FF00 );
* }
* //#endif
* </pre>
* Note: this method is only available when the J2ME Polish GUI is used, so you better check for the polish.usePolishGui prepocessing symbol.
*
* @param item the item of which the style should be retrieved
* @return the style of the item
*/
public static Style getStyle( javax.microedition.lcdui.Item item ) {
return null;
}
//#endif
//#if polish.usePolishGui && polish.midp
/**
* Gets the current style of the given screen.
*
* Example:
* <pre>
* //#if polish.usePolishGui
* Style style = UiAccess.getStyle( myScreen );
* if (style != null) }
* style.background = new SimpleBackground( 0x00FF00 );
* }
* //#endif
* </pre>
* Note: this method is only available when the J2ME Polish GUI is used, so you better check for the polish.usePolishGui prepocessing symbol.
*
* @param screen the screen of which the style should be retrieved
* @return the style of the screen
*/
public static Style getStyle( javax.microedition.lcdui.Screen screen ) {
return null;
}
//#endif
//#if polish.usePolishGui
/**
* Gets the current style of the given item.
*
* Example:
* <pre>
* //#if polish.usePolishGui
* Style style = UiAccess.getStyle( myItem );
* if (style != null) }
* style.background = new SimpleBackground( 0x00FF00 );
* }
* //#endif
* </pre>
* Note: this method is only available when the J2ME Polish GUI is used, so you better check for the polish.usePolishGui prepocessing symbol.
*
* @param item the item of which the style should be retrieved
* @return the style of the item
*/
public static Style getStyle( Item item ) {
return item.style;
}
//#endif
//#if polish.usePolishGui
/**
* Gets the current style of the given screen.
*
* Example:
* <pre>
* //#if polish.usePolishGui
* Style style = UiAccess.getStyle( myScreen );
* if (style != null) }
* style.background = new SimpleBackground( 0x00FF00 );
* }
* //#endif
* </pre>
* Note: this method is only available when the J2ME Polish GUI is used, so you better check for the polish.usePolishGui prepocessing symbol.
*
* @param screen the screen of which the style should be retrieved
* @return the style of the screen
*/
public static Style getStyle( Screen screen ) {
return screen.style;
}
//#endif
//#if polish.usePolishGui
public static boolean handleKeyPressed( Item item, int keyCode, int gameAction ) {
return item.handleKeyPressed(keyCode, gameAction);
}
//#endif
//#if polish.usePolishGui
public static boolean handlePointerPressed( Item item, int x, int y ) {
//#if polish.hasPointerEvents
//# return item.handlePointerPressed(x, y);
//#else
return false;
//#endif
}
//#endif
//#if polish.midp
/**
* Sets the caret position in the given text field.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -