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

📄 xpagepropertieslayout.java

📁 XBrowser是一个完全免费并且开源的Web浏览器
💻 JAVA
字号:
/*****************************************************************              XBrowser  -  eXtended web Browser                **                                                               **           Copyright (c) 2000-2001  Armond Avanes              **     Refer to ReadMe & License files for more information      **                                                               **                                                               **                By: Uladzimir V. Kavalchuk                     **              Uladzimir_Kavalchuk@ep.minsk.by                  **              http://xbrowser.sourceforge.net/                 ******************************************************************/package xbrowser.screen;import java.awt.*;import javax.swing.*;import javax.swing.border.*;import java.awt.event.*;import xbrowser.*;import xbrowser.widgets.*;import xbrowser.renderer.*;public class XPagePropertiesLayout extends XDialog{	private void addToContainer(Component comp, Container container, GridBagLayout gridbag, GridBagConstraints constraints, int grid_width, double weight_x)	{        constraints.gridwidth = grid_width;        constraints.weightx = weight_x;        gridbag.setConstraints(comp, constraints);		container.add(comp);	}    public XPagePropertiesLayout()    {        super(true);        setTitle( XRepository.getResourceManager().getProperty(this, "Title") );        getContentPane().setLayout( new BorderLayout(0,10) );    JPanel pnl_north = new JPanel( new BorderLayout(10,0) );    	txpURL.setBorder( BorderFactory.createEmptyBorder() );        txpURL.setBackground(UIManager.getColor("Label.background"));    JLabel lbl_url = buildLabel(this, "URL");    	lbl_url.setVerticalAlignment(JLabel.TOP);    	pnl_north.add(lbl_url, BorderLayout.WEST);    	pnl_north.add(txpURL, BorderLayout.CENTER);    GridBagLayout gridbag = new GridBagLayout();    GridBagConstraints constraints = new GridBagConstraints();    JPanel pnl_center = new JPanel(gridbag);        constraints.fill = GridBagConstraints.HORIZONTAL;        constraints.insets = new Insets(5,5,5,5);        pnl_center.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createEmptyBorder(20,10,10,10)) );		addToContainer(buildLabel(this, "Protocol"), pnl_center, gridbag, constraints, 1, 0);		addToContainer(txfProtocol, pnl_center, gridbag, constraints, GridBagConstraints.REMAINDER, 1);		addToContainer(buildLabel(this, "Size"), pnl_center, gridbag, constraints, 1, 0);		addToContainer(txfSize, pnl_center, gridbag, constraints, GridBagConstraints.REMAINDER, 1);		addToContainer(buildLabel(this, "Modified"), pnl_center, gridbag, constraints, 1, 0);		addToContainer(txfModified, pnl_center, gridbag, constraints, GridBagConstraints.REMAINDER, 1);		addToContainer(buildLabel(this, "Created"), pnl_center, gridbag, constraints, 1, 0);		addToContainer(txfCreated, pnl_center, gridbag, constraints, GridBagConstraints.REMAINDER, 1);		addToContainer(buildLabel(this, "ConnectionType"), pnl_center, gridbag, constraints, 1, 0);		addToContainer(txfConnectionType, pnl_center, gridbag, constraints, GridBagConstraints.REMAINDER, 1);		addToContainer(buildLabel(this, "ContentType"), pnl_center, gridbag, constraints, 1, 0);		addToContainer(txfContentType, pnl_center, gridbag, constraints, GridBagConstraints.REMAINDER, 1);		addToContainer(buildLabel(this, "CachingStatus"), pnl_center, gridbag, constraints, 1, 0);		addToContainer(txfCachingStatus, pnl_center, gridbag, constraints, GridBagConstraints.REMAINDER, 1);		txpURL.setEditable(false);		txfProtocol.setEditable(false);		txfSize.setEditable(false);		txfModified.setEditable(false);		txfCreated.setEditable(false);		txfConnectionType.setEditable(false);		txfContentType.setEditable(false);		txfCachingStatus.setEditable(false);	JPanel pnl_south = new JPanel(new FlowLayout(FlowLayout.RIGHT));	JButton btn_ok = buildButton(new OkAction());        pnl_south.add(btn_ok);        getRootPane().setDefaultButton(btn_ok);		getContentPane().add(pnl_north, BorderLayout.NORTH);		getContentPane().add(pnl_center, BorderLayout.CENTER);		getContentPane().add(pnl_south, BorderLayout.SOUTH);        setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);        pack();    }    public void setProperties(XPageProperties pp)    {        txpURL.setText(pp.getURL());        txfProtocol.setText(pp.getProtocol());        txfSize.setText(pp.getSize());        txfModified.setText(pp.getModified());        txfCreated.setText(pp.getCreated());        txfConnectionType.setText(pp.getConnectionType());        txfContentType.setText(pp.getContentType());	    if( pp.getCacheFile()==null )	    	txfCachingStatus.setText( XRepository.getResourceManager().getProperty(this, "NotCacheable") );	    else if( pp.isFromCache() )	    	txfCachingStatus.setText( XRepository.getResourceManager().getProperty(this, "FromCache", pp.getCacheFile()) );	    else	    	txfCachingStatus.setText( XRepository.getResourceManager().getProperty(this, "CachedTo", pp.getCacheFile()) );    }    private class OkAction extends XDefaultAction    {        public OkAction()        {            super(XPagePropertiesLayout.this, "Ok", null);        }        public void actionPerformed(ActionEvent e)        {		    setVisible(false);        }    }// Attributes:    private JTextPane txpURL = new JTextPane();    private JTextField txfProtocol = new JTextField(30);    private JTextField txfSize = new JTextField(30);    private JTextField txfModified = new JTextField(30);    private JTextField txfCreated = new JTextField(30);    private JTextField txfConnectionType = new JTextField(30);    private JTextField txfContentType = new JTextField(30);    private JTextField txfCachingStatus = new JTextField(30);}

⌨️ 快捷键说明

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