本文整理汇总了Java中javax.swing.ProgressMonitor.setNote方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitor.setNote方法的具体用法?Java ProgressMonitor.setNote怎么用?Java ProgressMonitor.setNote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ProgressMonitor
的用法示例。
在下文中一共展示了ProgressMonitor.setNote方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cutSurface
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public synchronized void cutSurface(Surface surface, ProgressMonitor monitor) {
if (cpList.isEmpty() || (repeat <= 0)) {
return;
}
double zRotation = indexOffsetDegrees();
if (zRotation != 0.0) {
surface.rotateZ(zRotation); // initial phase rotation
}
outerloop:
for (int i = 0; i < repeat; i++) {
if (i > 0) {
surface.rotateZ(360.0 / repeat); // rotate to the next one
zRotation += 360.0 / repeat; // keep track of cumulative rotation
}
surface.offset(-getX(), 0.0, -getZ()); // move the surface over the offset point
surface.rotateY(-getTangentAngle());
// this is where the main work is done
monitor.setProgress(num+1);
monitor.setNote("CutPoint " + getNum() + ": " + i + "/" + repeat + "\n");
for (CutPoint cPt : cpList) {
if (cPt instanceof OffRosettePoint) {
Vector2d offsetPt = offsetForCutPoint(cPt);
((OffRosettePoint) cPt).cutSurface(surface, offsetPt.x, offsetPt.y); // and cut with it
}
if (monitor.isCanceled()) {
break outerloop;
}
}
surface.rotateY(getTangentAngle());
surface.offset(getX(), 0.0, getZ()); // move the surface back so that the z rotation will be around the center
}
if (zRotation < 360.0) {
surface.rotateZ(360.0 - zRotation); // this should get you back to original rotation
}
}
示例2: cutSurface
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public synchronized void cutSurface(Surface surface, ProgressMonitor monitor) {
ArrayList<CutPoint> list = makeListOfPoints();
for (int i = 0; i < list.size(); i++) {
monitor.setProgress(num + 1);
monitor.setNote("CutPoint " + getNum() + ": " + i + "/" + list.size() + "\n");
list.get(i).cutSurface(surface, monitor);
if (monitor.isCanceled()) {
break;
}
}
}
示例3: 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();
}
示例4: doImportTraitsFileImpl
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
private void doImportTraitsFileImpl(File file) {
Context context = KDSmartApplication.getInstance();
final ProgressMonitor monitor = new ProgressMonitor(TraitExplorerPanel.this, "Loading", "", 0, 100);
ProgressReporter progressReporter = new ProgressReporter() {
@Override
public void setProgressNote(String note) {
monitor.setNote(note);
}
@Override
public void setProgressMaximum(int max) {
monitor.setMaximum(max);
}
@Override
public void setProgressCount(int count) {
monitor.setProgress(count);
}
@Override
public void dismissProgress() {
monitor.close();
}
};
try {
Either<ImportError, TraitImportTransactions> either = offlineData.getKdxploreDatabase()
.getKDXploreKSmartDatabase().importTraitsFile(context, file, progressReporter);
if (either.isLeft()) {
ImportError ie = either.left();
MsgBox.error(TraitExplorerPanel.this, ie.getMessage("Import Traits"), "Import Failed");
} else {
TraitImportTransactions tit = either.right();
if (!tit.traitsToBeUpdated.isEmpty()) {
}
refreshTraitsTable();
StringBuilder sb = new StringBuilder("Import Result");
if (tit.nSkipped > 0) {
sb.append("\nSkipped ").append(tit.nSkipped);
}
if (!tit.traitsToBeAdded.isEmpty()) {
sb.append("\nAdded: ").append(tit.traitsToBeAdded.size());
}
if (!tit.traitsToBeUpdated.isEmpty()) {
sb.append("\nUpdated: ").append(tit.traitsToBeUpdated.size());
}
MsgBox.info(TraitExplorerPanel.this, sb.toString(), "Import Complete");
}
} finally {
progressReporter.dismissProgress();
}
}
示例5: ParallelCoordinatesChart
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
* Instantiates a new parallel coordinates chart.
*
* @param dataSheet
* the data sheet
* @param progressMonitor
* the progress monitor
* @param id
* the id
*/
public ParallelCoordinatesChart(DataSheet dataSheet, ProgressMonitor progressMonitor, int id) {
super(dataSheet, id);
this.setLocation(new Point(100, 100));
this.setFrameSize(new Dimension(1280, 800));
log("constructor called. Read Base settings.");
UserPreferences userPreferences = UserPreferences.getInstance();
this.backGroundColor = userPreferences.getParallelCoordinatesDefaultBackgroundColor();
this.showDesignIDs = userPreferences.isParallelCoordinatesShowDesignIDs();
this.showFilteredDesigns = userPreferences.isParallelCoordinatesShowFilteredDesigns();
this.verticallyOffsetAxisLabels = userPreferences.isParallelCoordinatesVerticallyOffsetAxisLabels();
this.setActiveDesignColor(userPreferences.getParallelCoordinatesActiveDesignDefaultColor());
this.selectedDesignColor = userPreferences.getParallelCoordinatesSelectedDesignDefaultColor();
this.setFilteredDesignColor(userPreferences.getParallelCoordinatesFilteredDesignDefaultColor());
this.designLabelFontSize = userPreferences.getParallelCoordinatesDesignLabelFontSize();
this.lineThickness = userPreferences.getParallelCoordinatesLineThickness();
this.selectedDesignsLineThickness = userPreferences.getParallelCoordinatesSelectedDesignLineThickness();
this.filterColor = userPreferences.getParallelCoordinatesFilterDefaultColor();
this.showOnlySelectedDesigns = userPreferences.isParallelCoordinatesShowOnlySelectedDesigns();
this.filterHeight = userPreferences.getParallelCoordinatesFilterHeight();
this.filterWidth = userPreferences.getParallelCoordinatesFilterWidth();
log("constructor: Base settings read. Creating axes...");
progressMonitor.setMaximum(dataSheet.getParameterCount() - 1);
progressMonitor.setNote("Building Chart...");
for (int i = 0; i < dataSheet.getParameterCount() && !progressMonitor.isCanceled(); i++) {
// log("constructor: Creating axis "+dataSheet.getParameter(i).getName());
Axis newAxis = new Axis(dataSheet, this, dataSheet.getParameter(i));
this.addAxis(newAxis);
progressMonitor.setProgress(i);
}
if (!progressMonitor.isCanceled()) {
progressMonitor.setNote("Building Filters...");
progressMonitor.setProgress(0);
// log("constructor: axes created. Creating filters...");
for (int i = 0; i < dataSheet.getParameterCount() && !progressMonitor.isCanceled(); i++) {
this.axes.get(i).addFilters();
progressMonitor.setProgress(i);
}
// log("constructor: filters created. ");
}
}
示例6: 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;
}
示例7: getProducer
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
private DataStoreProducer getProducer(File[] files, Sector bbox,
String datasetName, final ProgressMonitor progressMonitor, final AtomicInteger progress) {
final Thread currentThread = getCurrentThread(datasetName);
final boolean background = (datasetName==Constants.BACKGROUND_LANDSAT_CACHE_FOLDER || datasetName==Constants.BACKGROUND_TPC_CACHE_FOLDER);
final DataStoreProducer producer = ImportUtils.createDataStoreProducerFromFiles(files,bbox,background);
PropertyChangeListener progressListener=null;
if(datasetName == Constants.ELEVATION_LAYER_CACHE_FOLDER){
progressListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (progressMonitor.isCanceled()) {
if(!isOtherThreadsAlive(currentThread)){
toggleAllComponentsEnablement(true);
}
return;
}
if (evt.getPropertyName().equals(AVKey.PROGRESS)) {
Double tileProgress=(Double)evt.getNewValue();
progress.set((int) (100 * tileProgress));
}
}
};
}else{
progressListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (progressMonitor.isCanceled()) {
if(!isOtherThreadsAlive(currentThread)){
toggleAllComponentsEnablement(true);
}
return;
}
if (evt.getPropertyName().equals(AVKey.PROGRESS)) {
Double tileProgress=(Double)evt.getNewValue();
int count = 0;
if(background){
count = ((TiledPKMImageProducer)producer).getTotalTileCount();
}else{
count = ((TransparentTiledImageProducer)producer).getTotalTileCount();
}
progress.set((int) (100 * tileProgress));
String message = String.format("Import %d of "+count+" tiles",(int) (tileProgress*count) );
progressMonitor.setNote(message);
}
}
};
}
producer.addPropertyChangeListener(progressListener);
return producer;
}
示例8: translate
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
* Change the IMC definitions of a given LSF file, generates a new one
* @param originalDir The folder of the original LSF file
* @param destinationDir The destination folder, containing the new IMC definitions
* @param messagesToFilter Messages to filtered out (optional)
* @param m ProgressMonitor to be updated according to the progress of this process (optional)
* @throws Exception In case some file cannot be read / written to.
*/
public static void translate(File originalDir, File destinationDir, Vector<String> messagesToFilter, ProgressMonitor m) throws Exception {
if (m != null)
m.setMaximum(100);
if (messagesToFilter == null)
messagesToFilter = new Vector<String>();
LsfIndex index = new LsfIndex(new File(originalDir, "Data.lsf"));
IMCDefinition destDefs = new IMCDefinition(new FileInputStream(new File(destinationDir, "IMC.xml")));
FileOutputStream fos = new FileOutputStream(new File(destinationDir, "Data.lsf"));
int lastPercent = -1;
System.out.println("Translating from "+originalDir+" to "+destinationDir);
for (int i = 0; i < index.getNumberOfMessages(); i++) {
if (messagesToFilter.contains(index.getDefinitions().getMessageName(index.typeOf(i))))
continue;
IMCMessage original = index.getMessage(i);
if (!destDefs.messageExists(original.getAbbrev())) {
System.err.println("Dropping message "+original.getAbbrev()+" because it doesn't exists in destination IMC.");
continue;
}
IMCMessage result = original.cloneMessage(destDefs);
destDefs.serialize(result, fos);
int percent = (i*100 / index.getNumberOfMessages());
if (percent != lastPercent) {
if (m != null) {
m.setNote(percent+"% done...");
m.setProgress(percent);
}
else
System.out.println(percent+"% done...");
lastPercent = percent;
}
}
if (m != null)
m.close();
fos.close();
}
示例9: progess
import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
* @param digest 文件数字签证操作类.
* @param filename 文件名称.
* @param filesize 文件大小(单位:bytes).
*/
private void progess(final Thread calThread, final FileDigitalSignatures digest,
String filename, final long filesize) {
String messae = resourceBundle.getString("progressmonitor.readingFile") + filename + "...";
final int maxScale = 100;
final ProgressMonitor readFileProgressMonitor = new ProgressMonitor(
FileDigitalSignaturesGui.this, messae, null, 0, maxScale);
Thread progessThread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
// 处理进度条的取消动作
if (readFileProgressMonitor.isCanceled()) {
readFileProgressMonitor.close();
calThread.interrupt();
calculateBtn.setEnabled(true);
break;
}
if (digest.getFilesize() == digest.getReadsize()
&& 0 != digest.getFilesize()
&& 0 != digest.getReadsize()) {
readFileProgressMonitor.setProgress(maxScale);
readFileProgressMonitor.setNote(resourceBundle.getString("progressmonitor.complete") + "100%");
break;
}
int scale = (int) ((digest.getReadsize() / filesize) * 100);
readFileProgressMonitor.setProgress(scale);
readFileProgressMonitor.setNote(resourceBundle.getString("progressmonitor.complete") + scale + "%");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
}
}
readFileProgressMonitor.close();
}
});
progessThread.start();
}