}
}
+ /**
+ * Requests that this Component get the input focus, if this Component's
+ * top-level ancestor is already the focused Window.
+ */
+ public void requestFocusInWindow() {
+ if (frame != null) {
+ frame.requestFocusInWindow();
+ } else {
+ component.requestFocusInWindow();
+ }
+ }
+
}
* @param font the new font
*/
public void setFont(final Font font) {
- synchronized (this) {
- this.font = font;
- getFontDimensions();
- swing.setFont(font);
- glyphCacheBlink = new HashMap<Cell, BufferedImage>();
- glyphCache = new HashMap<Cell, BufferedImage>();
- resizeToScreen(true);
+ if (!SwingUtilities.isEventDispatchThread()) {
+ // Not in the Swing thread: force this inside the Swing thread.
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ synchronized (this) {
+ SwingTerminal.this.font = font;
+ getFontDimensions();
+ swing.setFont(font);
+ glyphCacheBlink = new HashMap<Cell, BufferedImage>();
+ glyphCache = new HashMap<Cell, BufferedImage>();
+ resizeToScreen(true);
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ } else {
+ synchronized (this) {
+ SwingTerminal.this.font = font;
+ getFontDimensions();
+ swing.setFont(font);
+ glyphCacheBlink = new HashMap<Cell, BufferedImage>();
+ glyphCache = new HashMap<Cell, BufferedImage>();
+ resizeToScreen(true);
+ }
}
}
* @param mouse mouse event received
*/
public void mouseEntered(final MouseEvent mouse) {
- // Ignore
+ swing.requestFocusInWindow();
}
/**