diff options
Diffstat (limited to 'CcdbImp.java')
| -rw-r--r-- | CcdbImp.java | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/CcdbImp.java b/CcdbImp.java index d69984f..41afc9f 100644 --- a/CcdbImp.java +++ b/CcdbImp.java @@ -1,35 +1,43 @@ -/* +/* * CcdbImp.java - import zip codes - * + * * 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.awt.Container; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; import java.io.File; import java.io.FileReader; import java.io.IOException; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; + import au.com.bytecode.opencsv.CSVReader; public class CcdbImp implements Menuable { @@ -38,6 +46,7 @@ public class CcdbImp implements Menuable { private final JFileChooser fc = new JFileChooser(); private MyJTextField recFrom, recTo, qryFile; + @Override public void start() { doGui(Jedecma.mainPan); @@ -55,6 +64,7 @@ public class CcdbImp implements Menuable { } + @Override public void stop() { Jedecma.mainPan.remove(qryFilePan); Jedecma.mf.repaint(); @@ -71,6 +81,7 @@ public class CcdbImp implements Menuable { openBut = new JButton(Jedecma.localMessagesBundle.getString("BROWSE")); openBut.setMnemonic(KeyEvent.VK_S); openBut.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { fc.addChoosableFileFilter(new MyFileFilter()); fc.setCurrentDirectory(new File(Uti1.getWrkDir())); @@ -127,8 +138,10 @@ public class CcdbImp implements Menuable { loadBut = new JButton(Jedecma.localMessagesBundle.getString("EXECUTE")); loadBut.setMnemonic(KeyEvent.VK_U); loadBut.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { loadFile(qryFile.getText()); } @@ -173,16 +186,7 @@ public class CcdbImp implements Menuable { String state = nextLine[2]; state = Uti1.leftSet(state, 2, ' '); - if (code.length() < 1) { - continue; - } - if (Integer.parseInt(code) <= 0) { - continue; - } - if (city.length() < 1) { - continue; - } - if (state.length() < 1) { + if ((code.length() < 1) || (Integer.parseInt(code) <= 0) || (city.length() < 1) || (state.length() < 1)) { continue; } |
