protected int _stringWidth(String font, String text) { return getFont(font).metrics.stringWidth(text); }
protected int _getMaxAscent(String font) { return getFont(font).metrics.getMaxAscent(); }
protected int _getMaxDescent(String font) { return getFont(font).metrics.getMaxDescent(); }
+ protected boolean _supressDirtyOnResize() { return true; }
protected String _getClipBoard() {
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
return 0;
}
+ static class Open extends FileDialog implements WindowListener, ComponentListener {
+ Semaphore s;
+ public Open(String suggestedFileName, Semaphore s, boolean write) {
+ super(new Frame(), suggestedFileName, write ? FileDialog.SAVE : FileDialog.LOAD);
+ this.s = s;
+ }
+ public void windowActivated(WindowEvent e) { }
+ public void windowClosed(WindowEvent e) { s.release(); }
+ public void windowClosing(WindowEvent e) { }
+ public void windowDeactivated(WindowEvent e) { }
+ public void windowDeiconified(WindowEvent e) { }
+ public void windowIconified(WindowEvent e) { }
+ public void windowOpened(WindowEvent e) { }
+ public void componentHidden(ComponentEvent e) { s.release(); }
+ public void componentMoved(ComponentEvent e) { }
+ public void componentResized(ComponentEvent e) { }
+ public void componentShown(ComponentEvent e) { }
+ };
+
+ protected String _fileDialog(String suggestedFileName, boolean write) {
+ Semaphore s = new Semaphore();
+ Open fd = new Open(suggestedFileName, s, write);
+ fd.addWindowListener(fd);
+ fd.addComponentListener(fd);
+ fd.show();
+ s.block();
+ return fd.getDirectory() + File.separatorChar + fd.getFile();
+ }
+
+ protected void _saveFile(String suggestedFileName, ByteStream data) throws IOException { }
+
// Inner Classes /////////////////////////////////////////////////////////////////////////////////////
protected static class AWTPicture implements Picture {
componentResized(window.getWidth() - insets.left - insets.right, window.getHeight() - insets.top - insets.bottom);
Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height);
+
+ // this is safe because AWT's low-level drawing functions are threadsafe
+ blitDirtyScreenRegions();
}
}
public void paint(Graphics gr) {
Rectangle r = gr.getClipBounds();
Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height);
+
+ // this is safe because AWT's low-level drawing functions are threadsafe
+ blitDirtyScreenRegions();
}
}