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

📄 inputshell.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   InputShell.java

package org.gudy.azureus2.ui.swt.shells;

import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
import org.gudy.azureus2.ui.swt.mainwindow.SWTThread;
import org.gudy.azureus2.ui.swt.mainwindow.SWTThreadAlreadyInstanciatedException;

public class InputShell
{

	private String sTitleKey;
	private String p0[];
	private String sLabelKey;
	private String p1[];
	private String textValue;
	private boolean bMultiLine;
	private boolean bIsCanceled;

	public InputShell(String sTitleKey, String sLabelKey)
	{
		InputShell(sTitleKey, null, sLabelKey, null, false);
	}

	public InputShell(String sTitleKey, String sLabelKey, boolean bMultiLine)
	{
		InputShell(sTitleKey, null, sLabelKey, null, bMultiLine);
	}

	public InputShell(String sTitleKey, String p0[], String sLabelKey, String p1[])
	{
		InputShell(sTitleKey, p0, sLabelKey, p1, false);
	}

	public InputShell(String sTitleKey, String p0[], String sLabelKey, String p1[], boolean bMultiLine)
	{
		this.sTitleKey = sTitleKey;
		this.p0 = p0;
		this.sLabelKey = sLabelKey;
		this.p1 = p1;
		this.bMultiLine = bMultiLine;
		bIsCanceled = true;
		setTextValue("");
	}

	public String open()
	{
		Display display = SWTThread.getInstance().getDisplay();
		if (display == null)
			return null;
		final Shell shell = ShellFactory.createShell(display.getActiveShell(), 0x10870);
		Messages.setLanguageText(shell, sTitleKey, p0);
		Utils.setShellIcon(shell);
		GridLayout layout = new GridLayout();
		shell.setLayout(layout);
		Label label = new Label(shell, 64);
		Messages.setLanguageText(label, sLabelKey, p1);
		GridData gridData = new GridData(768);
		label.setLayoutData(gridData);
		int style = 2048;
		if (bMultiLine)
			style |= 2;
		final Text text = new Text(shell, style);
		gridData = new GridData(768);
		gridData.widthHint = 300;
		if (bMultiLine)
			gridData.heightHint = 100;
		text.setLayoutData(gridData);
		text.setText(textValue);
		text.selectAll();
		Composite panel = new Composite(shell, 0);
		layout = new GridLayout();
		layout.numColumns = 3;
		panel.setLayout(layout);
		gridData = new GridData(768);
		gridData.horizontalSpan = 2;
		gridData.horizontalAlignment = 0x1000000;
		gridData.verticalAlignment = 1024;
		panel.setLayoutData(gridData);
		Button ok = new Button(panel, 8);
		ok.setText(MessageText.getString("Button.ok"));
		gridData = new GridData();
		gridData.widthHint = 70;
		ok.setLayoutData(gridData);
		shell.setDefaultButton(ok);
		ok.addListener(13, new Listener() {

			final Text val$text;
			final Shell val$shell;
			final InputShell this$0;

			public void handleEvent(Event event)
			{
				try
				{
					setTextValue(text.getText());
					bIsCanceled = false;
					shell.dispose();
				}
				catch (Exception e)
				{
					Debug.printStackTrace(e);
				}
			}

			
			{
				this$0 = InputShell.this;
				text = text1;
				shell = shell1;
				Object();
			}
		});
		Button cancel = new Button(panel, 8);
		cancel.setText(MessageText.getString("Button.cancel"));
		gridData = new GridData();
		gridData.widthHint = 70;
		cancel.setLayoutData(gridData);
		cancel.addListener(13, new Listener() {

			final Shell val$shell;
			final InputShell this$0;

			public void handleEvent(Event event)
			{
				shell.dispose();
			}

			
			{
				this$0 = InputShell.this;
				shell = shell1;
				Object();
			}
		});
		shell.pack();
		Utils.centreWindow(shell);
		Utils.createURLDropTarget(shell, text);
		setTextValue(null);
		shell.open();
		do
		{
			if (shell.isDisposed())
				break;
			if (!display.readAndDispatch())
				display.sleep();
		} while (true);
		return getTextValue();
	}

	public void setTextValue(String textValue)
	{
		this.textValue = textValue;
	}

	public String getTextValue()
	{
		return textValue;
	}

	public void setLabelParameters(String p1[])
	{
		this.p1 = p1;
	}

	public boolean isMultiLine()
	{
		return bMultiLine;
	}

	public void setMultiLine(boolean multiLine)
	{
		bMultiLine = multiLine;
	}

	public boolean isCanceled()
	{
		return bIsCanceled;
	}

	public static void main(String args[])
	{
		try
		{
			new Display();
			SWTThread.createInstance(null);
			InputShell shell = new InputShell("MyTorrentsView.dialog.setSpeed.title", new String[] {
				"111111111111"
			}, "MyTorrentsView.dialog.setNumber.text", new String[] {
				"222222", "3333333333"
			});
			shell.open();
		}
		catch (SWTThreadAlreadyInstanciatedException e)
		{
			e.printStackTrace();
		}
	}

}

⌨️ 快捷键说明

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