From 3231fee56ce50facd8483e7af4d7f9ff63c5bc38 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 6 Mar 2015 18:30:38 +0100 Subject: Aua, aua... --- dozentenmodul/src/main/java/util/GuiManager.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'dozentenmodul/src/main/java/util/GuiManager.java') diff --git a/dozentenmodul/src/main/java/util/GuiManager.java b/dozentenmodul/src/main/java/util/GuiManager.java index 8710cef9..4b8b610e 100644 --- a/dozentenmodul/src/main/java/util/GuiManager.java +++ b/dozentenmodul/src/main/java/util/GuiManager.java @@ -23,7 +23,6 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.basic.BasicInternalFrameUI; import org.apache.log4j.Logger; @@ -177,9 +176,9 @@ public abstract class GuiManager { private static boolean addHelp() { // let's see if we have a HELP_MESSAGE variable defined in // the class of the currentFrame, if so we need to show it by pressing "Hilfe" - String test = ""; + final String helpMessage; try { - test = (String) (currentFrame.getClass().getDeclaredField("HELP_MESSAGE").get(currentFrame)); + helpMessage = (String) (currentFrame.getClass().getDeclaredField("HELP_MESSAGE").get(currentFrame)); } catch (NoSuchFieldException e) { // only this case if interesting for us, // since we now we don't have a help message to show @@ -187,7 +186,7 @@ public abstract class GuiManager { } catch (IllegalArgumentException|IllegalAccessException|SecurityException e) { LOGGER.error("Failed to check for 'HELP_MESSAGE' variable in '" + currentFrame.getClass() + "' class, see trace: " + e); - // just do nothing + return false; } // print it for debugging purposes // still here? means we have a HELP_MESSAGE to display @@ -195,14 +194,6 @@ public abstract class GuiManager { mnNewMenu_Info.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { - String helpMessage = null; - try { - helpMessage = (String) currentFrame.getClass().getField("HELP_MESSAGE").get(currentFrame); - } catch (IllegalArgumentException | IllegalAccessException - | NoSuchFieldException | SecurityException e) { - LOGGER.error("Failed to check for 'HELP_MESSAGE' variable in '" - + currentFrame.getClass() + "' class, see trace: " + e); - } JOptionPane.showMessageDialog(currentFrame, helpMessage != null ? helpMessage : "No help message.", "Hilfe zu dieser Oberfläche", JOptionPane.INFORMATION_MESSAGE); } @@ -265,9 +256,7 @@ public abstract class GuiManager { newFrame.getWidth(), newFrame.getHeight()); } } - /** - * - */ + public static void openPopup(Component popup) { if (!(popup instanceof JFrame)) { LOGGER.error("Popup classes need to be JFrame, given a: " + popup.getClass().getName()); -- cgit v1.2.3-55-g7522