git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add versioned about box, set title
[fanfix.git]
/
src
/
jexer
/
io
/
SwingScreen.java
diff --git
a/src/jexer/io/SwingScreen.java
b/src/jexer/io/SwingScreen.java
index b7c8410993ce8647e23eacc8c5f8aad3545ece8f..3d0729e4feecd719b78431d93e1e54da46c9e30a 100644
(file)
--- a/
src/jexer/io/SwingScreen.java
+++ b/
src/jexer/io/SwingScreen.java
@@
-165,6
+165,11
@@
public final class SwingScreen extends Screen {
*/
SwingScreen screen;
*/
SwingScreen screen;
+ /**
+ * If true, we were successful getting Terminus.
+ */
+ private boolean gotTerminus = false;
+
/**
* Width of a character cell.
*/
/**
* Width of a character cell.
*/
@@
-329,8
+334,9
@@
public final class SwingScreen extends Screen {
getContextClassLoader();
InputStream in = loader.getResourceAsStream(FONTFILE);
Font terminusRoot = Font.createFont(Font.TRUETYPE_FONT, in);
getContextClassLoader();
InputStream in = loader.getResourceAsStream(FONTFILE);
Font terminusRoot = Font.createFont(Font.TRUETYPE_FONT, in);
- Font terminus = terminusRoot.deriveFont(Font.PLAIN, 2
2
);
+ Font terminus = terminusRoot.deriveFont(Font.PLAIN, 2
0
);
setFont(terminus);
setFont(terminus);
+ gotTerminus = true;
} catch (Exception e) {
e.printStackTrace();
// setFont(new Font("Liberation Mono", Font.PLAIN, 24));
} catch (Exception e) {
e.printStackTrace();
// setFont(new Font("Liberation Mono", Font.PLAIN, 24));
@@
-375,15
+381,24
@@
public final class SwingScreen extends Screen {
Rectangle2D bounds = fm.getMaxCharBounds(gr);
int leading = fm.getLeading();
textWidth = (int)Math.round(bounds.getWidth());
Rectangle2D bounds = fm.getMaxCharBounds(gr);
int leading = fm.getLeading();
textWidth = (int)Math.round(bounds.getWidth());
- textHeight = (int)Math.round(bounds.getHeight()) - maxDescent;
- // This also produces the same number, but works better for ugly
+ // textHeight = (int)Math.round(bounds.getHeight()) - maxDescent;
+
+ // This produces the same number, but works better for ugly
// monospace.
textHeight = fm.getMaxAscent() + maxDescent - leading;
// monospace.
textHeight = fm.getMaxAscent() + maxDescent - leading;
+ if (gotTerminus == true) {
+ textHeight++;
+ }
+
if (System.getProperty("os.name").startsWith("Windows")) {
textAdjustY = -1;
textAdjustX = 0;
}
if (System.getProperty("os.name").startsWith("Windows")) {
textAdjustY = -1;
textAdjustX = 0;
}
+ if (System.getProperty("os.name").startsWith("Mac")) {
+ textAdjustY = -1;
+ textAdjustX = 0;
+ }
}
/**
}
/**
@@
-857,4
+872,13
@@
public final class SwingScreen extends Screen {
return ((y - frame.top) / frame.textHeight);
}
return ((y - frame.top) / frame.textHeight);
}
+ /**
+ * Set the window title.
+ *
+ * @param title the new title
+ */
+ public void setTitle(final String title) {
+ frame.setTitle(title);
+ }
+
}
}