Show PictureCanvas.java syntax highlighted
/*
* Copyright (c) 2004
* Helsinki Institute of Physics
* see LICENSE file for details
*
* PictureCanvas.java
* Created on Sep 12, 2004
*/
package fi.hip.gb.client;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;
import fi.hip.gb.midlet.core.LiteResult;
/**
* Shows pictures taken with integrated camera.
*
* @author Juho Karppinen
*/
public class PictureCanvas extends GenericImageCanvas {
/** command for saving the image to memory */
private Command saveCommand;
public PictureCanvas(LiteResult imageData) {
super(imageData);
addCommand(new Command("Thumbs", Command.BACK, 1));
addCommand(new Command("Capture new", Command.SCREEN, 3));
addCommand(new Command("Send as parameter", Command.SCREEN, 4));
if(imageData.getRecordID() == -1) {
// image not saved yet
saveCommand = new Command("Save picture", Command.SCREEN, 2);
addCommand(saveCommand);
} else {
// image exists on persistent memory
addCommand(new Command("Delete picture", Command.SCREEN, 2));
}
}
public void commandAction(Command c, Displayable disp) {
if ((c.getCommandType() == Command.BACK)) {
MIDui.back(true);
} else if(c.getLabel().equals("Capture new")) {
MIDui.showCamera();
} else if(c.getLabel().equals("Save picture")) {
removeCommand(saveCommand);
MIDui.savePicture(data);
} else if(c.getLabel().equals("Delete picture")) {
MIDui.deletePicture(data, true);
} else if(c.getLabel().equals("Send as parameter")) {
MIDui.showDispatch(null, data);
}
}
}
See more files for this project here