From 14b9aed06a7e844397123b1547a44ea067dd12e2 Mon Sep 17 00:00:00 2001 From: Dan Koller <57103678+dan-koller@users.noreply.github.com> Date: Fri, 24 Nov 2023 17:16:26 +0100 Subject: [PATCH] Updated window size to be cross-platform compatible --- .../Viewer => sqlite/viewer}/SQLiteViewer.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) rename app/src/main/java/{SQLite/Viewer => sqlite/viewer}/SQLiteViewer.java (96%) diff --git a/app/src/main/java/SQLite/Viewer/SQLiteViewer.java b/app/src/main/java/sqlite/viewer/SQLiteViewer.java similarity index 96% rename from app/src/main/java/SQLite/Viewer/SQLiteViewer.java rename to app/src/main/java/sqlite/viewer/SQLiteViewer.java index 65f1e40..e428d51 100644 --- a/app/src/main/java/SQLite/Viewer/SQLiteViewer.java +++ b/app/src/main/java/sqlite/viewer/SQLiteViewer.java @@ -1,4 +1,4 @@ -package SQLite.Viewer; +package sqlite.viewer; import javax.swing.*; import java.awt.*; @@ -12,12 +12,15 @@ public class SQLiteViewer extends JFrame { public SQLiteViewer() { // Basic window settings + String osName = System.getProperty("os.name").toLowerCase(); + int width = osName.contains("win") ? 540 : 525; + int height = 700; + setSize(width, height); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setSize(525, 700); setLayout(new BorderLayout()); - setResizable(false); setLocationRelativeTo(null); setTitle("SQLite Viewer"); + setResizable(false); // Same look and feel for all operating systems (using Nimbus) try { UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); @@ -45,7 +48,7 @@ private void initComponents() { JTextArea queryTextArea = new JTextArea(); queryTextArea.setName("QueryTextArea"); queryTextArea.setRows(8); - queryTextArea.setColumns(35); + queryTextArea.setColumns(36); queryTextArea.setEnabled(false); JScrollPane queryTextScroll = new JScrollPane(queryTextArea); @@ -84,7 +87,7 @@ private void initComponents() { // SQL selection menu JMenu sqlMenu = new JMenu("Select"); - JCheckBoxMenuItem sqliteMenuItem = new JCheckBoxMenuItem("SQLite"); + JCheckBoxMenuItem sqliteMenuItem = new JCheckBoxMenuItem("sqlite"); sqliteMenuItem.setState(true); sqlMenu.add(sqliteMenuItem);