本文整理汇总了Java中javax.swing.SwingWorker.StateValue.DONE属性的典型用法代码示例。如果您正苦于以下问题:Java StateValue.DONE属性的具体用法?Java StateValue.DONE怎么用?Java StateValue.DONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.SwingWorker.StateValue
的用法示例。
在下文中一共展示了StateValue.DONE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertyChange
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ((evt.getNewValue() instanceof StateValue)
&& ((StateValue) evt.getNewValue()) == StateValue.DONE) {
executing = false;
setEnabled(true);
getCancelButton().setEnabled(false);
getProgressBar().setIndeterminate(false);
}
else if (evt.getPropertyName().equals(FindEEGExperimentsWorker.WORKER_LOG_APPENDED_PROPERTY)) {
logger.debug("Appending" + evt.getNewValue());
getLogTextField().append((String) evt.getNewValue());
}
else if (evt.getPropertyName().equals(FindEEGExperimentsWorker.NEW_EXPERIMENTS_RECEIVED)) {
List<ExperimentDescriptor> newExperiments = (List<ExperimentDescriptor>) evt.getNewValue();
chooseExperimentTableModel.addExperiments(newExperiments);
}
}
示例2: propertyChange
/**
* Invoked when task's progress property changes.
*/
public void propertyChange(PropertyChangeEvent evt)
{
String evtName = evt.getPropertyName();
if ("state" == evtName)
{
}
else if (evtName.startsWith(PROGRESS_PREFIX))
{
int progress = (Integer) evt.getNewValue();
m_ProgressBar.setValue(progress);
m_LabelActivity.setText(evtName.substring(PROGRESS_PREFIX.length()));
}
else if (evtName.startsWith("activity:"))
{
m_LabelActivity.setText(evtName.substring("activity:".length()));
}
else if (evtName.startsWith("cancel"))
{
m_ModalDialog.setVisible(false);
}
else if (evtName.startsWith("error"))
{
m_TextTaskOutput.setForeground(Color.red);
m_TextTaskOutput.append(evtName.substring("error".length()));
}
else
{
m_TextTaskOutput.append(evtName+"\n");
m_TextTaskOutput.setCaretPosition(m_TextTaskOutput.getDocument().getLength());
}
if (m_Task != null && m_Task.getState() == StateValue.DONE && !m_Task.isCancelled())
{
m_ModalDialog.setVisible(false);
}
}
示例3: actionPerformed
public void actionPerformed(ActionEvent evt)
{
if (evt.getActionCommand().equalsIgnoreCase("CANCEL"))
{
if (m_Task.getState() == StateValue.DONE) {
m_ModalDialog.setVisible(false);
} else {
m_Task.cancel(true);
}
}
}
示例4: setLoadState
/**
* Callback for worker's state notification: cleanup if done.
* @param state
*/
public void setLoadState(StateValue state) {
//<snip>Use SwingWorker to asynchronously load the data
// remove progressbar if done loading
if (state != StateValue.DONE) return;
statusBarLeft.remove(progressBar);
statusBarLeft.remove(actionStatus);
revalidate();
repaint();
// </snip>
}
示例5: stateChange
@Override
default void stateChange(SwingWorker<?, ?> source, StateValue oldState, StateValue newState) {
AbstractWorker<?, ?> worker = (AbstractWorker<?, ?>) source;
if (newState == StateValue.DONE && worker.isDoneWithSuccess()) {
doneWithSuccess(worker);
} else if (newState == StateValue.DONE) {
doneWithError(worker, worker.getLastError());
}
}