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

📄 pathnamepanel.java

📁 FuncPlotter is a combined Java application and applet for displaying two-dimensional plots of explic
💻 JAVA
字号:
/*====================================================================*\PathnamePanel.javaPathname panel class.------------------------------------------------------------------------This file is part of FuncPlotter, a combined Java application and appletfor plotting explicit functions in one variable.Copyright 2005-2007 Andy Morgan-Richards.FuncPlotter is free software: you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation, either version 3 of the License, or (at youroption) any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith this program.  If not, see <http://www.gnu.org/licenses/>.\*====================================================================*/// PACKAGEpackage gui;//----------------------------------------------------------------------// IMPORTSimport java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.awt.event.ActionListener;import javax.swing.Action;import javax.swing.JButton;import javax.swing.JComponent;import javax.swing.JPanel;//----------------------------------------------------------------------// PATHNAME PANEL CLASSpublic class PathnamePanel    extends JPanel{//////////////////////////////////////////////////////////////////////////  Constants////////////////////////////////////////////////////////////////////////    private static final    Insets  BROWSE_BUTTON_MARGINS   = new Insets( 2, 4, 2, 4 );    private static final    String  BROWSE_STR  = "Browse";//////////////////////////////////////////////////////////////////////////  Constructors////////////////////////////////////////////////////////////////////////    public PathnamePanel( JComponent pathnameField,                          Action     action )    {        this( pathnameField, new FButton( action ) );    }    //------------------------------------------------------------------    public PathnamePanel( JComponent     pathnameField,                          String         command,                          ActionListener actionListener )    {        this( pathnameField, createBrowseButton( command, actionListener ) );    }    //------------------------------------------------------------------    public PathnamePanel( JComponent pathnameField,                          JButton    browseButton )    {        // Set layout manager        GridBagLayout gridBag = new GridBagLayout( );        GridBagConstraints gbc = new GridBagConstraints( );        setLayout( gridBag );        int gridX = 0;        // Pathname field        gbc.gridx = gridX++;        gbc.gridy = 0;        gbc.gridwidth = 1;        gbc.gridheight = 1;        gbc.weightx = 0.0;        gbc.weighty = 0.0;        gbc.anchor = GridBagConstraints.LINE_START;        gbc.fill = GridBagConstraints.NONE;        gbc.insets = new Insets( 0, 0, 0, 0 );        gridBag.setConstraints( pathnameField, gbc );        add( pathnameField );        // Browse button        browseButton.setMargin( BROWSE_BUTTON_MARGINS );        gbc.gridx = gridX++;        gbc.gridy = 0;        gbc.gridwidth = 1;        gbc.gridheight = 1;        gbc.weightx = 0.0;        gbc.weighty = 0.0;        gbc.anchor = GridBagConstraints.LINE_START;        gbc.fill = GridBagConstraints.NONE;        gbc.insets = new Insets( 0, 6, 0, 0 );        gridBag.setConstraints( browseButton, gbc );        add( browseButton );    }    //------------------------------------------------------------------//////////////////////////////////////////////////////////////////////////  Class methods////////////////////////////////////////////////////////////////////////    private static JButton createBrowseButton( String         command,                                               ActionListener actionListener )    {        JButton button = new FButton( BROWSE_STR + Constants.ELLIPSIS_STR );        button.setActionCommand( command );        button.addActionListener( actionListener );        return button;    }    //------------------------------------------------------------------}//----------------------------------------------------------------------

⌨️ 快捷键说明

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