⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 taskmonitorhideoptionpanel.java

📁 一个用java写的地震分析软件(无源码)
💻 JAVA
字号:
package org.trinet.util.graphics.task;
import java.awt.*;
import java.beans.*;
import javax.swing.*; 

/**
  * Creates a task panel component containing a JOptionPane 
  * with  a "Hide"  button.  The "Hide" button disposes any
  * enclosing dialog frame, but a started task continues to run. 
  * The user must first start the task by invoking startTask()
  * which will make the component visible.
*/ 
public class TaskMonitorHideOptionPanel extends AbstractTaskMonitorOptionPanel {

    public TaskMonitorHideOptionPanel(AbstractMonitorableTask task) {
        super(task);
    }

/**
  * Returns a JOptionPane component containing the progress monitor.
  * Task thread is controlled using JOptionPane  methods.
  * By default "Hide" option dispose parent container if it is a dialog.
  * @see #addButtonControlPropertyChangeListener(PropertyChangeListener)
 */
    protected JOptionPane createOptionPane() {
        String [] stringOptions = { "Hide"};
        final JOptionPane optionPane = 
            new JOptionPane( progressMeter,
                            JOptionPane.INFORMATION_MESSAGE,
                            JOptionPane.DEFAULT_OPTION,
                            null, stringOptions, stringOptions[0]);
        optionPane.addPropertyChangeListener(
            new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent e) {
                    String prop = e.getPropertyName();
                    if (isVisible() && (e.getSource() == optionPane)
                     && (prop.equals(JOptionPane.VALUE_PROPERTY) ||
                         prop.equals(JOptionPane.INPUT_VALUE_PROPERTY))) {
                        String value = (String) e.getNewValue();
                        if (value.equals("Hide")) {
                            disposeDialog();
                        }
                        else {
                            System.out.println("Option UNKNOWN: " + value);
                        }
                    }
                }
        });
        return optionPane;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -