94 lines
2.3 KiB
Java
94 lines
2.3 KiB
Java
package NET.worlds.console;
|
|
|
|
import java.awt.Window;
|
|
import java.awt.*;
|
|
|
|
public class NoteDialog extends PolledDialog {
|
|
protected static Window parent;
|
|
protected boolean building;
|
|
protected NotePart notePart;
|
|
protected String title;
|
|
protected boolean built;
|
|
protected static int counter = 0;
|
|
|
|
protected NoteDialog(Window var1, String var2) {
|
|
super(var1, (DialogReceiver)null, Console.parseExtended(var2), false);
|
|
this.title = var2;
|
|
|
|
this.notePart = new NotePart();
|
|
Console var3 = Console.getActive();
|
|
if (var3 != null) {
|
|
var3.addPart(this.notePart);
|
|
}
|
|
|
|
int var4 = counter / 6;
|
|
int var5 = counter % 6;
|
|
this.setAlignment(1, ((var5 + var4) % 12 - 5) * 20, (var5 % 6 - 5) * 20);
|
|
++counter;
|
|
}
|
|
|
|
protected void takeFocus() {
|
|
this.notePart.forceTakeFocus();
|
|
}
|
|
|
|
public void show() {
|
|
super.show();
|
|
this.notePart.scrollToBottom();
|
|
}
|
|
|
|
protected synchronized void print(String var1) {
|
|
this.notePart.println(var1);
|
|
}
|
|
|
|
protected synchronized void build() {
|
|
this.building = false;
|
|
if (this.built) {
|
|
this.removeAll();
|
|
}
|
|
|
|
this.built = true;
|
|
this.setBackground(Color.white);
|
|
this.setForeground(Color.black);
|
|
this.notePart.listen.setBackground(Color.lightGray);
|
|
InsetPanel var10 = new InsetPanel(new BorderLayout(), 3, 1, 1, 1);
|
|
var10.setBackground(Color.lightGray);
|
|
var10.add("Center", this.notePart.listen.getComponent());
|
|
this.add("Center", var10);
|
|
this.validate();
|
|
}
|
|
|
|
public synchronized boolean keyDown(Event var1, int var2) {
|
|
if (var2 == 10) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public Dimension preferredSize() {
|
|
Dimension var1 = super.preferredSize();
|
|
if (var1.width < 300) {
|
|
var1.width = 300;
|
|
}
|
|
|
|
if (var1.height < 300) {
|
|
var1.height = 300;
|
|
}
|
|
|
|
return var1;
|
|
}
|
|
|
|
public Dimension minimumSize() {
|
|
Dimension var1 = super.minimumSize();
|
|
if (var1.width < 300) {
|
|
var1.width = 300;
|
|
}
|
|
|
|
if (var1.height < 300) {
|
|
var1.height = 300;
|
|
}
|
|
|
|
return var1;
|
|
}
|
|
}
|