Permalink
Browse files

Go back to setting the JConsole's font at construction time, because …

…of a Swing/Windows bug where .setFont() doesn't repaint the text widget until the contents change.
  • Loading branch information...
1 parent d9e7712 commit 3dfe82210130d92a7d6e052389a8642ee035d70b @ivan ivan committed May 7, 2012
Showing with 8 additions and 4 deletions.
  1. +1 −2 src/clj/org/dipert/swingrepl/main.clj
  2. +7 −2 src/jvm/bsh/util/JConsole.java
@@ -55,7 +55,7 @@
(.setSize width height)
(.setDefaultCloseOperation on-close)
(.setLocationRelativeTo nil))]
- (let [console (bsh.util.JConsole.)]
+ (let [console (bsh.util.JConsole. font)]
(doto (.getContentPane jframe)
(.setLayout (java.awt.BorderLayout.))
(.add console))
@@ -66,7 +66,6 @@
(let [thread (make-repl-thread console :prompt prompt :init init :eval eval)
stopper (clojure.repl/thread-stopper thread)]
(doto console
- (.setFont font)
(.setInterruptFunction (fn [reason] (stopper reason)))
(.setEOFFunction (window-closing-dispatcher jframe)))
(.start thread)
@@ -103,10 +103,14 @@ public PrintWriter getErr() {
private boolean gotUp = true;
public JConsole() {
- this(null, null);
+ this(null, null, new Font("Monospaced", Font.PLAIN, 14));
}
- public JConsole(Reader cin, Writer cout) {
+ public JConsole(Font font) {
+ this(null, null, font);
+ }
+
+ public JConsole(Reader cin, Writer cout, Font font) {
super();
// Special TextPane which catches for cut and paste, both L&F keys and
@@ -126,6 +130,7 @@ public void paste() {
}
};
+ text.setFont(font);
text.setText("");
text.setMargin(new Insets(7, 5, 7, 5));
text.addKeyListener(this);

0 comments on commit 3dfe822

Please sign in to comment.