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

📄 urldialog.java

📁 Java案例开发集锦源代码 提供大量源码 有助于初学者
💻 JAVA
字号:
package javazoom.jlGui.skin;


import java.awt.*;
import java.awt.event.*;


//UrlDialog class implements a DialogBox to get an URL.
public class UrlDialog extends Dialog implements ActionListener
{
	private String		_url = null;
	private Button		_open = null;
	private Button 		_cancel = null;
	private Label		_label1 = null;
	private Label		_label2 = null;
	private TextField	_textfield = null;

    /**
     * Contructor.
     */
    public UrlDialog(String title, int x, int y, int sx, int sy, String url)
    {
        super(new Frame(),title,true);
        _url = url;
        this.setSize(sx,sy);
        this.setLocation(x,y);
        _label1 = new Label("Enter an Internet location to open here :");
        _label2 = new Label("For example : http://www.server.com:8000");
        if (_url == null) _textfield = new TextField();
        else _textfield = new TextField(_url);
        _open = new Button("Open");
        _cancel = new Button("Cancel");
        _open.addActionListener(this);
        _cancel.addActionListener(this);
		this.setResizable(false);
		this.setLayout(new GridLayout(4,1,0,1));
		this.add(_label1);
		this.add(_label2);
		this.add(_textfield);
		Panel selectPan = new Panel();
		selectPan.setLayout(new FlowLayout(FlowLayout.CENTER,10,0));
		selectPan.add(_open);
		selectPan.add(_cancel);
		this.add(selectPan);
    }

    /**
     * Returns URL.
     */
    public String getURL()
    {
		return _url;
	}

    /**
     * Returns filename.
     */
    public String getFile()
    {
		return _url;
	}

    /**
     * ActionListener implementation.
     */
	public void actionPerformed(ActionEvent e)
	{
		if (e.getSource() == _open)
		{
			_url = _textfield.getText();
			this.dispose();
		}
		else if (e.getSource() == _cancel)
		{
			_url = null;
			this.dispose();
		}
	}
}

⌨️ 快捷键说明

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