Closedown
This commit is contained in:
@@ -27,10 +27,6 @@ import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TestingList extends Panel {
|
||||
|
||||
Task task = new Task() {
|
||||
@@ -40,19 +36,47 @@ public class TestingList extends Panel {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected JPanel create() {
|
||||
return new NetbeansPluginPanel();
|
||||
}
|
||||
|
||||
//listen to script end of execution and get return value
|
||||
@Override
|
||||
protected void onExecutedFile(String fileName) {
|
||||
try {
|
||||
switch(fileName){
|
||||
case "power-supply":
|
||||
Object ret = eval("ret");
|
||||
if (ret != null) {
|
||||
SwingUtils.showMessage(getComponent(), "", ret.toString() + " - " + ret.getClass().getName());
|
||||
//showResult(ret.toString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
SwingUtils.showException(getComponent(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class NetbeansPluginPanel extends MonitoredPanel {
|
||||
|
||||
public NetbeansPluginPanel() {
|
||||
initComponents();
|
||||
buildGUI();
|
||||
hookUpEvents();
|
||||
initComponents();
|
||||
buildTable();
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
public void showResult(String res){
|
||||
txtOutput.setText(res);
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
@@ -141,50 +165,7 @@ public class TestingList extends Panel {
|
||||
|
||||
DefaultTableModel model = new DefaultTableModel(data, columnNames);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//dynamically added checkbboxes
|
||||
JButton remove;
|
||||
JButton appear;
|
||||
JCheckBox cb[]=new JCheckBox[10];
|
||||
|
||||
public void buildGUI() {
|
||||
JFrame fr=new JFrame();
|
||||
JPanel p=new JPanel();
|
||||
remove=new JButton("remove");
|
||||
appear=new JButton("appear");
|
||||
for(int i=0;i<10;i++) {
|
||||
cb[i]=new JCheckBox("checkbox:"+i);
|
||||
cb[i].setVisible(false);
|
||||
}
|
||||
fr.add(p);
|
||||
p.add(remove);
|
||||
p.add(appear);
|
||||
for(int i=0;i<10;i++) {
|
||||
p.add(cb[i]);
|
||||
}
|
||||
fr.setVisible(true);
|
||||
fr.setSize(400,400);
|
||||
}
|
||||
|
||||
public void hookUpEvents() {
|
||||
remove.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
for(int i=0;i<10;i++) {
|
||||
cb[i].setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
appear.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
for(int i=0;i<10;i++) {
|
||||
cb[i].setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user