Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 2 import org.swixml.SwingEngine; 3 4 import javax.swing.*; 5 import java.awt.event.ActionEvent ; 6 import java.awt.event.WindowEvent ; 7 import java.awt.event.WindowAdapter ; 8 import java.io.IOException ; 9 10 import com.apple.eio.FileManager; 11 12 21 public class HelloMac extends WindowAdapter { 22 private SwingEngine swix; 23 24 private HelloMac() throws Exception { 25 swix= new SwingEngine( this ); 26 swix.render( "xml/hellomac.xml" ); 27 swix.getRootComponent().setVisible( true ); 28 } 29 30 public Action actionAbout = new AbstractAction() { 31 public void actionPerformed( ActionEvent e ) { 32 JOptionPane.showMessageDialog( swix.getRootComponent(), "This is the Mac OS X Example." ); 33 } 34 }; 35 36 public Action actionHelp = new AbstractAction() { 37 public void actionPerformed( ActionEvent e ) { 38 try { 39 FileManager.openURL("http://www.swixml.org/apidocs/index.html"); 40 } catch (IOException e1) { 41 e1.printStackTrace(); 42 } 43 } 44 }; 45 46 public Action actionExit = new AbstractAction() { 47 public void actionPerformed( ActionEvent e ) { 48 JOptionPane.showMessageDialog( swix.getRootComponent(), swix.getLocalizer().getString("mis_Exit")); 49 HelloMac.this.windowClosing(null); 50 } 51 }; 52 53 57 public void windowClosing( WindowEvent e ) { 58 super.windowClosing( e ); 59 System.exit(0); 60 } 61 62 public static void main( String [] args ) throws Exception { 66 new HelloMac(); 67 } 68 }
| Popular Tags
|