⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java

📁 一个用java写的mail.里面的代码值得我们去研究!学习。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      System.out.println( "MainFrame.addLookAndFeelMenu(m)" );    }    JMenu menu = ComponentFactory.getMenu( ICEMail.getBundle(), "MainFrame.LookAndFeel" );    LookAndFeelMenuActionListener xlistener = new LookAndFeelMenuActionListener();  // add installed look and feels    UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();    JMenuItem xitem;    for ( int idx = 0 ; idx < info.length ; ++idx ) {      xitem = new JMenuItem( info[idx].getName() );      xitem.addActionListener( xlistener );      xitem.setActionCommand( "PLAF:" + info[idx].getClassName() );      menu.add( xitem );    }    mbar.add( menu );  }  private void  showAboutDialog() {    AboutDialog dlg = new AboutDialog( this );    dlg.show();  }  public void  resetCursor() {  //  setCursorAll( mainPanel_, null );  }  public void  setWaitCursor() {  //  setCursorAll( mainPanel_, Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );  }  /**   * The workhorse. Making this work is insanely difficult because   * of Sun's feeble cursor design. We attempt to maintain the cursor   * state of every component through wait/reset. Of course, this is   * still horrible, and is hardly worth it due to all of the other   * bugs in their cursor code that we have no control over.   *   * @param cont The container to set the cursor in.   * @param curs The cursor to set, or null to reset.   *   */  private void  setCursorAll( Container cont, Cursor curs ) {    Class contCls = Container.class;    if ( curs == null ) {      Cursor c = (Cursor) this.saveCursors.get( cont );      cont.setCursor( c );      if ( c != null ) {        this.saveCursors.remove( cont );      }    } else {      if ( cont.getCursor() != null ) {        this.saveCursors.put( cont, cont.getCursor() );      }      cont.setCursor( curs );    }    for ( int i = 0, sz = cont.getComponentCount() ; i < sz ; ++i ) {      Component comp = cont.getComponent( i );      Class compCls = comp.getClass();      if ( contCls.isAssignableFrom( compCls ) ) {        setCursorAll( (Container) comp, curs );      } else if ( curs == null ) {        Cursor c = (Cursor) this.saveCursors.get( comp );        comp.setCursor( c );        if ( c != null ) {          this.saveCursors.remove( comp );        }      } else {        if ( comp.getCursor() != null ) {          this.saveCursors.put( comp, comp.getCursor() );        }        comp.setCursor( curs );      }    }  }//............................................................// INNER CLASSES//............................................................  private class FileMenuActionListener    implements ActionListener  {    /**     * Invoked when an action occurs.     * <p>     * Implementation of java.awt.event.ActionListener.actionPerformed()     *     * @param event the action event that occured     */    public void    actionPerformed( ActionEvent event ) {      if ( Package.DEBUG && Package.isTraceable( "MainFrame" ) ) {        System.out.println( "MainFrame.actionPerformed(ae): " + event );      }      String command = event.getActionCommand();      if ( command.equals( "QUIT" ) ) {        ICEMail.shutDownICEMail();      } else {        mainPanel_.distribute( event );      }    }  }//............................................................  private class EditMenuActionListener    implements ActionListener  {    /**     * Invoked when an action occurs.     * <p>     * Implementation of java.awt.event.ActionListener.actionPerformed()     *     * @param event the action event that occured     */    public void    actionPerformed( ActionEvent event ) {      if ( Package.DEBUG && Package.isTraceable( "MainFrame" ) ) {        System.out.println( "MainFrame.actionPerformed(ae): " + event );      }      mainPanel_.distribute( event );    }  }//............................................................  private class MailMenuActionListener    implements ActionListener  {    /**     * Invoked when an action occurs.     * <p>     * Implementation of java.awt.event.ActionListener.actionPerformed()     *     * @param event the action event that occured     */    public void    actionPerformed( ActionEvent event ) {      if ( Package.DEBUG && Package.isTraceable( "MainFrame" ) ) {        System.out.println( "MainFrame.actionPerformed(ae): " + event );      }      mainPanel_.distribute( event );    }  }//............................................................  private class LookAndFeelMenuActionListener    implements ActionListener  {    /**     * Invoked when an action occurs.     * <p>     * Implementation of java.awt.event.ActionListener.actionPerformed()     *     * @param event the action event that occured     */    public void    actionPerformed( ActionEvent event ) {      if ( Package.DEBUG && Package.isTraceable( "MainFrame" ) ) {        System.out.println( "MainFrame.actionPerformed(ae): " + event );      }      String command = event.getActionCommand();      if ( command.startsWith( "PLAF:" ) ) {        changeLookAndFeel( command.substring(5) );      }    }  }//............................................................  private class HelpMenuActionListener    implements ActionListener  {    /**     * Invoked when an action occurs.     * <p>     * Implementation of java.awt.event.ActionListener.actionPerformed()     *     * @param event the action event that occured     */    public void    actionPerformed( ActionEvent event ) {      if ( Package.DEBUG && Package.isTraceable( "MainFrame" ) ) {        System.out.println( "MainFrame.actionPerformed(ae): " + event );      }      String command = event.getActionCommand();    // Note: JAVA Help is setup as part of creating the menu,    //       which adds an action listener to the 'help' menu item      if ( command.equals( "HOMEPAGE" ) ) {        String xurlstring =            UserProperties.getProperty( "urlHomePage", "http://www.icemail.org/index.html" );        HotJavaMailBrowser.setBrowserDocumentString( xurlstring );      } else if ( command.equals( "LICENSE" ) ) {        String xurlstring =            UserProperties.getProperty( "urlLicense",                                        "http://www.icemail.org/policy.html" );        HotJavaMailBrowser.setBrowserDocumentString( xurlstring );      } else if ( command.equals( "REPORTBUG" ) ) {        String xurlstring =            UserProperties.getProperty( "urlReportBug",                                        "http://www.icemail.org/support.html" );        HotJavaMailBrowser.setBrowserDocumentString( xurlstring );      } else if ( command.equals( "ABOUT" ) ) {        showAboutDialog();      } else if ( command.equals( "ONLINEMAN" ) ) {      // unused        String xurlstring =            UserProperties.getProperty( "urlOnlineManual",                                        "http://www.icemail.org/index.html" );        HotJavaMailBrowser.setBrowserDocumentString( xurlstring );      }    }  }//............................................................  private class ConfigureMenuActionListener    implements ActionListener  {    /**     * Invoked when an action occurs.     * <p>     * Implementation of java.awt.event.ActionListener.actionPerformed()     *     * @param event the action event that occured     */    public void    actionPerformed( ActionEvent event ) {      if ( Package.DEBUG && Package.isTraceable( "MainFrame" ) ) {        System.out.println( "MainFrame.actionPerformed(ae): " + event );      }      String command = event.getActionCommand();      if ( command.equals( "USERINFO" ) ) {        UserConfigDialog dlg = new UserConfigDialog( MainFrame.this );        dlg.show();      } else if ( command.equals( "SIGNATURE" ) ) {        SignatureDialog dlg = new SignatureDialog( MainFrame.this );        dlg.show();      } else if ( command.equals( "COMPOSE" ) ) {        ComposeConfigDialog dlg = new ComposeConfigDialog( MainFrame.this );        dlg.show();      } else if ( command.equals( "MEDIA" ) ) {        MediaConfigDialog dlg = new MediaConfigDialog( MainFrame.this );        dlg.show();      } else if ( command.equals( "SECURITY" ) ) {        JDialog dlg = ICEMail.getSMIMELibrary().getConfiguration( MainFrame.this );        dlg.show();      } else if ( command.equals( "LOCALMAN" ) ) {        configureManualHomePage();      } else if ( command.equals( "STORELIST" ) ) {        StoreConfigDialog dlg = new StoreConfigDialog( MainFrame.this );        dlg.show();      } else if ( command.equals( "TRANSPORTPROTO" ) ) {        TransportDialog dlg = new TransportDialog( MainFrame.this );        dlg.show();      } else if ( command.equals( "SMTPHOST" ) ) {        SMTPConfigDialog dlg = new SMTPConfigDialog( MainFrame.this );        dlg.show();      } else if ( command.equals( "TEMPMGR" ) ) {        TempManagerDialog dlg = new TempManagerDialog( MainFrame.this );        dlg.show();      }    }    private void    configureManualHomePage() {      FileDialog dlg = new FileDialog( MainFrame.this );      dlg.setTitle( ICEMail.getBundle().getString( "Configuration.title.locatingmanual" ) );          dlg.show();      String file = dlg.getFile();      String path = dlg.getDirectory();      if ( file != null && path != null ) {        Configuration config = Configuration.getInstance();        String sep = path.endsWith( File.separator ) ? "" : File.separator;        String urlStr = "FILE:" + path + sep + file;        config.setProperty( Configuration.P_LOCAL_MANUAL_URL, urlStr );        config.saveProperties();      }    }  }//............................................................  class IWindowAdapter    extends WindowAdapter  {    public void    windowClosing( WindowEvent e ) {      ICEMail.shutDownICEMail();    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -