本文整理汇总了Java中org.eclipse.swt.custom.ScrolledComposite类的典型用法代码示例。如果您正苦于以下问题:Java ScrolledComposite类的具体用法?Java ScrolledComposite怎么用?Java ScrolledComposite使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScrolledComposite类属于org.eclipse.swt.custom包,在下文中一共展示了ScrolledComposite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFeatureListTab
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
private void createFeatureListTab(TabFolder tabFolder, ActiveTab type) {
TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
if (type == ActiveTab.ALL_FEATURES) {
tabItem.setText(ALL_FEATURES_TAB_TITLE);
} else {
tabItem.setText(UPDATES_TAB_TITLE);
}
ScrolledComposite scroll = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
scroll.setLayout(new GridLayout());
scroll.setLayoutData(new GridData());
Group group = new Group(scroll, SWT.NONE);
group.setLayout(new GridLayout());
group.setLayoutData(new GridData());
listFeatures(group, type);
scroll.setContent(group);
scroll.setExpandHorizontal(true);
scroll.setExpandVertical(true);
scroll.setMinSize(group.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tabItem.setControl(scroll);
}
示例2: DiskInfoTab
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
/**
* Create the DISK INFO tab.
*/
public DiskInfoTab(CTabFolder tabFolder, FormattedDisk[] disks) {
this.formattedDisks = disks;
CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL);
ctabitem.setText(textBundle.get("DiskInfoTab.Title")); //$NON-NLS-1$
tabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
getInfoTable().removeAll();
buildDiskInfoTable(getFormattedDisk(0)); // FIXME!
}
});
ScrolledComposite scrolledComposite = new ScrolledComposite(
tabFolder, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
ctabitem.setControl(scrolledComposite);
composite = new Composite(scrolledComposite, SWT.NONE);
createDiskInfoTable();
if (disks.length > 1) {
RowLayout layout = new RowLayout(SWT.VERTICAL);
layout.wrap = false;
composite.setLayout(layout);
for (int i=0; i<disks.length; i++) {
Label label = new Label(composite, SWT.NULL);
label.setText(disks[i].getDiskName());
buildDiskInfoTable(disks[i]);
}
} else {
composite.setLayout(new FillLayout());
buildDiskInfoTable(disks[0]);
}
composite.pack();
scrolledComposite.setContent(composite);
scrolledComposite.setMinSize(
composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
示例3: setupPagingInformation
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
/**
* Setup some sensible paging information.
*/
public static void setupPagingInformation(ScrolledComposite composite) {
GC gc = new GC(composite);
FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose();
int fontHeight = fontMetrics.getHeight();
int fontWidth = fontMetrics.getAverageCharWidth();
Rectangle clientArea = composite.getClientArea();
int lines = clientArea.height / fontHeight;
int pageHeight = lines * fontHeight;
int pageWidth = clientArea.width - fontWidth;
composite.getVerticalBar().setIncrement(fontHeight);
composite.getVerticalBar().setPageIncrement(pageHeight);
composite.getHorizontalBar().setIncrement(fontWidth);
composite.getHorizontalBar().setPageIncrement(pageWidth);
}
示例4: attachMouseScrollButtonListener
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
private void attachMouseScrollButtonListener(final ScrolledComposite scrolledComposite){
scrolledComposite.addListener(SWT.MouseWheel, new Listener() {
@Override
public void handleEvent(Event event) {
int wheelCount = event.count;
wheelCount = (int) Math.ceil(wheelCount / 3.0f);
while (wheelCount < 0) {
scrolledComposite.getVerticalBar().setIncrement(4);
wheelCount++;
}
while (wheelCount > 0) {
scrolledComposite.getVerticalBar().setIncrement(-4);
wheelCount--;
}
}
});
}
示例5: filterTree
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
protected void filterTree(TreeItem[] items, String text,
ArrayList<TreeItem> foundItems) {
text = text.toLowerCase();
for (int i = 0; i < items.length; i++) {
ensureSectionBuilt(items[i], false);
ScrolledComposite composite = (ScrolledComposite) items[i].getData("Panel");
if (text.length() > 0
&& (items[i].getText().toLowerCase().contains(text) || compositeHasText(
composite, text))) {
foundItems.add(items[i]);
ensureExpandedTo(items[i]);
items[i].setFont(filterFoundFont);
} else {
items[i].setFont(null);
}
filterTree(items[i].getItems(), text, foundItems);
}
}
示例6: setViewRequiresOneDownload
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
public static void setViewRequiresOneDownload(Composite genComposite) {
if (genComposite == null || genComposite.isDisposed()) {
return;
}
Utils.disposeComposite(genComposite, false);
Label lab = new Label(genComposite, SWT.NULL);
GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
gridData.verticalIndent = 10;
lab.setLayoutData(gridData);
Messages.setLanguageText(lab, "view.one.download.only");
genComposite.layout(true);
Composite parent = genComposite.getParent();
if (parent instanceof ScrolledComposite) {
ScrolledComposite scrolled_comp = (ScrolledComposite) parent;
Rectangle r = scrolled_comp.getClientArea();
scrolled_comp.setMinSize(genComposite.computeSize(r.width, SWT.DEFAULT ));
}
}
示例7: NotesCheckinControl
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
protected NotesCheckinControl(final Composite parent, final int style, final CheckinControlOptions options) {
super(parent, style, Messages.getString("NotesCheckinControl.Title"), CheckinSubControlType.CHECKIN_NOTES); //$NON-NLS-1$
this.options = options;
final FillLayout layout = new FillLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
setLayout(layout);
final int rootStyle = options.isForDialog() ? SWT.BORDER : SWT.NONE;
rootComposite = new ScrolledComposite(this, SWT.V_SCROLL | rootStyle);
rootComposite.setLayout(new FillLayout());
rootComposite.setExpandHorizontal(true);
rootComposite.setExpandVertical(true);
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(final DisposeEvent e) {
if (pendingCheckin != null) {
pendingCheckin.getPendingChanges().removeAffectedTeamProjectsChangedListener(teamProjectsListener);
}
}
});
}
示例8: getLayoutChangedHandler
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
private Runnable getLayoutChangedHandler() {
return new Runnable() {
@Override
public void run() {
// resize the page to work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=265237
Composite parent = getActivePanel().getParent();
while (parent != null) {
if (parent instanceof ScrolledComposite) {
ScrolledComposite scrolledComposite = (ScrolledComposite) parent;
scrolledComposite.setMinSize(getActivePanel().getParent().computeSize(SWT.DEFAULT, SWT.DEFAULT));
getActivePanel().layout();
return;
}
parent = parent.getParent();
}
}
};
}
示例9: FXCanvasScrollApp
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
protected FXCanvasScrollApp() {
shell = new Shell();
shell.setText(this.getClass().getSimpleName());
shell.setLayout(new FillLayout());
ScrolledComposite scrollPane = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
FXCanvas fxCanvas = new FXCanvas(scrollPane, SWT.BORDER);
fxCanvas.setScene(createScene(SCROLL_CONTAINER_ID));
scrollPane.setContent(fxCanvas);
scrollPane.setExpandHorizontal(true);
scrollPane.setExpandVertical(true);
fxCanvas.pack();
scrollPane.setMinSize(fxCanvas.getSize());
shell.pack();
Monitor monitor = shell.getMonitor();
Rectangle monitorRect = monitor.getClientArea();
Rectangle shellRect = shell.getBounds();
shellRect.x = Math.max(0, (monitorRect.width - shellRect.width) / 2);
shellRect.y = Math.max(0, (monitorRect.height - shellRect.height) / 2);
shell.setBounds(shellRect);
shell.open();
}
示例10: handleRemoveButtonClick
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
private void handleRemoveButtonClick(SelectionEvent event) {
Button btnThis = (Button) event.getSource();
Composite parent = btnThis.getParent();
Control[] children = parent.getChildren();
if (children != null) {
for (int i = 0; i < children.length; i++) {
if (children[i].equals(btnThis) && i - 1 > 0) {
Group group = (Group) children[i - 1];
Control[] childrenOfGroup = group.getChildren();
Label number = (Label) childrenOfGroup[0];
Integer intNumber = Integer.parseInt(number.getText());
nodeMap.remove(intNumber);
children[i - 1].dispose();
children[i].dispose();
redraw();
break;
}
}
}
innerContainer.setSize(innerContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
((ScrolledComposite) cmpMain).setMinSize(innerContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
updatePageCompleteStatus();
}
示例11: setSize
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
private void setSize(Composite composite) {
if (composite != null) {
// Note: The font is set here in anticipation that the class
// inheriting
// this base class may add widgets to the dialog. setSize
// is assumed to be called just before we go live.
applyDialogFont(composite);
Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
composite.setSize(minSize);
// set scrollbar composite's min size so page is expandable but
// has scrollbars when needed
if (composite.getParent() instanceof ScrolledComposite) {
ScrolledComposite sc1 = (ScrolledComposite) composite.getParent();
sc1.setMinSize(minSize);
sc1.setExpandHorizontal(true);
sc1.setExpandVertical(true);
}
}
}
示例12: setSize
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
private void setSize(Composite composite) {
if (composite != null) {
// Note: The font is set here in anticipation that the class inheriting
// this base class may add widgets to the dialog. setSize
// is assumed to be called just before we go live.
applyDialogFont(composite);
Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
composite.setSize(minSize);
// set scrollbar composite's min size so page is expandable but
// has scrollbars when needed
if (composite.getParent() instanceof ScrolledComposite) {
ScrolledComposite sc1 = (ScrolledComposite) composite.getParent();
sc1.setMinSize(minSize);
sc1.setExpandHorizontal(true);
sc1.setExpandVertical(true);
}
}
}
示例13: LayoutGeneral
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
/**
* Creates the Complete General Tab
* @param parent The Parent Folder
* @param meta The Meta Include for this Project
* @param props The PropsUI from the Kettle Project
* @param fieldNames The FieldNames from the Previous Step
*/
public LayoutGeneral(final CTabFolder parent, ARXPluginMeta meta, final PropsUI props, String[] fieldNames) {
this.meta = meta;
this.props = props;
this.fieldNames = fieldNames;
composites = new LayoutCompositeInterface[2];
CTabItem tabGeneral = new CTabItem(parent, SWT.NONE);
tabGeneral.setText(Resources.getMessage("General.2"));
ScrolledComposite scroller = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
this.build(scroller);
tabGeneral.setControl(scroller);
{
}
}
示例14: reattachWidget
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
private void reattachWidget(Position pos) {
SashForm sf = positionSashFormMap.get(pos);
ScrolledComposite w = widgets.get(pos);
if (w.getParent() == sf) // already attached to SashForm -> do nothing!
return;
w.setParent(sf); // set parent to SashForm again
// move to left or right side of SashForm depending on flag in position:
if (pos.isLeftSideOfSashForm)
w.moveAbove(null);
else
w.moveBelow(null);
sf.layout(true);
}
示例15: createPartControl
import org.eclipse.swt.custom.ScrolledComposite; //导入依赖的package包/类
@Override
public void createPartControl(final Composite parent) {
try {
final Composite outer = toolkit.createComposite(parent, SWT.NONE);
final GridLayout layout = new GridLayout(1, false);
layout.marginHeight = layout.marginWidth = 0;
outer.setLayout(layout);
final GridData layoutData = new GridData(GridData.FILL_BOTH);
outer.setLayoutData(layoutData);
createValidationComposite(outer);
final ScrolledComposite content = new ScrolledComposite(outer, SWT.H_SCROLL | SWT.V_SCROLL);
content.setExpandHorizontal(true);
content.setExpandVertical(true);
content.setLayout(layout);
content.setLayoutData(layoutData);
final Composite children = initUi(content);
content.setMinSize(children.computeSize(SWT.DEFAULT, SWT.DEFAULT));
content.setContent(children);
createBinding();
additionalTasks();
} catch (final ConnectException e) {
handle(e);
}
}