Changes

Jump to: navigation, search

Teams Winter 2011/team4/project

1,050 bytes added, 18:45, 10 April 2011
Define the Application
===Define the Application===
*Create a class called Menu. This will provide the user with an interface to navigate between screens.
<pre>public class Menu extends UiApplication {...}</pre>*It This allows the user to view Screen 1(our start screen) and then ultimately begin drawing on Screen2 (drawing screen).
*It allows us to push screens onto the stack in order get them to be displayed.
*The code to implement the Menu class is as follows:
<pre> // Push a screen onto the UI stack for rendering. ButtonField start = new ButtonField( "Start", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER); ButtonField about = new ButtonField( "About", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER); HorizontalFieldManager horizontalFieldManager = getFieldManager(); VerticalFieldManager innerManager = new VerticalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT); screen.add(horizontalFieldManager); horizontalFieldManager.add( innerManager ); innerManager.add(start); innerManager.add(about); innerManager.setPadding((Display.getHeight()/2)-30, 0, 0, 0); start.setChangeListener( new FieldChangeListener() { public void fieldChanged( Field arg0, int arg1 ) { pushScreen(new Screen2()); } } ); pushScreen( screen);</pre>
*Next we will be implementing Screen1 which will provide the user with a nice background image, as well as two buttons (one to view the about information, and one to begin drawing).
*The code is as follows:
<pre></pre>
*The 3rd class is Screen2, which does the bulk of the work in our application.
*Upon instantiation, numerous managers are created for various different tasks.

Navigation menu