All Downloads are FREE. Search and download functionalities are using the official Maven repository.

examples.legacy.mac.HelloMac Maven / Gradle / Ivy

The newest version!
package examples.legacy.mac;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import java.io.IOException;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

import org.swixml.SwingEngine;

import com.apple.eio.FileManager;



/**
 * The HelloMac class shows a couple of the Mac specifics exposed
 * HeeloMac renders the GUI, which is described in hellomac.xml
 *
 * @author Wolf Paulus
 * @version $Revision: 1.1 $
 *
 * @since swixml 1.1
 */
public class HelloMac  extends JFrame {
  private SwingEngine swix;

  private HelloMac() throws Exception {
    swix= new SwingEngine( this );
    swix.render( "xml/hellomac.xml" );    
    setVisible( true );
  }

  public Action actionAbout = new AbstractAction() {
    public void actionPerformed( ActionEvent e ) {
      JOptionPane.showMessageDialog( HelloMac.this, "This is the Mac OS X Example." );
    }
  };

  public Action actionHelp = new AbstractAction() {
    public void actionPerformed( ActionEvent e ) {
      try {
        FileManager.openURL("http://www.swixml.org/apidocs/index.html");
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  };

  public Action actionExit = new AbstractAction() {
    public void actionPerformed( ActionEvent e ) {
      JOptionPane.showMessageDialog( HelloMac.this, swix.getLocalizer().getString("mis_Exit"));
      HelloMac.this.windowClosing(null);
    }
  };

  /**
   * Invoked when a window is in the process of being closed.
   * The close operation can be overridden at this point.
   */
  public void windowClosing( WindowEvent e ) {
    System.exit(0);
  }

  //
  //  Make the class bootable
  //
  public static void main( String[] args ) throws Exception {
    new HelloMac();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy