this.swing = swing;
setLayout(new BorderLayout());
JPanel textWrapper = new JPanel(new BorderLayout());
textWrapper.setBorder(swing.loweredBorder);
textWrapper.setAlignmentX(LEFT_ALIGNMENT);
progressTextArea = new MyTextArea();
progressTextArea.getAccessibleContext().setAccessibleName("Text progressively being loaded in");
progressTextArea.getAccessibleContext().setAccessibleDescription("This JTextArea is being filled with text from a buffer progressively a character at a time while the progress bar a the bottom of the window shows the loading progress");
textWrapper.add(progressTextArea, BorderLayout.CENTER);
add(textWrapper, BorderLayout.CENTER);
JPanel progressPanel = new JPanel();
add(progressPanel, BorderLayout.SOUTH);
progressBar = new JProgressBar() {
public Dimension getPreferredSize() {
return new Dimension(300, super.getPreferredSize().height);
}
};
progressBar.getAccessibleContext().setAccessibleName("Text loading progress");
progressPanel.add(progressBar);
loadButton = new JButton("Start Loading Text");
loadButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
startLoading((JButton)e.getSource());
}
});
progressPanel.add(loadButton);
stopButton = new JButton("Stop Loading Text");
stopButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
stopLoading((JButton)e.getSource());
}
});
stopButton.setEnabled(false);
progressPanel.add(stopButton);