<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FDevelopment_Class%2FMac</id>
		<title>Java/Development Class/Mac - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FDevelopment_Class%2FMac"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Development_Class/Mac&amp;action=history"/>
		<updated>2026-04-16T01:50:35Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Development_Class/Mac&amp;diff=8341&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Development_Class/Mac&amp;diff=8341&amp;oldid=prev"/>
				<updated>2010-06-01T06:59:21Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:59, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Development_Class/Mac&amp;diff=8340&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Development_Class/Mac&amp;diff=8340&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:46Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Launch Browser in Mac, Linux, Unix ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/////////////////////////////////////////////////////////&lt;br /&gt;
//  Bare Bones Browser Launch                          //&lt;br /&gt;
//  Version 1.5                                        //&lt;br /&gt;
//  December 10, 2005                                  //&lt;br /&gt;
//  Supports: Mac OS X, GNU/Linux, Unix, Windows XP    //&lt;br /&gt;
//  Example Usage:                                     //&lt;br /&gt;
//     String url = &amp;quot;http://www.centerkey.ru/&amp;quot;;       //&lt;br /&gt;
//     BareBonesBrowserLaunch.openURL(url);            //&lt;br /&gt;
//  Public Domain Software -- Free to Use as You Like  //&lt;br /&gt;
/////////////////////////////////////////////////////////&lt;br /&gt;
import java.lang.reflect.Method;&lt;br /&gt;
import javax.swing.JOptionPane;&lt;br /&gt;
public class BareBonesBrowserLaunch {&lt;br /&gt;
   private static final String errMsg = &amp;quot;Error attempting to launch web browser&amp;quot;;&lt;br /&gt;
   public static void openURL(String url) {&lt;br /&gt;
      String osName = System.getProperty(&amp;quot;os.name&amp;quot;);&lt;br /&gt;
      try {&lt;br /&gt;
         if (osName.startsWith(&amp;quot;Mac OS&amp;quot;)) {&lt;br /&gt;
            Class fileMgr = Class.forName(&amp;quot;com.apple.eio.FileManager&amp;quot;);&lt;br /&gt;
            Method openURL = fileMgr.getDeclaredMethod(&amp;quot;openURL&amp;quot;,&lt;br /&gt;
               new Class[] {String.class});&lt;br /&gt;
            openURL.invoke(null, new Object[] {url});&lt;br /&gt;
            }&lt;br /&gt;
         else if (osName.startsWith(&amp;quot;Windows&amp;quot;))&lt;br /&gt;
            Runtime.getRuntime().exec(&amp;quot;rundll32 url.dll,FileProtocolHandler &amp;quot; + url);&lt;br /&gt;
         else { //assume Unix or Linux&lt;br /&gt;
            String[] browsers = {&lt;br /&gt;
               &amp;quot;firefox&amp;quot;, &amp;quot;opera&amp;quot;, &amp;quot;konqueror&amp;quot;, &amp;quot;epiphany&amp;quot;, &amp;quot;mozilla&amp;quot;, &amp;quot;netscape&amp;quot; };&lt;br /&gt;
            String browser = null;&lt;br /&gt;
            for (int count = 0; count &amp;lt; browsers.length &amp;amp;&amp;amp; browser == null; count++)&lt;br /&gt;
               if (Runtime.getRuntime().exec(&lt;br /&gt;
                     new String[] {&amp;quot;which&amp;quot;, browsers[count]}).waitFor() == 0)&lt;br /&gt;
                  browser = browsers[count];&lt;br /&gt;
            if (browser == null)&lt;br /&gt;
               throw new Exception(&amp;quot;Could not find web browser&amp;quot;);&lt;br /&gt;
            else&lt;br /&gt;
               Runtime.getRuntime().exec(new String[] {browser, url});&lt;br /&gt;
            }&lt;br /&gt;
         }&lt;br /&gt;
      catch (Exception e) {&lt;br /&gt;
         JOptionPane.showMessageDialog(null, errMsg + &amp;quot;:\n&amp;quot; + e.getLocalizedMessage());&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mac OS Application Adapter ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) Ian F. Darwin, http://www.darwinsys.ru/, 1996-2002.&lt;br /&gt;
 * All rights reserved. Software written by Ian F. Darwin and others.&lt;br /&gt;
 * $Id: LICENSE,v 1.8 2004/02/09 03:33:38 ian Exp $&lt;br /&gt;
 *&lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without&lt;br /&gt;
 * modification, are permitted provided that the following conditions&lt;br /&gt;
 * are met:&lt;br /&gt;
 * 1. Redistributions of source code must retain the above copyright&lt;br /&gt;
 *    notice, this list of conditions and the following disclaimer.&lt;br /&gt;
 * 2. Redistributions in binary form must reproduce the above copyright&lt;br /&gt;
 *    notice, this list of conditions and the following disclaimer in the&lt;br /&gt;
 *    documentation and/or other materials provided with the distribution.&lt;br /&gt;
 *&lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS&amp;quot;&amp;quot;&lt;br /&gt;
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED&lt;br /&gt;
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR&lt;br /&gt;
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS&lt;br /&gt;
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR&lt;br /&gt;
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF&lt;br /&gt;
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS&lt;br /&gt;
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN&lt;br /&gt;
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)&lt;br /&gt;
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE&lt;br /&gt;
 * POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 * &lt;br /&gt;
 * Java, the Duke mascot, and all variants of Sun&amp;quot;s Java &amp;quot;steaming coffee&lt;br /&gt;
 * cup&amp;quot; logo are trademarks of Sun Microsystems. Sun&amp;quot;s, and James Gosling&amp;quot;s,&lt;br /&gt;
 * pioneering role in inventing and promulgating (and standardizing) the Java &lt;br /&gt;
 * language and environment is gratefully acknowledged.&lt;br /&gt;
 * &lt;br /&gt;
 * The pioneering role of Dennis Ritchie and Bjarne Stroustrup, of AT&amp;amp;T, for&lt;br /&gt;
 * inventing predecessor languages C and C++ is also gratefully acknowledged.&lt;br /&gt;
 */&lt;br /&gt;
import javax.swing.JFrame;&lt;br /&gt;
import com.apple.eawt.Application;&lt;br /&gt;
import com.apple.eawt.ApplicationEvent;&lt;br /&gt;
import com.apple.eawt.ApplicationListener;&lt;br /&gt;
/**&lt;br /&gt;
 * The only os-dependant part of com.darwinsys, this is the&lt;br /&gt;
 * adapter class to handle MacOS&amp;quot;s &amp;quot;different&amp;quot; way of doing About Box,&lt;br /&gt;
 * Quit item in App menu, Preferences, and so on.&lt;br /&gt;
 */&lt;br /&gt;
public class MacOSAppAdapter extends Application {&lt;br /&gt;
  ApplicationListener appListener;&lt;br /&gt;
  JFrame  parent;&lt;br /&gt;
  AboutBoxHandler abouter;&lt;br /&gt;
  PrefsHandler prefser;&lt;br /&gt;
  PrintHandler printer;&lt;br /&gt;
  ShutdownHandler shutter;&lt;br /&gt;
&lt;br /&gt;
  /** Construct a MacOSAppAdapter.&lt;br /&gt;
   * @param theParent A JFrame, usually the main application window.&lt;br /&gt;
   * @param about A handler for the About box.&lt;br /&gt;
   * @param prefs A Preferences handler.&lt;br /&gt;
   * @param print A Print handler (bug: does not get invoked now).&lt;br /&gt;
   * @param shut A shutdown handler&lt;br /&gt;
   */&lt;br /&gt;
  public MacOSAppAdapter(JFrame theParent, AboutBoxHandler about,&lt;br /&gt;
    PrefsHandler prefs, PrintHandler print, ShutdownHandler shut) {&lt;br /&gt;
    appListener = new MyAppEventHandler();&lt;br /&gt;
    parent = theParent;&lt;br /&gt;
    if (about != null) {&lt;br /&gt;
      abouter = about;&lt;br /&gt;
      setEnabledAboutMenu(true);&lt;br /&gt;
      addAboutMenuItem();&lt;br /&gt;
    }&lt;br /&gt;
    if (prefs != null) {&lt;br /&gt;
      prefser = prefs;&lt;br /&gt;
      setEnabledPreferencesMenu(true);&lt;br /&gt;
      addPreferencesMenuItem();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    printer = print;&lt;br /&gt;
    shutter = shut;&lt;br /&gt;
  }&lt;br /&gt;
  /** Method to register this handler with Apple&amp;quot;s event manager, calling&lt;br /&gt;
   * addApplicationListener in parent class.&lt;br /&gt;
   */&lt;br /&gt;
  public void register() {&lt;br /&gt;
    addApplicationListener(appListener);&lt;br /&gt;
  }&lt;br /&gt;
  /** Inner class to provide ApplicationListener support. */&lt;br /&gt;
  class MyAppEventHandler implements ApplicationListener {&lt;br /&gt;
    /** This is called when the user does Application-&amp;gt;About */&lt;br /&gt;
    public void handleAbout(ApplicationEvent event) {&lt;br /&gt;
      abouter.showAboutBox(parent);&lt;br /&gt;
      event.setHandled(true);&lt;br /&gt;
    }&lt;br /&gt;
    /** Called when the user does Application-&amp;gt;Preferences */&lt;br /&gt;
    public void handlePreferences(ApplicationEvent event) {&lt;br /&gt;
      if (prefser != null)&lt;br /&gt;
        prefser.showPrefsDialog(parent);&lt;br /&gt;
        event.setHandled(true);&lt;br /&gt;
    }&lt;br /&gt;
    public void handlePrint(ApplicationEvent event) {&lt;br /&gt;
      if (printer != null)&lt;br /&gt;
        printer.doPrint(parent);&lt;br /&gt;
        event.setHandled(true);&lt;br /&gt;
    }&lt;br /&gt;
    /** This is called when the user does Application-&amp;gt;Quit */&lt;br /&gt;
    public void handleQuit(ApplicationEvent event) {&lt;br /&gt;
      if (shutter != null)&lt;br /&gt;
        shutter.shutdown(parent);&lt;br /&gt;
      System.exit(0);  // should be notreached&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * @see com.apple.eawt.ApplicationListener#handleOpenApplication(com.apple.eawt.ApplicationEvent)&lt;br /&gt;
     */&lt;br /&gt;
    public void handleOpenApplication(ApplicationEvent arg0) {&lt;br /&gt;
      // TODO Auto-generated method stub&lt;br /&gt;
      &lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * @see com.apple.eawt.ApplicationListener#handleOpenFile(com.apple.eawt.ApplicationEvent)&lt;br /&gt;
     */&lt;br /&gt;
    public void handleOpenFile(ApplicationEvent arg0) {&lt;br /&gt;
      // TODO Auto-generated method stub&lt;br /&gt;
      &lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * @see com.apple.eawt.ApplicationListener#handlePrintFile(com.apple.eawt.ApplicationEvent)&lt;br /&gt;
     */&lt;br /&gt;
    public void handlePrintFile(ApplicationEvent arg0) {&lt;br /&gt;
      // TODO Auto-generated method stub&lt;br /&gt;
      &lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * @see com.apple.eawt.ApplicationListener#handleReOpenApplication(com.apple.eawt.ApplicationEvent)&lt;br /&gt;
     */&lt;br /&gt;
    public void handleReOpenApplication(ApplicationEvent arg0) {&lt;br /&gt;
      // TODO Auto-generated method stub&lt;br /&gt;
      &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Utilities for Mac GUI work ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) Ian F. Darwin, http://www.darwinsys.ru/, 1996-2002.&lt;br /&gt;
 * All rights reserved. Software written by Ian F. Darwin and others.&lt;br /&gt;
 * $Id: LICENSE,v 1.8 2004/02/09 03:33:38 ian Exp $&lt;br /&gt;
 *&lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without&lt;br /&gt;
 * modification, are permitted provided that the following conditions&lt;br /&gt;
 * are met:&lt;br /&gt;
 * 1. Redistributions of source code must retain the above copyright&lt;br /&gt;
 *    notice, this list of conditions and the following disclaimer.&lt;br /&gt;
 * 2. Redistributions in binary form must reproduce the above copyright&lt;br /&gt;
 *    notice, this list of conditions and the following disclaimer in the&lt;br /&gt;
 *    documentation and/or other materials provided with the distribution.&lt;br /&gt;
 *&lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS&amp;quot;&amp;quot;&lt;br /&gt;
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED&lt;br /&gt;
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR&lt;br /&gt;
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS&lt;br /&gt;
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR&lt;br /&gt;
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF&lt;br /&gt;
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS&lt;br /&gt;
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN&lt;br /&gt;
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)&lt;br /&gt;
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE&lt;br /&gt;
 * POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 * &lt;br /&gt;
 * Java, the Duke mascot, and all variants of Sun&amp;quot;s Java &amp;quot;steaming coffee&lt;br /&gt;
 * cup&amp;quot; logo are trademarks of Sun Microsystems. Sun&amp;quot;s, and James Gosling&amp;quot;s,&lt;br /&gt;
 * pioneering role in inventing and promulgating (and standardizing) the Java &lt;br /&gt;
 * language and environment is gratefully acknowledged.&lt;br /&gt;
 * &lt;br /&gt;
 * The pioneering role of Dennis Ritchie and Bjarne Stroustrup, of AT&amp;amp;T, for&lt;br /&gt;
 * inventing predecessor languages C and C++ is also gratefully acknowledged.&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Utilities for Mac GUI work.&lt;br /&gt;
 * &lt;br /&gt;
 * @version $Id: MacOSUtil.java,v 1.11 2004/01/31 01:26:05 ian Exp $&lt;br /&gt;
 */&lt;br /&gt;
public class MacOSUtil {&lt;br /&gt;
  /** Return true if we are running MacOS; needs a few GUI tweaks if so. */&lt;br /&gt;
  public static boolean isMacOS() {&lt;br /&gt;
    return System.getProperty(&amp;quot;mrj.version&amp;quot;) != null;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Set a few common properties for the given application if we are running&lt;br /&gt;
   * under MacOS. Usage Example:&lt;br /&gt;
   * &lt;br /&gt;
   * &amp;lt;pre&amp;gt;&lt;br /&gt;
   * if (MacOSUtil.isMacOS()) {&lt;br /&gt;
   *   MacOSUtil.setMacOS(&amp;amp;quot;JabaDex&amp;amp;quot;);&lt;br /&gt;
   * }&lt;br /&gt;
   * &amp;lt;/pre&amp;gt;&lt;br /&gt;
   * &lt;br /&gt;
   * @param appName -&lt;br /&gt;
   *            the name of the Application.&lt;br /&gt;
   */&lt;br /&gt;
  public static void setMacOS(String appName) {&lt;br /&gt;
    System.setProperty(&amp;quot;apple.laf.useScreenMenuBar&amp;quot;, &amp;quot;true&amp;quot;);&lt;br /&gt;
    System.setProperty(&amp;quot;apple.awt.showGrowBox&amp;quot;, &amp;quot;true&amp;quot;);&lt;br /&gt;
    System.setProperty(&amp;quot;com.apple.mrj.application.apple.menu.about.name&amp;quot;,&lt;br /&gt;
        appName);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>