зеркало из https://github.com/mozilla/pjs.git
Added clear button, moved buttons into a panel.
This commit is contained in:
Родитель
d8668cf928
Коммит
3dac32fd0b
|
@ -35,27 +35,40 @@ import java.applet.*;
|
|||
import java.awt.event.*;
|
||||
|
||||
public class ConsoleApplet extends Applet {
|
||||
TextArea text;
|
||||
TextArea console;
|
||||
|
||||
public ConsoleApplet() {
|
||||
setLayout(new BorderLayout());
|
||||
add(text = new TextArea(), BorderLayout.CENTER);
|
||||
add(console = new TextArea(), BorderLayout.CENTER);
|
||||
|
||||
ActionListener dumpThreadsListener =
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
dumpThreads();
|
||||
}
|
||||
};
|
||||
Panel panel = new Panel();
|
||||
add(panel, BorderLayout.SOUTH);
|
||||
|
||||
// clear console button.
|
||||
ActionListener clearConsoleListener = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
console.setText("");
|
||||
}
|
||||
};
|
||||
|
||||
Button clearConsole = new Button("Clear");
|
||||
clearConsole.addActionListener(clearConsoleListener);
|
||||
panel.add(clearConsole);
|
||||
|
||||
// dump threads button.
|
||||
ActionListener dumpThreadsListener = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
dumpThreads();
|
||||
}
|
||||
};
|
||||
|
||||
// Create a dump threads button.
|
||||
Button dumpThreads = new Button("Dump Threads");
|
||||
dumpThreads.addActionListener(dumpThreadsListener);
|
||||
add(dumpThreads, BorderLayout.SOUTH);
|
||||
panel.add(dumpThreads);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Console.init(text);
|
||||
Console.init(console);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче