本文整理汇总了Java中javax.swing.ProgressMonitor.setMillisToDecideToPopup方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitor.setMillisToDecideToPopup方法的具体用法?Java ProgressMonitor.setMillisToDecideToPopup怎么用?Java ProgressMonitor.setMillisToDecideToPopup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ProgressMonitor
的用法示例。
在下文中一共展示了ProgressMonitor.setMillisToDecideToPopup方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: statusBarBegin
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
* statusBarBegin.
*
* @param progress Progress
* @param message String
* @param activityMonitored String
*/
public void statusBarBegin(final Progress progress, final String message,
final String activityMonitored) {
BusyIndicator.showAt(Application.instance().getActiveWindow().getControl());
task = new LongTask();
task.setActivityMonitored(activityMonitored);
task.setProgress(progress);
timer.addActionListener(new TimerListener());
progressMonitor =
new ProgressMonitor(this.getControl(), message, "Preparing the " + "operation...",
0, 1);
progressMonitor.setMillisToDecideToPopup(ONE_SECOND);
task.setMonitor(progressMonitor);
task.go();
timer.start();
}
示例2: init
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public void init(int op, String src, String dest, long max) {
this.max = max;
monitor = new ProgressMonitor(null,
((op == SftpProgressMonitor.PUT)
? "put" : "get") + ": " + src,
"", 0, (int) max);
count = 0;
percent = -1;
monitor.setProgress((int) this.count);
monitor.setMillisToDecideToPopup(1000);
}
示例3: construct
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public Object construct() {
ProgressMonitor pm = new ProgressMonitor(own, msg, "", 0, max);
pm.setMillisToDecideToPopup(0);
pm.setMillisToPopup(0);
pm.setProgress(0);
return pm;
}
示例4: actionPerformed
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
/*
* if (e.getSource() instanceof Component) { parentComponent = (Component)
* e.getSource(); } else { parentComponent = null; }
*/
parentComponent = MainWindow.getMainWindow();
Thread t = new Thread(this, "Import workflow");
progressMonitor = new ProgressMonitor(parentComponent, "Importing workflow", "", 0, 100);
progressMonitor.setMillisToDecideToPopup(200);
progressMonitor.setProgress(5);
t.start();
setVisible(false);
}
示例5: start
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public void start(int max)
{
super.start(max);
task = new ProgressMonitor(parent, message, "", 0, max);
task.setMillisToDecideToPopup(100);
task.setMillisToPopup(500);
}
示例6: getPersistentProgressMonitor
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public static ProgressMonitor getPersistentProgressMonitor(Component frame, String message) {
final ProgressMonitor monitor = new ProgressMonitor(frame, message, "", 0, 1); //$NON-NLS-1$
monitor.setMillisToDecideToPopup(0);
monitor.setMillisToPopup(0);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
monitor.setProgress(0);
AccessibleContext ac = monitor.getAccessibleContext();
if (ac == null) throw new Exception();
JDialog dialog = (JDialog) ac.getAccessibleParent();
if (dialog == null) throw new Exception();
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
for (WindowListener listener : dialog.getWindowListeners()) {
dialog.removeWindowListener(listener);
}
java.util.List<JButton> components = SwingUtils.getDescendantsOfType(JButton.class, dialog, true);
if (components.isEmpty()) throw new Exception();
JButton button = components.get(0);
if (button == null) throw new Exception();
button.setVisible(false);
} catch (Exception e) {
CCLog.addError(LocaleBundle.getString("LogMessage.ErrorOmitingProgressMonitor"), e); //$NON-NLS-1$
}
}
});
return monitor;
}
示例7: FileMover
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public FileMover(final ClientFrame frame, boolean fromTree, final boolean copy, File targetParent, File... files) {
this.targetParent = targetParent;
this.files = files;
this.fromTree = fromTree;
this.copy = copy;
this.frame = frame;
canceled = false;
JDialog dialog = new JDialog(frame, "");
dialog.setContentPane(new JLabel("<html><body>Ermittle Gesamtgröße<br>Bitte warten...</body></html>", JLabel.CENTER));
dialog.setSize(160, 80);
dialog.setLocationRelativeTo(frame);
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
int count = 0;
for (File f : files) {
if (f.isDirectory()) count += Assistant.getFileCount(f);
else count++;
}
dialog.dispose();
value = 0;
monitor = new ProgressMonitor(frame, (copy ? "Kopiere" : "Verschiebe") + " Dateien...", "", 0, count);
monitor.setMillisToDecideToPopup(0);
monitor.setMillisToPopup(0);
start();
}
示例8: startProgressMonitor
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public static void startProgressMonitor()
{
progressMonitor = new ProgressMonitor(CalicoDataStore.calicoObj,
"Synchronizing with server: " + CalicoDataStore.ServerHost,
"", 0, 100);
progressMonitor.setProgress(0);
progressMonitor.setMillisToPopup(1);
progressMonitor.setMillisToDecideToPopup(1);
}
示例9: writeEEPROM
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
* This is a BLOCKING write call to write the Cypress EEPROM. Max number of
* bytes is defined by {@link #EEPROM_SIZE}. Thread-safe.
*
* @param addr the starting address
* @param bytes the bytes to write
*/
synchronized public void writeEEPROM(int addr, byte[] bytes) throws HardwareInterfaceException {
log.info("writing EEPROM to addr=" + addr + " with " + bytes.length + " bytes");
if (bytes.length > this.EEPROM_SIZE) {
throw new RuntimeException(bytes.length + " is too many bytes for EEPROM to hold (" + EEPROM_SIZE + ")");
}
if ((addr < 0) || ((addr + bytes.length) > EEPROM_SIZE)) {
throw new RuntimeException(bytes.length + " is too many bytes for EEPROM to hold (" + EEPROM_SIZE + ") starting at address " + addr);
}
int result; // result of USBIO operations
USBIO_DATA_BUFFER dataBuffer = null;
USBIO_CLASS_OR_VENDOR_REQUEST vendorRequest = null;
int numChunks, index;
// make vendor request structure and populate it
vendorRequest = new USBIO_CLASS_OR_VENDOR_REQUEST();
vendorRequest.Request = VR_EEPROM; // this is EEPROM command, direction of vendor request defines download here
vendorRequest.Flags = UsbIoInterface.USBIO_SHORT_TRANSFER_OK;
vendorRequest.Type = UsbIoInterface.RequestTypeVendor; // this is a vendor, not generic USB, request
vendorRequest.Recipient = UsbIoInterface.RecipientDevice; // device (not endpoint, interface, etc) receives it
vendorRequest.RequestTypeReservedBits = 0; // set these bits to zero for Cypress-specific 'vendor request' rather that user defined
vendorRequest.Index = 0;
//send all but last chunk
vendorRequest.Value = (short) addr; //address to write to (starting)
dataBuffer = new USBIO_DATA_BUFFER(MAX_CONTROL_XFER_SIZE);
dataBuffer.setNumberOfBytesToTransfer(dataBuffer.Buffer().length);
index = 0;
numChunks = bytes.length / MAX_CONTROL_XFER_SIZE; // this is number of full chunks to send
ProgressMonitor progressMonitor = makeProgressMonitor("Writing " + numChunks + " " + MAX_CONTROL_XFER_SIZE + " byte chunks FX2 firmware - do not unplug!", 0, numChunks);
for (int i = 0; i < numChunks; i++) {
System.arraycopy(bytes, i * MAX_CONTROL_XFER_SIZE, dataBuffer.Buffer(), 0, MAX_CONTROL_XFER_SIZE);
result = gUsbIo.classOrVendorOutRequest(dataBuffer, vendorRequest);
if (result != USBIO_ERR_SUCCESS) {
close();
throw new HardwareInterfaceException("Error on downloading segment number " + i + " of EEPROM write: " + UsbIo.errorText(result));
}
vendorRequest.Value += MAX_CONTROL_XFER_SIZE; //change address of EEPROM write location
// can't cancel
if (progressMonitor.isCanceled()) {
progressMonitor = makeProgressMonitor("Writing FX2 firmware - do not unplug!", 0, numChunks);
progressMonitor.setMillisToDecideToPopup(0);
}
progressMonitor.setProgress(i);
progressMonitor.setNote(String.format("wrote %d of %d chunks of FX2 firmware", i, numChunks));
}
// now send final (short) chunk
int numBytesLeft = bytes.length % MAX_CONTROL_XFER_SIZE; // remainder
if (numBytesLeft > 0) {
dataBuffer = new USBIO_DATA_BUFFER(numBytesLeft);
dataBuffer.setNumberOfBytesToTransfer(dataBuffer.Buffer().length);
System.arraycopy(bytes, numChunks * MAX_CONTROL_XFER_SIZE, dataBuffer.Buffer(), 0, numBytesLeft);
// send remaining part of firmware
result = gUsbIo.classOrVendorOutRequest(dataBuffer, vendorRequest);
if (result != USBIO_ERR_SUCCESS) {
close();
throw new HardwareInterfaceException("Error on downloading final segment of EEPROM write: " + UsbIo.errorText(result) + "\nIs there an EEPROM? Does the device have firmware that can write the EEPROM?");
}
}
progressMonitor.close();
}
示例10: DefaultSwingProgressListener
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
* Constructor with customized message.
*/
public DefaultSwingProgressListener(Component parentComponent, String message, String initialNote) {
progressMonitor = new ProgressMonitor(parentComponent, message, initialNote, 0, 1);
progressMonitor.setMillisToDecideToPopup(0);
progressMonitor.setMillisToPopup(0);
}
示例11: loadVenueData
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public Vector loadVenueData(Component parent) throws Exception {
headers = null;
Socket s = null;
ProgressMonitor progress = null;
Vector venues = null;
try
{
StallInputStream stallInput = new StallInputStream();
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(
parent, "Loading filter data from pente.org", stallInput);
progress = pmis.getProgressMonitor();
progress.setNote("Connecting to pente.org...");
progress.setMillisToDecideToPopup(1);
progress.setMillisToPopup(1);
progress.setMaximum(15000);
StringBuffer paramsBuffer = new StringBuffer();
StringBuffer requestBuffer = createHttpRequest(paramsBuffer, "/venues");
int len = 0;
s = getHttpResponseSocket(requestBuffer);
progress.setProgress(2000);
progress.setNote("Downloading from pente.org...");
// read past the http headers to the data
InputStream in = s.getInputStream();
String contentLength = getHeader("content-length:", in);
if (contentLength != null) {
len = Integer.parseInt(contentLength);
}
// for (int i = 0; i < len; i++) {
// int b = in.read();
// if (b == -1) {
// System.out.println("error");
// }
// }
progress.setMaximum(len);
stallInput.setInputStream(in);
ObjectInputStream objectIn = new ObjectInputStream(pmis);
venues = (Vector) objectIn.readObject();
} catch (Exception e) {
if (s != null) {
s.close();
s = null;
}
if (!(e instanceof InterruptedException) && !(progress == null || !progress.isCanceled())) {
throw e;
}
}
return venues;
}
示例12: loginButtonActionPerformed
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
signup.setEnabled(false);
loginButton.setEnabled(false);
user.setEnabled(false);
password.setEnabled(false);
final ProgressMonitor mon = new ProgressMonitor(this, "Logging In", "Connecting To Server", 0, 100);
mon.setMillisToDecideToPopup(0);
mon.setProgress(1);
new Thread() {
public void run() {
try {
mon.setProgress(40);
URL u = new URL("https://codename-one.appspot.com/getData?m=login&u=" + URLEncoder.encode(user.getText(), "UTF-8") +
"&p=" + URLEncoder.encode(password.getText(), "UTF-8"));
InputStream i = u.openStream();
byte[] b = new byte[4];
i.read(b);
i.close();
mon.setProgress(90);
// success
if(b[0] == 'O') {
Preferences p = Preferences.userNodeForPackage(getClass());
if(remember.isSelected()) {
p.put("user", user.getText());
p.put("pass", password.getText());
} else {
p.remove("user");
p.remove("pass");
}
globalPassword = password.getText();
globalUser = user.getText();
dispose();
} else {
signup.setEnabled(true);
loginButton.setEnabled(true);
user.setEnabled(true);
password.setEnabled(true);
// fail
if(b[0] == 'F') {
signup.setText("Login Failed, check user/password");
} else {
// unknown error maybe proxy
JOptionPane.showMessageDialog(LoginDialog.this, "Login Failed", "Unable to connect, check proxy settings", JOptionPane.ERROR_MESSAGE);
}
}
mon.close();
} catch (Exception ex) {
ex.printStackTrace();
signup.setEnabled(true);
loginButton.setEnabled(true);
user.setEnabled(true);
password.setEnabled(true);
JOptionPane.showMessageDialog(LoginDialog.this, "Login Failed", "Internal Error:\n" + ex, JOptionPane.ERROR_MESSAGE);
}
}
}.start();
}