button.addActionListener(this);
this.add(button);
}
public void actionPerformed(ActionEvent e) {
XStatusEditor statusPanel = (XStatusEditor) Main.statusPanel;
XTableEditor tablePanel = (XTableEditor) Main.tablePanel;
if ("log".equals(e.getActionCommand())) {
statusPanel.addText("Button Clicked");
} else if ("popup".equals(e.getActionCommand())) {
int response = 0;
response = XDialog.alert("Message", "OK");
statusPanel.addText("" + response);
response = XDialog.info("Message", "OK", "Cancel");
statusPanel.addText("" + response);
response = XDialog.warning("Message", "OK", "Cancel", "Other");
statusPanel.addText("" + response);
response = XDialog.error("Message", "OK", "Cancel", "Other", "Wow!");
statusPanel.addText("" + response);
String result = "";
result = XDialog.input("Message", "OK", "Cancel");
statusPanel.addText(result);
result = XDialog.input("Message");
statusPanel.addText(result);
String[] imageExts = { "jpg", "png", "bmp" };
String file = XDialog.load("Load", null, imageExts);
statusPanel.addText("LOAD:" + file);
file = XDialog.save("Save", null, imageExts);
statusPanel.addText("SAVE:" + file);
file = XDialog.directory("Directory");
statusPanel.addText("DIRECTORY:" + file);
} else if ("table".equals(e.getActionCommand())) {
Object[][] data = tablePanel.getData();
for (int i = 0; i < data.length; i++) {
Object[] row = data[i];
String s = "row(" + i + "):";
for (int j = 0; j < row.length; j++) {
Object obj = row[j];
s += obj + "(" + obj.getClass().getName() + ") ";
}
statusPanel.addText(s);
tablePanel.toFront();
}
} else if ("trek".equals(e.getActionCommand())) {
tablePanel.setData(headers, data);
tablePanel.setEditable(false);