diff --git a/src/com/devbaltasarq/pooi/core/AppInfo.java b/src/com/devbaltasarq/pooi/core/AppInfo.java index d397f58..32d904d 100644 --- a/src/com/devbaltasarq/pooi/core/AppInfo.java +++ b/src/com/devbaltasarq/pooi/core/AppInfo.java @@ -10,7 +10,7 @@ public class AppInfo { public static final String Name = "Pooi"; public static final String Email = "jbgarcia@uvigo.es"; public static final String Author = "Baltasar GarcĂ­a Perez-Schofield"; - public static final String Version = "2.2.1 20181203"; + public static final String Version = "2.2.2 20220427"; public static final String License = "MIT License: https://opensource.org/licenses/MIT"; public static final String SessionFileExt = ".txt"; public static final String ScriptFileExt = ".poi"; diff --git a/src/com/devbaltasarq/pooi/ui/App.java b/src/com/devbaltasarq/pooi/ui/App.java index a780335..552ddcb 100644 --- a/src/com/devbaltasarq/pooi/ui/App.java +++ b/src/com/devbaltasarq/pooi/ui/App.java @@ -4,9 +4,12 @@ import com.devbaltasarq.pooi.core.Interpreter; import com.devbaltasarq.pooi.core.Interpreter.InterpretError; import com.devbaltasarq.pooi.core.InterpreterCfg; +import sun.awt.resources.awt; import javax.swing.*; +import java.awt.*; import java.io.File; +import java.util.Map; import java.util.Scanner; /** @@ -85,6 +88,8 @@ private static void guiApp(Interpreter interpreter, String msg) { // Prepare look & feel, if possible try { + System.setProperty( "swing.aatext", "true" ); + System.setProperty( "awt.useSystemAAFontSettings", "on" ); UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); } catch(Exception ignored) { } diff --git a/src/com/devbaltasarq/pooi/ui/Canvas.java b/src/com/devbaltasarq/pooi/ui/Canvas.java index 8a1b7a2..73187ee 100644 --- a/src/com/devbaltasarq/pooi/ui/Canvas.java +++ b/src/com/devbaltasarq/pooi/ui/Canvas.java @@ -3,6 +3,7 @@ import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; +import java.util.Map; /** * Created by baltasarq on 27/04/16. @@ -18,7 +19,7 @@ public Canvas(int width, int height) { this.setMinimumSize( new Dimension( width, height ) ); - canvas = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB); + canvas = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); JLabel canvasFrame = new JLabel( new ImageIcon( canvas ) ); canvasFrame.setPreferredSize( new Dimension( width, height ) ); canvasFrame.setMinimumSize( new Dimension( width, height ) ); @@ -58,7 +59,8 @@ public void setBackgroundColor(Color c) { } /** Clears the drawing area */ - public void cls() { + public void cls() + { final Graphics grfs = this.canvas.getGraphics(); grfs.setColor( this.getBackgroundColor() ); @@ -134,6 +136,14 @@ public void circle(int x, int y, int r, boolean filled) } } + /** Gets the hints for antialiasing. */ + private Map getDesktopHints() + { + final Toolkit TK = Toolkit.getDefaultToolkit(); + + return (Map)( TK.getDesktopProperty("awt.font.desktophints") ); + } + /** * Draws a string in the graphic window * @param x the x coordinate of the starting point @@ -154,16 +164,21 @@ public void print(int x, int y, String str) public void print(int x, int y, String str, boolean isBold) { if ( str != null ) { - final Graphics grfs = canvas.getGraphics(); + final Graphics2D GRFS = (Graphics2D) canvas.getGraphics(); + final Map HINTS = this.getDesktopHints(); Font font = this.getFont(); if ( isBold ) { - font = font.deriveFont( Font.BOLD ); + font = font.deriveFont( Font.BOLD ); + } + + if ( HINTS != null ) { + GRFS.addRenderingHints( HINTS ); } - grfs.setFont( font ); - grfs.setColor( this.getColor() ); - grfs.drawChars( str.toCharArray(), 0, str.length(), x, y ); + GRFS.setFont( font ); + GRFS.setColor( this.getColor() ); + GRFS.drawChars( str.toCharArray(), 0, str.length(), x, y ); } } diff --git a/src/com/devbaltasarq/pooi/ui/VisualEngine.java b/src/com/devbaltasarq/pooi/ui/VisualEngine.java index 5c9caa0..1bdbc67 100644 --- a/src/com/devbaltasarq/pooi/ui/VisualEngine.java +++ b/src/com/devbaltasarq/pooi/ui/VisualEngine.java @@ -463,8 +463,6 @@ private void build() // Split view this.spPanel = new JSplitPane(); - this.spPanel.setDividerLocation( 150 ); - spMain.setDividerLocation( (int) ( this.getHeight() - ( this.getHeight() * 0.15 ) ) ); // Build components this.buildMenuBar(); @@ -548,8 +546,10 @@ public void mouseExited(MouseEvent e) { } } ); - // Center on screen + // Center on screen & polish this.setLocationRelativeTo( null ); + this.spPanel.setDividerLocation( (int) ( this.getWidth() * .15 ) ); + spMain.setDividerLocation( (int) ( this.getHeight() - ( this.getHeight() * .33 ) ) ); } private void onLoadSession()