| 1 | /** |
| 2 | * Copyright (C) 2017 Paul Fretwell - aka 'Footleg' ([email protected]) |
| 3 | * |
| 4 | * This file is part of Cave Converter. |
| 5 | * |
| 6 | * Cave Converter is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * Cave Converter is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with Cave Converter. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | package footleg.cavesurvey.converter; |
| 20 | |
| 21 | import javax.swing.JFrame; |
| 22 | import javax.swing.JOptionPane; |
| 23 | |
| 24 | /** |
| 25 | * Logging class for Swing GUI application. Displays error messages in dialog boxes. |
| 26 | * |
| 27 | * @author Footleg |
| 28 | * @version 2017.01.10 (ISO 8601 YYYY.MM.DD) |
| 29 | * @since 1.6 (The Java version used) |
| 30 | * |
| 31 | */ |
| 32 | public class DialogMsgLogger extends Logger { |
| 33 | JFrame parent; |
| 34 | |
| 35 | /** |
| 36 | * |
| 37 | * @param parentFrame Parent JFrame to display to error message over |
| 38 | */ |
| 39 | public DialogMsgLogger( JFrame parentFrame ) { |
| 40 | super(); |
| 41 | parent = parentFrame; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Display error in dialog box over parent frame |
| 46 | * @param message The message to append to the log |
| 47 | */ |
| 48 | @Override |
| 49 | public void logError(String message) { |
| 50 | JOptionPane.showMessageDialog(parent, message, "Error", JOptionPane.ERROR_MESSAGE); |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public void logMessage(String message) { |
| 55 | //JOptionPane.showMessageDialog(parent, message, "Info", JOptionPane.INFORMATION_MESSAGE); |
| 56 | System.out.println(message); |
| 57 | } |
| 58 | |
| 59 | } |