diff --git a/src/com/jovial/jrpn/GButton.java b/src/com/jovial/jrpn/GButton.java index f8cd7aa..480323e 100644 --- a/src/com/jovial/jrpn/GButton.java +++ b/src/com/jovial/jrpn/GButton.java @@ -174,11 +174,17 @@ protected void drawWhiteLabel(Graphics2D g, int offsetX, int offsetY) { // joins the sqrt symbol. public static class Sqrt extends GButton { int sqrtWidth; + int overlineWidth; + int xWidth; int blueHeight; + private final static String overline = "\u203E\u203E"; @Override public void alignText() { super.alignText(); - sqrtWidth = scaleInfo.blueFontMetrics.stringWidth("\u221A"); // √ + FontMetrics fm = scaleInfo.blueFontMetrics; + sqrtWidth = fm.stringWidth("\u221A"); // √ + overlineWidth = fm.stringWidth(overline); + xWidth = fm.stringWidth("x"); blueHeight = scaleInfo.blueFontMetrics.getAscent(); } @@ -202,9 +208,11 @@ protected void drawBlueLabel(Graphics2D g, int offsetX, int offsetY) { shiftLeft = 1; } // TODO: Make the shiftLeft factor and minimum be items that can be configured. - y -= shiftUp; x += sqrtWidth - shiftLeft; - g.drawString("x\u0305", x, y); + y -= shiftUp; + g.drawString("x", x + (overlineWidth - xWidth)/2, y); + g.drawString("\u203E\u203E", x, y); + // I saw an issue on OSX with combining overline (\u0305) } } } diff --git a/src/com/jovial/jrpn/fmMain.java b/src/com/jovial/jrpn/fmMain.java index 24f87bc..69211a7 100644 --- a/src/com/jovial/jrpn/fmMain.java +++ b/src/com/jovial/jrpn/fmMain.java @@ -318,10 +318,11 @@ private void initComponents() throws InterruptedException { jSeparator7 = new javax.swing.JPopupMenu.Separator(); mHelpAbout = new javax.swing.JMenuItem(); - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); + System.exit(0); } }); addComponentListener(new java.awt.event.ComponentAdapter() {