bringing android mode up to date, tweaking java mode

This commit is contained in:
benfry
2011-01-22 18:40:19 +00:00
parent cefdea6522
commit bb59356978
12 changed files with 228 additions and 77 deletions

View File

@@ -31,22 +31,22 @@ import processing.app.EditorToolbar;
public class JavaToolbar extends EditorToolbar {
/** Rollover titles for each button. */
static final String title[] = {
"Run", "Stop", "New", "Open", "Save", "Export"
};
// static final String title[] = {
// "Run", "Stop", "New", "Open", "Save", "Export"
// };
/** Titles for each button when the shift key is pressed. */
static final String titleShift[] = {
"Present", "Stop", "New Editor Window", "Open in Another Window", "Save", "Export to Application"
};
static final int RUN = 0;
static final int STOP = 1;
// static final String titleShift[] = {
// "Present", "Stop", "New Editor Window", "Open in Another Window", "Save", "Export to Application"
// };
static final int NEW = 2;
static final int OPEN = 3;
static final int SAVE = 4;
static final int EXPORT = 5;
static protected final int RUN = 0;
static protected final int STOP = 1;
static protected final int NEW = 2;
static protected final int OPEN = 3;
static protected final int SAVE = 4;
static protected final int EXPORT = 5;
// JPopupMenu popup;
// JMenu menu;
@@ -57,9 +57,22 @@ public class JavaToolbar extends EditorToolbar {
Image[][] images = loadImages();
for (int i = 0; i < 6; i++) {
addButton(title[i], titleShift[i], images[i], i == NEW);
addButton(getTitle(i, false), getTitle(i, true), images[i], i == NEW);
}
}
static public String getTitle(int index, boolean shift) {
switch (index) {
case RUN: return shift ? "Run" : "Present";
case STOP: return "Stop";
case NEW: return shift ? "New" : "New Editor Window";
case OPEN: return shift ? "Open" : "Open in Another Window";
case SAVE: return "Save";
case EXPORT: return shift ? "Export Applet" : "Export Application";
}
return null;
}
public void handlePressed(MouseEvent e, int sel) {
@@ -100,9 +113,9 @@ public class JavaToolbar extends EditorToolbar {
case EXPORT:
if (shift) {
jeditor.handleExportApplication();
jeditor.handleExportPackage();
} else {
jeditor.handleExportApplet();
jeditor.handleExportProject();
}
break;
}