📄 propertieswindow.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: PropertiesWindow.java
package org.gudy.azureus2.ui.swt;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
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.ui.swt.components.BufferedLabel;
// Referenced classes of package org.gudy.azureus2.ui.swt:
// Messages, Utils
public class PropertiesWindow
{
private final Shell shell;
public PropertiesWindow(String object_name, String keys[], String values[])
{
Shell any_shell = Utils.findAnyShell();
shell = new Shell(any_shell.getDisplay(), 0x10070);
shell.setText(MessageText.getString("props.window.title", new String[] {
object_name
}));
Utils.setShellIcon(shell);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
shell.setLayout(layout);
final ScrolledComposite scrollable = new ScrolledComposite(shell, 768);
GridData gridData = new GridData(4, 4, true, true);
gridData.horizontalSpan = 3;
scrollable.setLayoutData(gridData);
final Composite main = new Composite(scrollable, 0);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
main.setLayout(layout);
scrollable.setContent(main);
scrollable.setExpandVertical(true);
scrollable.setExpandHorizontal(true);
scrollable.addControlListener(new ControlAdapter() {
final ScrolledComposite val$scrollable;
final Composite val$main;
final PropertiesWindow this$0;
public void controlResized(ControlEvent e)
{
Rectangle r = scrollable.getClientArea();
scrollable.setMinSize(main.computeSize(r.width, -1));
}
{
this$0 = PropertiesWindow.this;
scrollable = scrolledcomposite;
main = composite;
super();
}
});
gridData = new GridData(1808);
gridData.horizontalSpan = 3;
main.setLayoutData(gridData);
for (int i = 0; i < keys.length; i++)
{
if (keys[i] == null || values[i] == null)
continue;
BufferedLabel msg_label = new BufferedLabel(main, 0);
String key = keys[i];
String msg;
if (key.startsWith("!") && key.endsWith("!"))
msg = key.substring(1, key.length() - 1);
else
msg = MessageText.getString(key);
String value = values[i];
if (value.equals("<null>"))
{
msg_label.setText(msg);
value = "";
} else
{
msg_label.setText((new StringBuilder()).append(msg).append(":").toString());
}
gridData = new GridData();
gridData.verticalAlignment = 16;
msg_label.setLayoutData(gridData);
BufferedLabel val_label = new BufferedLabel(main, 64);
val_label.setText(value);
gridData = new GridData(768);
gridData.horizontalIndent = 6;
val_label.setLayoutData(gridData);
}
Label labelSeparator = new Label(shell, 258);
gridData = new GridData(768);
gridData.horizontalSpan = 3;
labelSeparator.setLayoutData(gridData);
new Label(shell, 0);
Button bOk = new Button(shell, 8);
Messages.setLanguageText(bOk, "Button.ok");
gridData = new GridData(896);
gridData.grabExcessHorizontalSpace = true;
gridData.widthHint = 70;
bOk.setLayoutData(gridData);
bOk.addListener(13, new Listener() {
final PropertiesWindow this$0;
public void handleEvent(Event e)
{
close();
}
{
this$0 = PropertiesWindow.this;
super();
}
});
Button bCancel = new Button(shell, 8);
Messages.setLanguageText(bCancel, "Button.cancel");
gridData = new GridData(128);
gridData.grabExcessHorizontalSpace = false;
gridData.widthHint = 70;
bCancel.setLayoutData(gridData);
bCancel.addListener(13, new Listener() {
final PropertiesWindow this$0;
public void handleEvent(Event e)
{
close();
}
{
this$0 = PropertiesWindow.this;
super();
}
});
shell.setDefaultButton(bOk);
shell.addListener(31, new Listener() {
final PropertiesWindow this$0;
public void handleEvent(Event e)
{
if (e.character == '\033')
close();
}
{
this$0 = PropertiesWindow.this;
super();
}
});
shell.pack();
int shell_width = 400;
int main_height = main.computeSize(shell_width, -1).y;
int shell_height = main_height + (shell.getSize().y - scrollable.getSize().y);
shell_height = Math.min(shell_height, 600);
shell.setSize(shell_width, shell_height);
Utils.centreWindow(shell);
shell.open();
}
protected void close()
{
if (!shell.isDisposed())
shell.dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -