Changes

Jump to: navigation, search

Teams Winter 2011/team4/project

1,731 bytes added, 17:49, 10 April 2011
Define the Application
*GridFieldManagers are used to align data neatly and quickly (used for the menu at the bottom of the screen).
*AbsoluteFieldManagers enable us to draw bitmaps at a specified x and y coordinate on the screen, something other FieldManagers are unable to perform.
<pre>
public Screen2() {
//Define private attributes
screen = new AbsoluteFieldManager();
bitmap = Bitmap.getBitmapResource("icon.png");
screenHolder = new AbsoluteFieldManager();
tempScreenHolder = null;
grid = new GridFieldManager(1,4,0);
colorGrid = new GridFieldManager(8,6,0);
bmf2 = null;
alphaSwitch = draw = added = false;
tbX = tbY = currentColour = width = height = 0;
counter = 4;
displayHeight = Display.getHeight();
displayWidth = Display.getWidth();
//Startup code
Border border = BorderFactory.createSimpleBorder(new XYEdges(6, 6, 6, 6));
setColorGrid(colorGrid);
screenHolder.setMargin(0, 0, 0, 0);
grid.setBorder(border);
grid.setBackground(BackgroundFactory.createSolidBackground(Color.GRAY));
grid.add(new NullField());
grid.getFieldAtIndex(0).setPadding(bitmap.getHeight()-10, bitmap.getWidth()-10, 0, 0);
grid.getFieldAtIndex(0).setBorder(BorderFactory.createSimpleBorder(new XYEdges(2, 2, 2, 2)));
grid.getFieldAtIndex(0).setBackground(BackgroundFactory.createSolidBackground(Color.GREEN));
grid.add(new BitmapField(Bitmap.getBitmapResource("paint.png")));
grid.add(new BitmapField(Bitmap.getBitmapResource("clear.png")));
grid.add(new BitmapField(Bitmap.getBitmapResource("circle.png")));
this.setStatus(grid);
Bitmap bitmap2 = Bitmap.getBitmapResource("square.png");
width = bitmap2.getWidth()/20;
height = bitmap2.getHeight()/20;
this.add(screen);
int columnWidth = (displayWidth / 4) -
(grid.getColumnPadding()+(grid.getBorder().getLeft())/2);
for(int i = 0; i < 4; i++) {
grid.setColumnProperty(i, GridFieldManager.FIXED_SIZE, columnWidth);
}
}
</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.

Navigation menu