Changes

Jump to: navigation, search

Teams Winter 2011/team4/project

1,207 bytes added, 17:51, 10 April 2011
Define the Application
</pre>
*All menu interaction is done through screen positions which we figure out using some math depending on the devices screen width and height (all of which are available to developers).
*We create the color screen by creating another GridFieldManager and setting each square to a different hex value to acheive the look and amount of colors we wanted.Example code below:<pre>private final int [] colours = { 0x000000,0x000033,0x000066,0x000099,0x0000CC,0x0000FF, 0x003300,0x003333,0x003366,0x003399,0x0033CC,0x0033FF, 0x00FF00,0x00FF33,0x00FF66,0x00FF99,0x00FFCC,0x00FFFF, 0x660000,0x660033,0x660066,0x660099,0x6600CC,0x6600FF, 0x666600,0x666633,0x666666,0x666699,0x6666CC,0x6666FF, 0xFF0000,0xFF0033,0xFF0066,0xFF0099,0xFF00CC,0xFF00FF, 0xFF9900,0xFF9933,0xFF9966,0xFF9999,0xFF99CC,0xFF99FF, 0xFFFF00,0xFFFF33,0xFFFF66,0xFFFF99,0xFFFFCC,0xFFFFFF};public void setColorGrid(GridFieldManager cg){ int i, h,w, rows = 10, cols = 6, rh = 3, rw = 2; h = displayHeight; w = displayWidth; cg.setEditable(true); for (i = 0; i < colours.length; i++){ cg.add(new ButtonField( "", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER)); cg.getFieldAtIndex(i).setPadding(h/(rows*rh), w/(cols*rw), h/(rows*rh), w/(cols*rw)); cg.getFieldAtIndex(i).setBorder(BorderFactory.createSimpleBorder(new XYEdges(0, 0, 0, 0))); cg.getFieldAtIndex(i).setBackground(BackgroundFactory.createSolidBackground(colours[i])); cg.setColumnPadding(0); cg.setRowPadding(0); }}</pre>
*The screen is saved between color choices by saving the manager in a temp variable, deleting it from the screen, then adding the gridFieldManager holding the color choices, waiting for user interaction, then deleting and re-adding the drawing screen.
*Clearing the screen is simply deleting all the fields in the manager

Navigation menu