1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
| import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
import netscape.javascript.*;
import java.net.*;
public class DataAppletPicker extends JApplet{
protected JPanel buttonPanel = new JPanel();
private JPanel jPanel1 = new JPanel();
protected JPanel inputPanel = new JPanel();
private BorderLayout borderLayout1 = new BorderLayout();
protected JPanel messagePanel = new JPanel();
private BorderLayout borderLayout2 = new BorderLayout();
private JScrollPane tmListScrollPane = new JScrollPane();
private JLabel messageLabel = new JLabel();
private JButton addButton = new JButton();
private JButton closeButton = new JButton();
private JPanel filterPanel = new JPanel();
private JLabel filterLabel = new JLabel();
private JTextField tmFilter = new JTextField(20);
private JTable tmTable = new JTable();
private String tmSelected = null;
private TMESTableModelFilter tmTableModel;
private Vector collection_ = new Vector();
URL urlProperties;
String TonName;
String fileParameters="";
String propertiesFileName = "data/param.properties";
URL urlParameterList;
JSObject win;
public void init() {
tonName=getParameter("TonName");
win = JSObject.getWindow(this);
try {
urlProperties = new URL(getCodeBase(), propertiesFileName);
urlParameterList = new URL(getCodeBase(), "data/PARAM-" + tonName
+ ".txt");
try {
MyAppletManager.loadPropertiesFile(tonName,urlProperties,urlParameterList);
} catch (Exception e) {System.out.println(e);}
}
catch(Exception e) {
e.printStackTrace();
}
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
messageLabel.setText(tonName + " PARAM List : ");
}
private void jbInit() throws Exception {
Container mainPane = this.getContentPane();
jPanel1.setLayout(borderLayout1);
inputPanel.setLayout(borderLayout2);
mainPane.setLayout(new BorderLayout());
mainPane.add(buttonPanel, BorderLayout.SOUTH);
mainPane.add(jPanel1, BorderLayout.CENTER);
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(messagePanel, BorderLayout.CENTER);
jPanel1.add(inputPanel, BorderLayout.CENTER);
jPanel1.add(topPanel, BorderLayout.NORTH);
addButton.setText("Add PARAM");
addButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e) {
addButton_actionPerformed(e);
}
});
closeButton.setText("Close");
closeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
closeButton_actionPerformed(e);
}
});
tmTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tmTableModel = new
TableModelFilter(tmTable.getModel(),MyAppletManager.gettmListApplet(),tmFilter);
tmTable.setModel(tmTableModel);
tmListScrollPane.getViewport().add(tmTable, null);
inputPanel.add(tmListScrollPane, BorderLayout.CENTER);
messagePanel.setLayout(new BorderLayout());
messagePanel.add(filterPanel, BorderLayout.NORTH);
messagePanel.add(messageLabel, BorderLayout.WEST);
buttonPanel.add(addButton);
buttonPanel.add(closeButton);
}
void addButton_actionPerformed(ActionEvent e) {
//TO DO
}
void closeButton_actionPerformed(ActionEvent e) {
closeApplication();
}
protected void closeApplication() {
//dispose();
//setVisible(false);
stop();
}
public void stop() {
if (collection_.size()!=0) {
String paramCollect []= new String[getCollection().size()];
paramCollect[0] = (getCollection()).toString();
win.call("closeApplet",paramCollect);
}
else {
String paramCollect []= new String[1];
paramCollect[0]="empty";
win.call("closeApplet",paramCollect);
}
}
public Vector getCollection() {
return collection_;
}
public void start() {
show();
}
public void destroy(){
}
} |
Partager