1010import java .awt .datatransfer .Clipboard ;
1111import java .awt .datatransfer .StringSelection ;
1212import java .awt .event .*;
13+ import javax .imageio .ImageIO ;
1314import javax .swing .*;
1415import javax .swing .GroupLayout ;
1516import javax .swing .LayoutStyle ;
2627import org .dom4j .io .OutputFormat ;
2728import org .dom4j .io .XMLWriter ;
2829
30+ import java .awt .image .BufferedImage ;
2931import java .io .File ;
3032import java .io .IOException ;
33+ import java .io .InputStream ;
3134import java .io .StringWriter ;
3235import java .util .ArrayList ;
3336import javax .swing .JFileChooser ;
@@ -226,7 +229,7 @@ private void generateUpdateByPrimaryKeySelectiveBlockMenu(ActionEvent e) {
226229 }
227230 }
228231
229- public PDMViewerApplication () {
232+ public PDMViewerApplication () throws IOException , UnsupportedLookAndFeelException , ClassNotFoundException , InstantiationException , IllegalAccessException {
230233 initComponents ();
231234 }
232235
@@ -238,7 +241,7 @@ public PDMViewerApplication() {
238241 @ SuppressWarnings ("unchecked" )
239242 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
240243 // Generated using JFormDesigner Evaluation license - cruldra
241- private void initComponents () {
244+ private void initComponents () throws IOException , UnsupportedLookAndFeelException , ClassNotFoundException , InstantiationException , IllegalAccessException {
242245 mainMenu = new JMenuBar ();
243246 fileMenu = new JMenu ();
244247 jMenuItem1 = new JMenuItem ();
@@ -258,7 +261,12 @@ private void initComponents() {
258261 setDefaultCloseOperation (WindowConstants .EXIT_ON_CLOSE );
259262 setExtendedState (6 );
260263 Container contentPane = getContentPane ();
261-
264+ Taskbar taskbar = Taskbar .getTaskbar ();
265+ InputStream inputStream = Thread .currentThread ().getContextClassLoader ().getResourceAsStream ("icon.png" );
266+ assert inputStream != null ;
267+ BufferedImage iconImage = ImageIO .read (inputStream );
268+ taskbar .setIconImage (iconImage );
269+ // taskbar.setWindowTitle(frame, "My App");
262270 //======== mainMenu ========
263271 {
264272
@@ -394,7 +402,11 @@ private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
394402 /**
395403 * @param args the command line arguments
396404 */
397- public static void main (String args []) {
405+ public static void main (String args []) throws UnsupportedLookAndFeelException , ClassNotFoundException , InstantiationException , IllegalAccessException {
406+ System .setProperty ("apple.laf.useScreenMenuBar" , "true" );
407+ System .setProperty ("com.apple.mrj.application.apple.menu.about.name" , "WikiTeX" );
408+ /*System.setProperty(
409+ "com.apple.mrj.application.apple.menu.about.name", "Name");*/
398410 /* Set the Nimbus look and feel */
399411 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
400412 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
@@ -417,9 +429,16 @@ public static void main(String args[]) {
417429 java .util .logging .Logger .getLogger (PDMViewerApplication .class .getName ()).log (java .util .logging .Level .SEVERE , null , ex );
418430 }
419431 //</editor-fold>
420-
432+ UIManager . setLookAndFeel ( UIManager . getSystemLookAndFeelClassName ());
421433 /* Create and display the form */
422- java .awt .EventQueue .invokeLater (() -> new PDMViewerApplication ().setVisible (true ));
434+ java .awt .EventQueue .invokeLater (() -> {
435+ try {
436+ new PDMViewerApplication ().setVisible (true );
437+ } catch (IOException | UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException |
438+ IllegalAccessException e ) {
439+ throw new RuntimeException (e );
440+ }
441+ });
423442 }
424443
425444 // Variables declaration - do not modify//GEN-BEGIN:variables
0 commit comments