本文整理汇总了Java中org.eclipse.swt.widgets.ProgressBar.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar.setVisible方法的具体用法?Java ProgressBar.setVisible怎么用?Java ProgressBar.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.setVisible方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Splash
import org.eclipse.swt.widgets.ProgressBar; //导入方法依赖的package包/类
public Splash(Display display, Rectangle displayRect, boolean showProgress) {
image = new Image(display, getClass().getResourceAsStream("/splash.png"));
shell = new Shell(SWT.ON_TOP);
progressUI = new ProgressBar(shell, SWT.NONE);
progressUI.setMaximum(100);
Label label = new Label(shell, SWT.NONE);
label.setImage(image);
FormLayout layout = new FormLayout();
shell.setLayout(layout);
FormData labelData = new FormData();
labelData.right = new FormAttachment(100, 0);
labelData.bottom = new FormAttachment(100, 0);
label.setLayoutData(labelData);
FormData progressData = new FormData();
progressData.left = new FormAttachment(0, -5);
progressData.right = new FormAttachment(100, 0);
progressData.bottom = new FormAttachment(100, 0);
progressUI.setLayoutData(progressData);
progressUI.setVisible(showProgress);
shell.pack();
Rectangle splashRect = shell.getBounds();
progressUI.setBounds(2, splashRect.height-14, splashRect.width-6, 10);
int x = displayRect.x + (displayRect.width - splashRect.width) / 2;
int y = displayRect.y + (displayRect.height - splashRect.height) / 2;
shell.setLocation(x, y);
shell.open();
setProgress(0);
}
示例2: RunWithProgressBar
import org.eclipse.swt.widgets.ProgressBar; //导入方法依赖的package包/类
public RunWithProgressBar(Composite comp) {
pb = new ProgressBar(comp, SWT.HORIZONTAL | SWT.INDETERMINATE);
// pb.setMinimum(0);
// pb.setMaximum(100);
// pb.setSelection(50);
// pb.setBounds(10, 10, 200, 30);
GridData gd = new GridData();
gd.widthHint = 100;
gd.heightHint = 20;
pb.setLayoutData(gd);
pb.setVisible(false);
}
示例3: createProgressComposite
import org.eclipse.swt.widgets.ProgressBar; //导入方法依赖的package包/类
/*******************************************************
* Creates the progress bar composite. This will help the user know that the
* tool is working and making progress
*
* @param parent
* The parent composite
*******************************************************/
private void createProgressComposite(Composite parent)
{
// The container of this group
Composite progressComp = new Composite(parent, SWT.BORDER);
progressComp.setLayout(new GridLayout(1, true));
progressComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// The label to tell the user about the current state
Label label = new Label(progressComp, SWT.NONE);
label.setText("Testing ...");
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
// The progress bar
ProgressBar progBar = new ProgressBar(progressComp, SWT.NONE);
progBar.setMaximum(100);
progBar.setMinimum(0);
progBar.setSelection(0);
progBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// Initially hide them
label.setVisible(false);
progBar.setVisible(false);
// Create the progress updater
mProgressUpdater = new ProgressUpdater(progBar, label);
}
示例4: createProgressComposite
import org.eclipse.swt.widgets.ProgressBar; //导入方法依赖的package包/类
/*******************************************************
* Creates the progress bar composite. This will help the user know that the
* tool is working and making progress
*
* @param parent
* The parent composite
*******************************************************/
private void createProgressComposite(Composite parent)
{
// The container of this group
Composite progressComp = new Composite(parent, SWT.BORDER);
progressComp.setLayout(new GridLayout(1, true));
progressComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// The label to tell the user about the current state
Label label = new Label(progressComp, SWT.NONE);
label.setText("Testing ...");
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// The progress bar
ProgressBar progBar = new ProgressBar(progressComp, SWT.NONE);
progBar.setMaximum(100);
progBar.setMinimum(0);
progBar.setSelection(0);
progBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// Initially hide them
label.setVisible(false);
progBar.setVisible(false);
// Create the progress updater
mProgressUpdater = new ProgressUpdater(progBar, label);
}
示例5: buildStatusBar
import org.eclipse.swt.widgets.ProgressBar; //导入方法依赖的package包/类
private void buildStatusBar(Composite parent) {
mStatusBar = new Composite(parent, SWT.NONE);
mStatusBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
FormLayout statusBarLayout = new FormLayout();
statusBarLayout.marginHeight = statusBarLayout.marginWidth = 2;
mStatusBar.setLayout(statusBarLayout);
mDeviceViewButton = new Button(mStatusBar, SWT.TOGGLE);
mDeviceViewButton.setImage(mDeviceViewImage);
mDeviceViewButton.setToolTipText("Switch to the window selection view");
mDeviceViewButton.addSelectionListener(deviceViewButtonSelectionListener);
FormData deviceViewButtonFormData = new FormData();
deviceViewButtonFormData.left = new FormAttachment();
mDeviceViewButton.setLayoutData(deviceViewButtonFormData);
mTreeViewButton = new Button(mStatusBar, SWT.TOGGLE);
mTreeViewButton.setImage(mTreeViewImage);
mTreeViewButton.setEnabled(false);
mTreeViewButton.setToolTipText("Switch to the tree view");
mTreeViewButton.addSelectionListener(treeViewButtonSelectionListener);
FormData treeViewButtonFormData = new FormData();
treeViewButtonFormData.left = new FormAttachment(mDeviceViewButton, 2);
mTreeViewButton.setLayoutData(treeViewButtonFormData);
mPixelPerfectButton = new Button(mStatusBar, SWT.TOGGLE);
mPixelPerfectButton.setImage(mPixelPerfectImage);
mPixelPerfectButton.setEnabled(false);
mPixelPerfectButton.setToolTipText("Switch to the pixel perfect view");
mPixelPerfectButton.addSelectionListener(pixelPerfectButtonSelectionListener);
FormData pixelPerfectButtonFormData = new FormData();
pixelPerfectButtonFormData.left = new FormAttachment(mTreeViewButton, 2);
mPixelPerfectButton.setLayoutData(pixelPerfectButtonFormData);
// Tree View control panel...
mTreeViewControls = new TreeViewControls(mStatusBar);
FormData treeViewControlsFormData = new FormData();
treeViewControlsFormData.left = new FormAttachment(mPixelPerfectButton, 2);
treeViewControlsFormData.top = new FormAttachment(mTreeViewButton, 0, SWT.CENTER);
treeViewControlsFormData.width = 552;
mTreeViewControls.setLayoutData(treeViewControlsFormData);
// Progress stuff
mProgressLabel = new Label(mStatusBar, SWT.RIGHT);
mProgressBar = new ProgressBar(mStatusBar, SWT.HORIZONTAL | SWT.INDETERMINATE | SWT.SMOOTH);
FormData progressBarFormData = new FormData();
progressBarFormData.right = new FormAttachment(100, 0);
progressBarFormData.top = new FormAttachment(mTreeViewButton, 0, SWT.CENTER);
mProgressBar.setLayoutData(progressBarFormData);
FormData progressLabelFormData = new FormData();
progressLabelFormData.right = new FormAttachment(mProgressBar, -2);
progressLabelFormData.top = new FormAttachment(mTreeViewButton, 0, SWT.CENTER);
mProgressLabel.setLayoutData(progressLabelFormData);
if (mProgressString == null) {
mProgressLabel.setVisible(false);
mProgressBar.setVisible(false);
} else {
mProgressLabel.setText(mProgressString);
}
}
示例6: createPartControl
import org.eclipse.swt.widgets.ProgressBar; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.makeColumnsEqualWidth = true;
layout.marginHeight = 0;
layout.marginWidth = 0;
container.setLayout(layout);
RowLayout rowLayout = new RowLayout();
rowLayout.spacing = 1;
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.FILL;
GridData progressLayout = new GridData();
progressLayout.horizontalAlignment=SWT.FILL;
progressBar=new ProgressBar(container, SWT.SMOOTH | SWT.HORIZONTAL);
progressBar.setVisible(false);
progressBar.setLayoutData(progressLayout);
progressBar.setMinimum(0);
try {
swtBrowser = new Browser(container, SWT.NONE);
swtBrowser.setLayoutData(gridData);
if(targetURL!=null && targetURL.length()>0) {
oldFocus=Display.getCurrent().getFocusControl();
swtBrowser.setUrl(targetURL);
if(oldFocus.isDisposed()==false) {
oldFocus.setFocus();
}
oldFocus=null;
}
progressListener=new BuildProgressListener(swtBrowser, progressBar);
swtBrowser.addProgressListener(progressListener);
} catch (SWTError error) {
if(progressListener!=null) {
swtBrowser.removeProgressListener(progressListener);
}
swtBrowser = null;
Label label = new Label(container, SWT.WRAP);
label.setText("SWT Browser control is not available. Please refer to: http://www.eclipse.org/swt/faq.php#whatisbrowser for more information.");
label.setLayoutData(gridData);
}
}