diff options
Diffstat (limited to 'Jedecma.java')
| -rw-r--r-- | Jedecma.java | 92 |
1 files changed, 59 insertions, 33 deletions
diff --git a/Jedecma.java b/Jedecma.java index 7bde43c..25d8c1d 100644 --- a/Jedecma.java +++ b/Jedecma.java @@ -1,36 +1,54 @@ -/* +/* * Jedecma.java - main class - * + * * Copyright (c) 2025 Stefano Marchetti - * + * * This file is part of Jedecma - breast ultrasound examinations archiving software - * + * * Jedecma is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Jedecma is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Jedecma. If not, see <http://www.gnu.org/licenses/>. - * + * */ package jedecma; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.*; -import java.io.*; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.io.StreamTokenizer; +import java.util.Locale; +import java.util.Properties; +import java.util.ResourceBundle; +import java.util.Vector; + +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.WindowConstants; public class Jedecma extends JFrame { /** - * + * */ private static final long serialVersionUID = 1L; // **************************************************************** @@ -50,7 +68,8 @@ public class Jedecma extends JFrame { //final static String progVers = "3.1.12"; final static String progBuild = "20230410-1550"; // var.ActivationKey, MainMenu //final static String progVers = "3.1.13"; final static String progBuild = "20240101-0001"; // agg.to copyright, var.EULA //final static String progVers = "3.1.14"; final static String progBuild = "20240706-1650"; // riporta msg SQLException - final static String progVers = "3.1.15"; final static String progBuild = "20250101-2000"; // agg.to copyright, var.EULA + //final static String progVers = "3.1.15"; final static String progBuild = "20250101-2000"; // agg.to copyright, var.EULA + final static String progVers = "3.1.16"; final static String progBuild = "20250815-1500"; // DBFuncs; var.Stat1,Stat2,EcoExp,EcoEdit,SQLTool; csv hdr; aum.tmdime, CleanUp; // **************************************************************** static Image logo1 = null; static Image logo2 = null; @@ -65,7 +84,7 @@ public class Jedecma extends JFrame { static boolean multiuser = false; static String username, password, actstr; static String dict_file = "wrdcmpl.txt"; - static Vector<String> dict = new Vector<String>(); + static Vector<String> dict = new Vector<>(); static Font jTextAreaFont, jComboBoxFont, jTextFieldFont, jLabelFont, jTableFont = null; static String language = ""; @@ -106,17 +125,17 @@ public class Jedecma extends JFrame { mf.getContentPane().add(mainPan, BorderLayout.CENTER); mainPan.add(splash, BorderLayout.CENTER); - + try { // assegna look & fill standard UIManager //.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); .setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } - + // disabilita la possibilita' di chiudere il frame con X - mf.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + mf.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); if (multiuser) mf.setTitle("Jedecma " + Jedecma.progVers + " " @@ -138,17 +157,19 @@ public class Jedecma extends JFrame { public static void main(String[] args) { // inizio del main username = ""; password = ""; - + System.out.println("Jedecma rel." + progVers + " " +progBuild); System.out.println("java.version: " + System.getProperty("java.version")); System.out.println("java.vm.name: " + System.getProperty("java.vm.name")); System.out.println("java.runtime.name: " + System.getProperty("java.runtime.name")); - System.out.println("os.name: " + System.getProperty("os.name") + " os.arch: " + System.out.println("os.name: " + System.getProperty("os.name") + " os.arch: " + System.getProperty("os.arch")); System.out.println("user.name: " + System.getProperty("user.name")); - + System.out.println("java.class.path: "+ System.getProperty("java.class.path")); + mf = new Jedecma(); // crea top-level container mf.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent e) { String s = "<html><body><center>Jedecma " + Jedecma.progVers; s += "<br>" + localMessagesBundle.getString("QUIT_PROGRAM"); @@ -164,8 +185,8 @@ public class Jedecma extends JFrame { { // processa argomenti di chiamata String arg, kw; int idx = -1; - for (int i = 0; i < args.length; i++) { - arg = args[i]; + for (String arg2 : args) { + arg = arg2; kw = "multi"; idx = arg.indexOf("--" + kw); if (idx >= 0) { @@ -190,14 +211,14 @@ public class Jedecma extends JFrame { // legge da file i parametri e inizializza param ak = new ActivationKey(); - param = Uti1.readProp(); + param = Uti1.readProp(); ak.readKey(); - if (! ak.isEenableMulti() && multiuser == true) { + if (! ak.isEenableMulti() && multiuser) { multiuser = false; System.out.println("multiuser=" + multiuser); } - + { String s = Jedecma.param.getProperty("jlabel_font"); if (!s.equals("")) { @@ -277,6 +298,7 @@ public class Jedecma extends JFrame { if (logo_file1.length() > 0) { final String wlogo = logo_file1; javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { MediaTracker mt = new MediaTracker(mf); logo1 = Toolkit.getDefaultToolkit().getImage(wlogo); @@ -314,6 +336,7 @@ public class Jedecma extends JFrame { if (logo_file.length() > 0) { final String wlogo = logo_file; javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { MediaTracker mt = new MediaTracker(mf); logo2 = Toolkit.getDefaultToolkit().getImage(wlogo); @@ -344,13 +367,14 @@ public class Jedecma extends JFrame { if (dict_file.length() > 0) { final String inputData = dict_file; javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { try { FileInputStream stream = new FileInputStream(inputData); InputStreamReader reader = new InputStreamReader(stream); StreamTokenizer tokens = new StreamTokenizer(reader); - tokens.quoteChar((int) '"'); + tokens.quoteChar('"'); tokens.eolIsSignificant(true); int next; while ((next = tokens.nextToken()) != StreamTokenizer.TT_EOF) { @@ -385,14 +409,14 @@ public class Jedecma extends JFrame { + Jedecma.progVers + " " + Jedecma.progBuild + "<br>" + Jedecma.localMessagesBundle.getString("EXPIRED_LICENSE") + "<br>" - +"</center></body></html>", + +"</center></body></html>", true); } - + // inizializza connessione JDBC dbmgr = new JDBCMgr(); dbmgr.open(); - + /* verifica: se DERBY * non forzo monoutenza in quanto se usa db interno, va in errore, * se invece usa server, lascio la possibilita' @@ -403,10 +427,10 @@ public class Jedecma extends JFrame { // EULA SimpleEula eula = new SimpleEula(); - System.out.println("eula key: " + eula.getKey()); + System.out.println("eula key: " + eula.getKey()); eula.show(); - System.out.println("eula shown: " +Jedecma.param.getProperty("eulashown")); - + System.out.println("eula shown: " +Jedecma.param.getProperty("eulashown")); + // controlla esistenza tabella lock if (dbmgr.existTable("TBLLCKS")) { @@ -421,6 +445,7 @@ public class Jedecma extends JFrame { synchronized (mf) { // crea un thread e prosegue javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { synchronized (mf) { AccessPane ap = new AccessPane(); @@ -495,6 +520,7 @@ public class Jedecma extends JFrame { // Schedule a job for the event-dispatching thread: // creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { createAndShowGUI(); } |
