private String text = null;
private Font font = DEFAULT_FONT;
- private Picture texture;
+ private Picture texture = null;
private short strokewidth = 1;
private int fillcolor = 0x00000000;
private int strokecolor = 0xFF000000;
/** invoked when a resource needed to render ourselves finishes loading */
- public void perform() {
+ public void perform() throws JSExn {
+ // as external events have occured, check the state of box
+ if (texture != null) {
+ if (texture.isLoaded) { minwidth = texture.width; minheight = texture.height; }
+ else { Res res = texture.res; texture = null; throw new JSExn("image not found: "+res); }
+ }
+
MARK_REPACK;
MARK_REFLOW;
MARK_RESIZE;
}
if (!(value instanceof Res)) return;
-
- // FIXME
texture = Picture.load((Res)value, this);
- if (texture.isLoaded) {
- minwidth = texture.width;
- minheight = texture.height;
- MARK_REFLOW;
- dirty();
- return;
- }
- texture = Picture.load((Res)value, new Scheduler.Task() { public void perform() {
- // FIXME pass this instead of a new Task?
- minwidth = texture.width;
- minheight = texture.height;
- Box b = Box.this; MARK_REFLOW_b;
- dirty();
- } });
}
private void mouseEvent(String name, Object value) {