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

📄 openstoredialog.java

📁 一个用java写的mail.里面的代码值得我们去研究!学习。
💻 JAVA
字号:
/*** $Id: OpenStoreDialog.java,v 1.4 2001/05/07 12:37:22 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.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.border.EmptyBorder;import org.icemail.util.AWTUtilities; import org.icemail.util.ComponentFactory; import org.icemail.util.JFCUtilities; import org.icemail.util.UserProperties;/** * A dialog which allows store parameters to be input by the user. * * @see FolderTreePanel */public class OpenStoreDialog  extends JDialog{  private JTextField urlField_;  private JTextField nameField_;  private JTextField spaceField_;  /**   * Construct a dialog for inputing store parameters.   *   * @param parent parent frame to return to after disposed   */  public  OpenStoreDialog( Frame parent ) {    super( parent, true );    establishContents();    pack();    Dimension sz = getSize();    int w = UserProperties.getProperty( "addStoreDialog.width", sz.width );    int h = UserProperties.getProperty( "addStoreDialog.height", sz.height );    setSize( w, h );    setLocation( AWTUtilities.computeDialogLocation( this ) );    addWindowListener( new IWindowAdapter() );  }// accessors  public String  getStoreURL() {    String xurl = urlField_.getText();    return ( xurl.length() == 0 ? null : xurl );  }  public String  getStoreName() {    String xname = nameField_.getText();    return ( xname.length() == 0 ? null : xname );  }  public String  getNameSpace() {    String xname = spaceField_.getText();    return ( xname.length() == 0 ? null : xname );  }//............................................................  private void  establishContents() {    setTitle( ICEMail.getBundle().getString( "OpenStore.Title" ) );    Container cont = getContentPane();    cont.setLayout( new GridBagLayout() );    ActionListener xlistener = new IActionListener();    int row = 0;    JPanel namePan = new JPanel();    namePan.setLayout( new GridBagLayout() );    namePan.setBorder( new EmptyBorder( 4, 4, 4, 4 ) );    AWTUtilities.constrain( cont, namePan, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.CENTER,      0, row++, 2, 1, 1.0, 0.0 );    int panRow = 0;    JLabel  lbl;    lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "OpenStore.StoreName" );    lbl.setHorizontalAlignment( JLabel.RIGHT );    AWTUtilities.constrain( namePan, lbl, GridBagConstraints.NONE,                            GridBagConstraints.WEST, 0, panRow, 1, 1, 0.0, 0.0 );    nameField_ =      ComponentFactory.getTextField( ICEMail.getBundle(), "OpenStore.StoreName", null );    AWTUtilities.constrain( namePan, nameField_, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.WEST, 1, panRow++, 1, 1, 1.0, 0.0 );    lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "OpenStore.StoreUrl" );    lbl.setHorizontalAlignment( JLabel.RIGHT );    AWTUtilities.constrain( namePan, lbl, GridBagConstraints.NONE,                            GridBagConstraints.WEST, 0, panRow, 1, 1, 0.0, 0.0 );    urlField_ =      ComponentFactory.getTextField( ICEMail.getBundle(), "OpenStore.StoreUrl", null );    AWTUtilities.constrain( namePan, urlField_, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.WEST, 1, panRow++, 1, 1, 1.0, 0.0 );    lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "OpenStore.NameSpace" );    lbl.setHorizontalAlignment( JLabel.RIGHT );    AWTUtilities.constrain( namePan, lbl, GridBagConstraints.NONE,                            GridBagConstraints.WEST, 0, panRow, 1, 1, 0.0, 0.0 );    spaceField_ =      ComponentFactory.getTextField( ICEMail.getBundle(), "OpenStore.NameSpace", null );    AWTUtilities.constrain( namePan, spaceField_, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.WEST, 1, panRow++, 1, 1, 1.0, 0.0 );    JPanel btnPan = new JPanel();    btnPan.setLayout( new GridBagLayout() );    btnPan.setBorder( JFCUtilities.StandardBorder );    AWTUtilities.constrain( cont, btnPan, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.CENTER, 0, row++, 2, 1, 1.0, 0.0 );    JButton btn;    btn = ComponentFactory.getButton( ICEMail.getBundle(), "OpenStore.Open",                                      xlistener, null );    AWTUtilities.constrain( btnPan, btn, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.CENTER, 0, 0, 1, 1, 1.0, 0.0 );    btn = ComponentFactory.getButton( ICEMail.getBundle(), "OpenStore.Cancel",                                      xlistener, null );    AWTUtilities.constrain( btnPan, btn, GridBagConstraints.HORIZONTAL,                            GridBagConstraints.CENTER, 1, 0, 1, 1, 1.0, 0.0 );  }//............................................................  private class IActionListener    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 ) {      String command = event.getActionCommand();      if ( command.equals( "OPEN" ) ) {      } else if ( command.equals( "CANCEL" ) ) {      }      dispose();    }  }//............................................................  /**   * A internal class to handle the closing of window by the window manager,   * i.e. disposing of the window properly.   */  private class IWindowAdapter    extends WindowAdapter  {    public void    windowClosing( WindowEvent event ) {      event.getWindow().dispose();    }    public void    windowActivated( WindowEvent event ) {      if ( nameField_ != null ) {        nameField_.requestFocus();        nameField_.selectAll();      }    }  }}

⌨️ 快捷键说明

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