applet = this;
JPanel panel = new JPanel();
getContentPane().add(panel,BorderLayout.CENTER);
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
JPanel progressPanel = new JPanel() {
public Insets getInsets() {
return new Insets(40,30,20,30);
}
};
progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.Y_AXIS));
panel.add(Box.createGlue());
panel.add(progressPanel);
panel.add(Box.createGlue());
progressPanel.add(Box.createGlue());
Dimension d = new Dimension(400, 20);
Java2Demo.progressLabel = new JLabel("Loading, please wait...");
Java2Demo.progressLabel.setMaximumSize(d);
progressPanel.add(Java2Demo.progressLabel);
progressPanel.add(Box.createRigidArea(new Dimension(1,20)));
Java2Demo.progressBar = new JProgressBar();
Java2Demo.progressBar.setStringPainted(true);
Java2Demo.progressLabel.setLabelFor(Java2Demo.progressBar);
Java2Demo.progressBar.setAlignmentX(CENTER_ALIGNMENT);
Java2Demo.progressBar.setMaximumSize(d);
Java2Demo.progressBar.setMinimum(0);
Java2Demo.progressBar.setValue(0);
progressPanel.add(Java2Demo.progressBar);
progressPanel.add(Box.createGlue());
progressPanel.add(Box.createGlue());
Rectangle ab = getContentPane().getBounds();
panel.setPreferredSize(new Dimension(ab.width,ab.height));
getContentPane().add(panel,BorderLayout.CENTER);
validate();
setVisible(true);
Java2Demo.demo = new Java2Demo();
getContentPane().remove(panel);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(Java2Demo.demo, BorderLayout.CENTER);
String param = null;
if ((param = getParameter("delay")) != null) {
RunWindow.delay = Integer.parseInt(param);
}
if (getParameter("ccthread") != null) {
Java2Demo.demo.ccthreadCB.setSelected(true);
}
if ((param = getParameter("screen")) != null) {
Java2Demo.demo.controls.screenCombo.setSelectedIndex(Integer.parseInt(param));
}
if ((param = getParameter("antialias")) != null) {
Java2Demo.demo.controls.aliasCB.setSelected(param.endsWith("true"));
}
if ((param = getParameter("rendering")) != null) {
Java2Demo.demo.controls.renderCB.setSelected(param.endsWith("true"));
}
if ((param = getParameter("texture")) != null) {
Java2Demo.demo.controls.textureCB.setSelected(param.endsWith("true"));
}
if ((param = getParameter("composite")) != null) {
Java2Demo.demo.controls.compositeCB.setSelected(param.endsWith("true"));
}
if (getParameter("verbose") != null) {
Java2Demo.demo.verboseCB.setSelected(true);
}
if ((param = getParameter("columns")) != null) {
DemoGroup.columns = Integer.parseInt(param);
}
if ((param = getParameter("buffers")) != null) {
// usage -buffers=3,10
RunWindow.buffersFlag = true;
int i = param.indexOf(',");
String s1 = param.substring(0, i);
RunWindow.bufBeg = Integer.parseInt(s1);
s1 = param.substring(i+1, param.length());
RunWindow.bufEnd = Integer.parseInt(s1);
}
if (getParameter("zoom") != null) {
RunWindow.zoomCB.setSelected(true);
}
if ((param = getParameter("runs")) != null) {
RunWindow.numRuns = Integer.parseInt(param);
Java2Demo.demo.createRunWindow();
RunWindow.runB.doClick();
}
validate();
repaint();
Java2Demo.demo.requestDefaultFocus();