📄 processbox.java
字号:
/** * file: ProcessBox.java * * last editted: Ryan Irwin */// import necessary java libraries//import java.awt.*;import javax.swing.*;import javax.swing.border.*;//These imports are not needed - Phil T. 6-23-03//import java.awt.event.*;/** * ProcessBox inplements the text area to the right of the applet that * acts as a process description for the various algorithms being used * * hierarchy: JPanel->SubPanel->ProcessBox * */class ProcessBox extends SubPanel { // ********************************************************************* // // declare global variables and components // // ********************************************************************* // declare components // JTextArea textArea; // text area for user information JScrollPane scrollPane; // scroll pane for the text area ProgressBar progress; // progress bar indicator String title1; // title for process discription Font currentFont = getFont(); // fonts for the buttons Font newFont = new Font(currentFont.getName(), currentFont.getStyle(), 12); // ********************************************************************* // // declare class constructors // // ********************************************************************* /** * Constructor initializes the text area and scroll bar objects * */ ProcessBox() { // initialize the progress bar // progress = new ProgressBar(); progress.add_components(); // initialize the titles of the objects // title1 = new String("Process Description:"); // initialize the text area // textArea = new JTextArea(); textArea.setEditable(false); // make the text area scrollable // scrollPane = new JScrollPane(textArea); // set the border for the panel // Border titleBorder = BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.black), title1, TitledBorder.LEFT, TitledBorder.ABOVE_TOP, newFont, Color.black); scrollPane.setBorder(titleBorder); } // ********************************************************************* // // declare class methods // // ********************************************************************* /** * Adds components to the input panel * */ public void add_components() { constrain(this, scrollPane, 0, 0, GridBagConstraints.REMAINDER, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, 1, 1, 0, 0, 0, 0); constrain(this, progress, 0, 1, GridBagConstraints.REMAINDER, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, 1, 0.01, 0, 0, 0, 0); } /** * Appends a message to the text area * * @param text_a String message to be appended */ public void appendMessage(String text_a) { textArea.append(text_a + "\n"); } /** * Appends messages to the text area * * @param text_a String messages to be appended */ public void appendMessages(String text_a) { textArea.append(text_a); } /** * method: appendMessage * * @param none * @return none * * appendMessage to the text area * */ // public void appendMessages1(String text_a) { // textArea.append(text_a); // } /** * Clears all messages * */ public void clearMessage() { // clear all message // textArea.setText(""); } /** * Sets the progress minimum value * * @param min_a Sets progressBar to this minimum value */ public void setProgressMin(int min_a) { // clear all message // progress.progressBar.setMinimum(min_a); } /** * Sets the progress maximum value * * @param max_a Sets progress to this maximum value */ public void setProgressMax(int max_a) { // clear all message // progress.progressBar.setMaximum(max_a); } /** * Sets the progress current value * * @param curr_a Sets the progress to this current value */ public void setProgressCurr(int curr_a) { // clear all message // progress.progressBar.setValue(curr_a); progress.repaint(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -