setFont(new Font(Font.MONOSPACED, Font.PLAIN, 24));
}
pack();
- setVisible(true);
- resizeToScreen();
// Kill the X11 cursor
// Transparent 16 x 16 pixel cursor image.
Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(
cursorImg, new Point(0, 0), "blank cursor");
setCursor(blankCursor);
+ getFontDimensions();
}
/**
- * Resize to font dimensions.
+ * Figure out my font dimensions.
*/
- public void resizeToScreen() {
+ private void getFontDimensions() {
Graphics gr = getGraphics();
FontMetrics fm = gr.getFontMetrics();
maxDescent = fm.getMaxDescent();
// This also produces the same number, but works better for ugly
// monospace.
textHeight = fm.getMaxAscent() + maxDescent - leading;
+ }
+ /**
+ * Resize to font dimensions.
+ */
+ public void resizeToScreen() {
// Figure out the thickness of borders and use that to set the
// final size.
Insets insets = getInsets();
setSize(textWidth * screen.width + insets.left + insets.right,
textHeight * screen.height + insets.top + insets.bottom);
-
- /*
- System.err.printf("W: %d H: %d MD: %d L: %d\n", textWidth,
- textHeight, maxDescent, leading);
- */
}
/**
if (bounds != null) {
// Only update what is in the bounds
xCellMin = screen.textColumn(bounds.x);
- xCellMax = screen.textColumn(bounds.x + bounds.width) + 1;
+ xCellMax = screen.textColumn(bounds.x + bounds.width);
if (xCellMax > screen.width) {
xCellMax = screen.width;
}
xCellMin = 0;
}
yCellMin = screen.textRow(bounds.y);
- yCellMax = screen.textRow(bounds.y + bounds.height) + 1;
+ yCellMax = screen.textRow(bounds.y + bounds.height);
if (yCellMax > screen.height) {
yCellMax = screen.height;
}
if (yCellMin < 0) {
yCellMin = 0;
}
+ } else {
+ // We need a total repaint
+ reallyCleared = true;
}
// Prevent updates to the screen's data from the TApplication
reallyCleared = false;
} // synchronized (screen)
}
- }
+
+ } // class AWTFrame
/**
* The raw AWT Frame. Note package private access.
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
AWTScreen.this.frame = new AWTFrame(AWTScreen.this);
+ AWTScreen.this.sessionInfo =
+ new AWTSessionInfo(AWTScreen.this.frame,
+ frame.textWidth,
+ frame.textHeight);
+
+ AWTScreen.this.setDimensions(sessionInfo.getWindowWidth(),
+ sessionInfo.getWindowHeight());
+
+ AWTScreen.this.frame.resizeToScreen();
+ AWTScreen.this.frame.setVisible(true);
}
} );
} catch (Exception e) {
}
}
+ /**
+ * The sessionInfo.
+ */
+ private AWTSessionInfo sessionInfo;
+
/**
* Create the AWTSessionInfo. Note package private access.
*
* @return the sessionInfo
*/
AWTSessionInfo getSessionInfo() {
- AWTSessionInfo sessionInfo = new AWTSessionInfo(frame, frame.textWidth,
- frame.textHeight);
return sessionInfo;
}