1 23 package com.sun.enterprise.tools.verifier.gui; 24 25 import javax.swing.*; 26 import java.awt.Container ; 27 import java.awt.event.WindowAdapter ; 28 import java.awt.event.WindowEvent ; 29 import java.io.File ; 30 31 import com.sun.enterprise.tools.verifier.StringManagerHelper; 32 import com.sun.enterprise.tools.verifier.Verifier; 33 34 public class MainFrame extends JFrame { 35 36 37 40 private static MainFrame verifierPanel = null; 41 private static boolean exitOnClose = false; 42 MainPanel mp = null; 43 44 47 public MainFrame() { 48 this(null); 49 } 50 51 public MainFrame(String jarFileName) { 52 this(jarFileName, false, null); 53 } 54 55 public MainFrame(String jarFileName, boolean exitOnClose, 56 Verifier verifier) { 57 super((StringManagerHelper.getLocalStringsManager().getLocalString 58 ("com.sun.enterprise.tools.verifier.gui.MainFrame" + ".WindowTitle", "Verify Specification Compliance"))); setExitOnClose(exitOnClose); 62 63 this.getAccessibleContext().setAccessibleName(StringManagerHelper.getLocalStringsManager() 65 .getLocalString("com.sun.enterprise.tools.verifier.gui.MainFrame" + ".jfName", "Main Window")); this.getAccessibleContext().setAccessibleDescription(StringManagerHelper.getLocalStringsManager() 69 .getLocalString("com.sun.enterprise.tools.verifier.gui.MainFrame" + ".jfDesc", "This is the main window of the verifier tool")); 73 if (exitOnClose) { 74 this.addWindowListener(new WindowAdapter () { 75 public void windowClosing(WindowEvent e) { 76 System.exit(0); 77 } 78 }); 79 } 80 Container contentPane = getContentPane(); 81 mp = new MainPanel(this, jarFileName, verifier); 82 contentPane.add(mp); 83 JOptionPane.showMessageDialog(this, 84 StringManagerHelper.getLocalStringsManager() 85 .getLocalString("com.sun.enterprise.tools.verifier.gui.Deprecation", "\nThis GUI has been deprecated. Please use the GUI that comes with NetBeans."), "WARNING", JOptionPane.WARNING_MESSAGE); } 89 90 public static JFrame getDeploytoolVerifierFrame(File jarFile) { 91 StringManagerHelper.setLocalStringsManager(Verifier.class); 92 if (verifierPanel == null) { 93 verifierPanel = new MainFrame(); 94 } else { 95 verifierPanel.getMainPanel().reset(); 96 } 97 if (jarFile != null) { 98 verifierPanel.getMainPanel().setJarFilename( 99 jarFile.getAbsolutePath()); 100 } 101 return verifierPanel; 102 } 103 104 105 public MainPanel getMainPanel() { 106 return mp; 107 } 108 109 public static boolean getExitOnClose() { 110 return exitOnClose; 111 } 112 113 public static void setExitOnClose(boolean b) { 114 exitOnClose = b; 115 } 116 } 117 | Popular Tags |