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

📄 composeconfigdialog.java

📁 一个用java写的mail.里面的代码值得我们去研究!学习。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*** $Id: ComposeConfigDialog.java,v 1.4 2001/05/07 12:37:21 kunugi Exp $**** Copyright (c) 2000-2001 Jeff Gay** on behalf of ICEMail.org <http://www.icemail.org>** Copyright (c) 1998-2000 by Timothy Gerard Endres** ** This program is free software.** ** You may redistribute it and/or modify it under the terms of the GNU** General Public License as published by the Free Software Foundation.** Version 2 of the license should be included with this distribution in** the file LICENSE, as well as License.html. If the license is not** included with this distribution, you may find a copy at the FSF web** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the** Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.**** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR** REDISTRIBUTION OF THIS SOFTWARE. ** */package org.icemail.mail;import java.awt.Container;import java.awt.Dimension;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Frame;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.FocusEvent;import java.awt.event.FocusListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JLabel; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.JScrollPane; import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.event.TreeSelectionEvent;import javax.swing.event.TreeSelectionListener;import javax.swing.border.EmptyBorder;import javax.swing.border.TitledBorder;import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import org.icemail.util.AWTUtilities; import org.icemail.util.ComponentFactory; import org.icemail.util.JFCUtilities; import org.icemail.util.UserProperties; /** * A dialog which allows the composition options to be configured. * The options are stored as part of the configuration properties. * * @see Configuration */public class ComposeConfigDialog  extends JDialog{  private JTextField             compositionsPath_;  private JTextField             sentPath_;  private JTree                  tree_;  private ITreeSelectionListener treeListener_ = new ITreeSelectionListener();  private JTextField             replyPrefix_;  private JTextField             replyEnclosure_;  private JTextField             forwardPrefix_;  private JTextField             forwardEnclosure_;  private JCheckBox              forwardAttachments_;  /**   * Construct a dialog for configuring composition options.   *   * @param parent parent frame to return to after disposed   */  public  ComposeConfigDialog( Frame parent ) {    super( parent, true );    establishContents();    pack();    Dimension sz = getSize();    int w = UserProperties.getProperty( "composeConfigDialog.width", sz.width );    int h = UserProperties.getProperty( "composeConfigDialog.height", sz.height );    setSize( w, h );    setLocation( AWTUtilities.computeDialogLocation( this ) );    addWindowListener( new IWindowAdapter() );  }  /**   * Dispose of the dialog and any allocated resources.   * <p>   * Implementation of java.awt.Window.dispose()   */  public void  dispose() {    compositionsPath_ = null;    sentPath_ = null;    tree_ = null;    replyPrefix_ = null;    replyEnclosure_ = null;    forwardPrefix_ = null;    forwardEnclosure_ = null;    forwardAttachments_ = null;    super.dispose();  }//............................................................  /**   * Establish the contents of the dialog from bundled resources.   */  private void  establishContents() {    setTitle( ICEMail.getBundle().getString( "ConfigComposition.Title" ) );    Container cont = getContentPane();    cont.setLayout( new GridBagLayout() );    ActionListener xactionListener = new IActionListener();    int row = 0;    String xtext = null;    JLabel lbl;    JPanel rPan = new JPanel();    rPan.setLayout( new GridBagLayout() );    rPan.setBorder(      new TitledBorder( ICEMail.getBundle().getString( "ConfigComposition.Reply.title" ) ) );    AWTUtilities.constrain( cont, rPan, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.CENTER, 0, row++, 1, 1, 1.0, 0.0 );    int rRow = 0;    lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "ConfigComposition.ReplyPrefix" );    AWTUtilities.constrain( rPan, lbl, GridBagConstraints.NONE,                            GridBagConstraints.NORTHEAST, 0, rRow, 1, 1, 0.0, 0.0,                            new Insets( 0, 2, 0, 4 ) );    replyPrefix_ = ComponentFactory.getTextField( ICEMail.getBundle(),                                                  "ConfigComposition.ReplyPrefix",                                                  null );    AWTUtilities.constrain( rPan, replyPrefix_, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.NORTHEAST, 1, rRow++, 2, 1, 1.0, 0.0 );    xtext = UserProperties.getProperty( Configuration.P_COMPOSE_REPLY_PREFIX, null );    replyPrefix_.setText( xtext );    lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "ConfigComposition.ReplyEnclose" );    AWTUtilities.constrain( rPan, lbl, GridBagConstraints.NONE,                            GridBagConstraints.NORTHEAST, 0, rRow, 1, 1, 0.0, 0.0,                            new Insets( 0, 2, 0, 4 ) );    replyEnclosure_ = ComponentFactory.getTextField( ICEMail.getBundle(),                                                     "ConfigComposition.ReplyEnclose",                                                     null );    AWTUtilities.constrain( rPan, replyEnclosure_, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.NORTHEAST, 1, rRow++, 2, 1, 1.0, 0.0 );    xtext = UserProperties.getProperty( Configuration.P_COMPOSE_REPLY_ENCLOSURE, null );    replyEnclosure_.setText( xtext );    JPanel fPan = new JPanel();    fPan.setLayout( new GridBagLayout() );    fPan.setBorder(      new TitledBorder( ICEMail.getBundle().getString( "ConfigComposition.Forward.title" ) ) );    AWTUtilities.constrain( cont, fPan, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.CENTER, 0, row++, 1, 1, 1.0, 0.0 );    int fRow = 0;    lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "ConfigComposition.ForwardPrefix" );    AWTUtilities.constrain( fPan, lbl, GridBagConstraints.NONE,                            GridBagConstraints.NORTHEAST, 0, fRow, 1, 1, 0.0, 0.0,                            new Insets( 0, 2, 0, 4 ) );    forwardPrefix_ = ComponentFactory.getTextField( ICEMail.getBundle(),                                                    "ConfigComposition.ForwardPrefix",                                                    null );    AWTUtilities.constrain( fPan, forwardPrefix_, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.NORTHEAST, 1, fRow++, 2, 1, 1.0, 0.0 );    xtext = UserProperties.getProperty( Configuration.P_COMPOSE_FORWARD_PREFIX, null );    forwardPrefix_.setText( xtext );    lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "ConfigComposition.ForwardEnclose" );    AWTUtilities.constrain( fPan, lbl, GridBagConstraints.NONE,                            GridBagConstraints.NORTHEAST, 0, fRow, 1, 1, 0.0, 0.0,                            new Insets( 0, 2, 0, 4 ) );    forwardEnclosure_ = ComponentFactory.getTextField( ICEMail.getBundle(),                                                       "ConfigComposition.ForwardEnclose",                                                       null );    AWTUtilities.constrain( fPan, forwardEnclosure_, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.NORTHEAST, 1, fRow++, 2, 1, 1.0, 0.0 );

⌨️ 快捷键说明

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