|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Canvas
fds.micro.ui.AbstractPanel
fds.micro.ui.XYPanel
This class implement a panel that manages components derivated from fds.micro.ui.Component, and places them with absolute coordinates.
Here is a simple MIDlet that displays a tiled image:
import java.io.IOException; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import fds.micro.ui.*; import fds.micro.ui.events.*; public class MyMidlet extends MIDlet { private XYPanel panel; public MyMidlet() { final int numberOfRows = 3; final int numberOfColumns = 3; // Panel this.panel = new XYPanel(); // Image to use Image myImage; try { myImage = Image.createImage("/test.png"); } catch(IOException ioe) { throw new RuntimeException(); } int imgWidth = myImage.getWidth(); int imgHeight = myImage.getHeight(); // Add tiled images for(int row = 0; row < numberOfRows; row++) { for(int col = 0; col < numberOfColumns; col++) { this.panel.append(new ImageItem(myImage), 10 + (col * imgWidth), 10 + (row * imgHeight)); } } // Add a quit hyperlink final Hyperlink link = new Hyperlink("Quit hyperlink"); link.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { MyMidlet.this.notifyDestroyed(); } } ); this.panel.append(link, 10, 20 + (numberOfRows * imgHeight)); } protected void startApp() throws MIDletStateChangeException { Display.getDisplay(this).setCurrent(this.panel); } protected void pauseApp() { } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { } }
Field Summary |
Fields inherited from class javax.microedition.lcdui.Canvas |
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
Constructor Summary | |
XYPanel()
|
Method Summary | |
void |
append(Component component,
int x,
int y)
Add an component to the container. |
Methods inherited from class fds.micro.ui.AbstractPanel |
addContainerListener, append, contains, getComponent, getComponents, getCount, getFocusIndex, indexOf, indexOf, insert, isEmpty, lastIndexOf, lastIndexOf, remove, removeAll, removeContainerListener, replace, setBackground, setComponents, setFocusIndex, setFocusIndex |
Methods inherited from class javax.microedition.lcdui.Canvas |
getGameAction, getHeight, getKeyCode, getKeyName, getWidth, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints |
Methods inherited from class javax.microedition.lcdui.Displayable |
addCommand, isShown, removeCommand, setCommandListener |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XYPanel()
Method Detail |
public void append(Component component, int x, int y)
component
- The component to add.x
- The X coordinate.y
- The Y coordinate.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |