takuy****@users*****
takuy****@users*****
2008年 8月 18日 (月) 02:22:35 JST
Index: BetaProject/src/org/jent/checksmtp/ApplicationUI.form diff -u BetaProject/src/org/jent/checksmtp/ApplicationUI.form:1.8 BetaProject/src/org/jent/checksmtp/ApplicationUI.form:1.9 --- BetaProject/src/org/jent/checksmtp/ApplicationUI.form:1.8 Wed Aug 22 03:09:24 2007 +++ BetaProject/src/org/jent/checksmtp/ApplicationUI.form Mon Aug 18 02:22:35 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<Form version="1.4" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> +<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> <Properties> <Property name="defaultCloseOperation" type="int" value="0"/> <Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> @@ -32,7 +32,7 @@ <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Component id="jButtonQuit" linkSize="1" min="-2" max="-2" attributes="0"/> - <EmptySpace pref="133" max="32767" attributes="0"/> + <EmptySpace pref="148" max="32767" attributes="0"/> <Component id="jButtonOK" linkSize="1" min="-2" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> <Component id="jButtonCancel" linkSize="1" min="-2" max="-2" attributes="0"/> @@ -84,24 +84,24 @@ <Group type="102" alignment="0" attributes="0"> <Component id="jLabel1" linkSize="2" min="-2" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jTextFieldReceiverPort" pref="51" max="32767" attributes="0"/> + <Component id="jTextFieldReceiverPort" pref="73" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/> <Component id="jCheckBoxEnableRemoteConnect" min="-2" pref="207" max="-2" attributes="0"/> </Group> <Group type="102" alignment="0" attributes="0"> <Component id="jLabel7" min="-2" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> - <Component id="jTextFieldConfirmTimeout" pref="237" max="32767" attributes="0"/> + <Component id="jTextFieldConfirmTimeout" pref="265" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/> </Group> <Group type="102" alignment="1" attributes="0"> <Component id="jLabel2" linkSize="2" min="-2" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jTextFieldServerHost" pref="143" max="32767" attributes="0"/> + <Component id="jTextFieldServerHost" pref="155" max="32767" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/> <Component id="jLabel3" min="-2" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jTextFieldServerPort" pref="69" max="32767" attributes="0"/> + <Component id="jTextFieldServerPort" pref="82" max="32767" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/> </Group> </Group> @@ -125,7 +125,7 @@ <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jTextFieldServerPort" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace pref="27" max="32767" attributes="0"/> + <EmptySpace pref="31" max="32767" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> <Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jTextFieldConfirmTimeout" alignment="3" min="-2" max="-2" attributes="0"/> @@ -273,10 +273,10 @@ </Group> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jTextFieldAttribute" alignment="0" pref="288" max="32767" attributes="0"/> - <Component id="jTextFieldBaseDn" pref="288" max="32767" attributes="0"/> + <Component id="jTextFieldAttribute" alignment="0" pref="296" max="32767" attributes="0"/> + <Component id="jTextFieldBaseDn" pref="296" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0"> - <Component id="jTextFieldProviderUrl" pref="205" max="32767" attributes="0"/> + <Component id="jTextFieldProviderUrl" pref="222" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/> <Component id="jCheckBoxIsSjis" min="-2" max="-2" attributes="0"/> </Group> @@ -312,7 +312,7 @@ <Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jTextFieldAttribute" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace max="32767" attributes="0"/> + <EmptySpace pref="17" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -458,7 +458,7 @@ </Group> <EmptySpace max="-2" attributes="0"/> <Component id="jLabelSfURL" min="-2" max="-2" attributes="0"/> - <EmptySpace pref="57" max="32767" attributes="0"/> + <EmptySpace pref="58" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -466,10 +466,8 @@ <SubComponents> <Component class="javax.swing.JLabel" name="jLabelProgramName"> <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor"> - <FontInfo relative="false"> - <Font name="Dialog" size="18" style="1"/> - </FontInfo> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Dialog" size="18" style="1"/> </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabelProgramName.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> @@ -478,10 +476,8 @@ </Component> <Component class="javax.swing.JLabel" name="jLabelProgramVersion"> <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor"> - <FontInfo relative="false"> - <Font name="Dialog" size="18" style="1"/> - </FontInfo> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Dialog" size="18" style="1"/> </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabelProgramVersion.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> @@ -490,10 +486,8 @@ </Component> <Component class="javax.swing.JLabel" name="jLabelSfURL"> <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor"> - <FontInfo relative="false"> - <Font name="Dialog" size="14" style="1"/> - </FontInfo> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Dialog" size="14" style="1"/> </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabelSfURL.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> Index: BetaProject/src/org/jent/checksmtp/ApplicationUI.java diff -u BetaProject/src/org/jent/checksmtp/ApplicationUI.java:1.10 BetaProject/src/org/jent/checksmtp/ApplicationUI.java:1.11 --- BetaProject/src/org/jent/checksmtp/ApplicationUI.java:1.10 Sat Aug 25 17:57:07 2007 +++ BetaProject/src/org/jent/checksmtp/ApplicationUI.java Mon Aug 18 02:22:35 2008 @@ -6,11 +6,16 @@ package org.jent.checksmtp; +import java.awt.AWTException; import java.awt.Color; import java.awt.Dimension; import java.awt.Image; +import java.awt.MenuItem; import java.awt.Point; +import java.awt.PopupMenu; +import java.awt.SystemTray; import java.awt.Toolkit; +import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; @@ -579,30 +584,28 @@ private boolean initSystemTray() { - boolean useSystemTray = false; + useSystemTray = false; try { Class.forName("java.awt.SystemTray"); // NOI18N - /* TODO: SystemTray suuport - SystemTray tray = SystemTray.getSystemTray(); - if(tray.isSupported()){ + /* SystemTray suuport */ + final SystemTray tray = SystemTray.getSystemTray(); + if(SystemTray.isSupported()){ final PopupMenu popup = new PopupMenu(); - TrayIcon trayIcon = new TrayIcon(loadIconImage(), - "mdc", popup); + final TrayIcon trayIcon = new TrayIcon(loadImageIcon(), + java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle").getString("ApplicationUI.shortTitle"), + popup); trayIcon.setImageAutoSize(true); - MenuItem menuItemOpen = new MenuItem("Properties..."); + MenuItem menuItemOpen = new MenuItem(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle").getString("ApplicationUI.title")); menuItemOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - setVisible(true); - if ( this.getExtendedState() == ICONIFIED ) { - this.setExtendedState(NORMAL); - } + deicoified(); } }); - MenuItem menuItemQuit = new MenuItem("Quit"); + MenuItem menuItemQuit = new MenuItem(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle").getString("ApplicationUI.jButtonQuit.text")); menuItemQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - tray.remove(icon); + tray.remove(trayIcon); dispose(); System.exit(0); } @@ -610,9 +613,14 @@ popup.add(menuItemOpen); popup.add(menuItemQuit); tray.add(trayIcon); + + this.jButtonQuit.setVisible(false); //unvisible QUIT button. useSystemTray = true; } - */ + /**/ + } catch (AWTException ex) { + System.err.println("SystemTray initialize error."); + ex.printStackTrace(); } catch (ClassNotFoundException ex) { // Do not support SystemTray on this VM. } @@ -627,6 +635,14 @@ } } + private void deicoified() { + if ( useSystemTray ) { + this.setVisible(true); + } else { + this.setExtendedState(NORMAL); + } + } + private Image loadImageIcon() { ImageIcon imageIcon = new ImageIcon( getClass() .getResource("images/mdc-icon16x16.png") // NOI18N @@ -690,7 +706,6 @@ } } }); - smtpClient = new SMTPclient(); } private static SMTPclient smtpClient = null;