primeFactory.addModelListener(this);
bevelPanel1.setBevelInner(BevelPanel.FLAT);
bevelPanel1.setLayout(gridLayout1);
restartButton.setLabel("Start");
restartButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
restartButton_actionPerformed(e);
}
});
cancelButton.setLabel("Cancel");
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
cancelButton_actionPerformed(e);
}
});
testNumberText.setAlignment(Label.RIGHT);
testNumberText.setFont(new Font("Dialog", 0, 30));
testNumberText.setForeground(testNumberLabel.getForeground());
testNumberText.setText("testing");
primeNumberText.setAlignment(Label.RIGHT);
primeNumberText.setFont(new Font("Dialog", 0, 30));
primeNumberText.setForeground(testNumberLabel.getForeground());
primeNumberText.setText("3");
gridLayout1.setHgap(8);
testNumberLabel.setHorizontalAlignment(SwingConstants.RIGHT);
testNumberLabel.setText("Largest so far:");
primeNumberLabel.setHorizontalAlignment(SwingConstants.RIGHT);
primeNumberLabel.setText("Prime:");
jLabel1.setText("Go To:");
timeLabel.setHorizontalAlignment(SwingConstants.RIGHT);
checkbox2.setLabel("UniformWidth");
checkbox2.setState(true);
checkbox2.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
checkbox2_itemStateChanged(e);
}
});
checkbox2.setForeground(testNumberLabel.getForeground());
checkbox1.setLabel("BatchMode");
checkbox1.setState(true);
checkbox1.setForeground(testNumberLabel.getForeground());
timeText.setText("");
timeText.setAlignment(Label.RIGHT);
timeText.setForeground(testNumberLabel.getForeground());
timeLabel.setText("Primes found:");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jTextField1_actionPerformed(e);
}
});
panel1.setLayout(borderLayout1);
this.setSize(new Dimension(420, 300));
listView.setSelection(new NullVectorSelection ());
listView.setModel(primeFactory);
listView.setSubfocus(-1);
listView.setShowFocus(false);
listView.setBatchMode(true);
listView.addCustomItemListener(this);
//When either uniformWidth or uniformHeight are false, ListView looks through the entire model to
//calculate preferredSize
listView.setUniformWidth(true); //practically required for large models
this.getContentPane().setLayout(gridBagLayout1);
this.getContentPane().add(bevelPanel1, new GridBagConstraints2(2, 7, 2, 1, 0.0, 0.0
,GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(0, 30, 10, 12), 50, 0));
bevelPanel1.add(restartButton, null);
bevelPanel1.add(cancelButton, null);
this.getContentPane().add(testNumberText, new GridBagConstraints2(2, 0, 2, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 12), 0, 0));
this.getContentPane().add(primeNumberText, new GridBagConstraints2(2, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 12), 0, 0));
this.getContentPane().add(testNumberLabel, new GridBagConstraints2(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
this.getContentPane().add(primeNumberLabel, new GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
this.getContentPane().add(panel1, new GridBagConstraints2(0, 0, 1, 8, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 12, 10, 21), 0, 0));
panel1.add(listView, BorderLayout.CENTER);
this.getContentPane().add(jLabel1, new GridBagConstraints2(1, 3, 1, 2, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
this.getContentPane().add(jTextField1, new GridBagConstraints2(2, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 12), 23, 0));
this.getContentPane().add(timeText, new GridBagConstraints2(2, 2, 2, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 12), 0, 0));
this.getContentPane().add(timeLabel, new GridBagConstraints2(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
this.getContentPane().add(checkbox1, new GridBagConstraints2(2, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
this.getContentPane().add(checkbox2, new GridBagConstraints2(2, 6, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
// add listView scrollbar listener
listView.getVerticalScrollBar().addAdjustmentListener(
new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
listViewHorizontalScrollBar_adjustmentValueChanged(e);
}
}
);