本文整理汇总了Java中org.eclipse.swt.custom.ScrolledComposite.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java ScrolledComposite.addListener方法的具体用法?Java ScrolledComposite.addListener怎么用?Java ScrolledComposite.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.ScrolledComposite
的用法示例。
在下文中一共展示了ScrolledComposite.addListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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--;
}
}
});
}
示例2: ImageViewer
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
public ImageViewer( Composite parent ) {
scrolledComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
scrolledComposite.setBackground( getBackgroundColor() );
imageLabel = new Label( scrolledComposite, SWT.NONE );
imageLabel.setBackground( getBackgroundColor() );
scrolledComposite.setContent( imageLabel );
scrolledComposite.addListener( SWT.Dispose, this::handleDispose );
}
示例3: ObjectContextView
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
/**
* Create the composite.
*
* @param parent
* @param style
*/
public ObjectContextView(CTApp app, AppWindow window, Composite parent, int style) {
super(parent, style);
this.app = app;
setLayout(new GridLayout(1, false));
ctools = new CTComposite(this, SWT.NONE);
ctools.setBackground(CTResourceManagerFactory.instance().getActiontitle2Background());
ctools.setForeground(CTResourceManagerFactory.instance().getActionTitle2Color());
GridLayout ctoolslayout = new GridLayout();
ctoolslayout.numColumns = 10;
ctools.setLayout(ctoolslayout);
ctools.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
CTLabel ltitle = new CTLabel(ctools, SWT.NONE);
scrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event arg0) {
updateLayout();
}
});
expandBar = new ExpandBar(scrolledComposite, SWT.NONE);
expandBar.setBackground(CTResourceManagerFactory.instance().getControlBg());
ExpandItem xpndtmUsedIn = new ExpandItem(expandBar, SWT.NONE);
xpndtmUsedIn.setExpanded(true);
xpndtmUsedIn.setText("Used in");
cusedin = new CTComposite(expandBar, SWT.NONE);
xpndtmUsedIn.setControl(cusedin);
xpndtmUsedIn.setHeight(xpndtmUsedIn.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
xpndtmProperties = new ExpandItem(expandBar, SWT.NONE);
xpndtmProperties.setExpanded(true);
xpndtmProperties.setText("Properties");
propertiesview = new ObjectViewer(app, window, expandBar);
xpndtmProperties.setControl(propertiesview);
xpndtmChildren = new ExpandItem(expandBar, SWT.NONE);
xpndtmChildren.setExpanded(true);
xpndtmChildren.setText("children");
createSubpartsTable();
scrolledComposite.setContent(expandBar);
scrolledComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
ltitle.setText("Tree");
ltitle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
propertiesview.addObjectChangeListener((e) -> {
updateLayout();
});
}
示例4: SearchView
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
public SearchView(Composite c, CTApp app, AppWindow appWindow, boolean hidesearchbox,
CTSearchResultFactory nfactory) {
super(c, SWT.NONE);
this.app = app;
this.window = appWindow;
this.factory = nfactory;
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginLeft = 0;
gridLayout.horizontalSpacing = 0;
gridLayout.verticalSpacing = 0;
this.setLayout(gridLayout);
if (!hidesearchbox) {
Composite composite = new CTComposite(this, SWT.NONE);
composite.setBackground(CTResourceManagerFactory.instance().getActiontitleBackground());
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
GridLayout clayout = new GridLayout(2, false);
clayout.marginLeft = 6;
clayout.marginRight = 6;
clayout.marginTop = 3;
clayout.marginBottom = 3;
composite.setLayout(clayout);
text = CTControls.getText(composite, SWT.BORDER);
text.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN) {
searchSelected();
}
}
});
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
CTButton bsearch = new CTButton(composite, SWT.NONE);
bsearch.addSelectionListener(() -> {
searchSelected();
});
bsearch.setText("Search");
}
scrolledComposite = new ScrolledComposite(this, SWT.NONE | SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
clist = new CTComposite(scrolledComposite, SWT.NONE);
clistlayout = new GridLayout();
clist.setLayout(clistlayout);
scrolledComposite.setContent(clist);
scrolledComposite.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event arg0) {
updateLayout();
}
});
}
示例5: UserSearchView
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
public UserSearchView(Composite c, CTApp app, AppWindow appWindow, boolean hidesearchbox,
CTUserSearchResultFactory nfactory) {
super(c, SWT.NONE);
this.app = app;
this.window = appWindow;
this.factory = nfactory;
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginLeft = 0;
gridLayout.horizontalSpacing = 0;
gridLayout.verticalSpacing = 0;
this.setLayout(gridLayout);
if (!hidesearchbox) {
Composite composite = new CTComposite(this, SWT.NONE);
composite.setBackground(CTResourceManagerFactory.instance().getActiontitleBackground());
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
GridLayout clayout = new GridLayout(2, false);
clayout.marginLeft = 6;
clayout.marginRight = 6;
clayout.marginTop = 3;
clayout.marginBottom = 3;
composite.setLayout(clayout);
text = CTControls.getText(composite, SWT.BORDER);
text.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN) {
searchSelected();
}
}
});
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
CTButton bsearch = new CTButton(composite, SWT.NONE);
bsearch.addSelectionListener(() -> {
searchSelected();
});
bsearch.setText("Search");
}
scrolledComposite = new ScrolledComposite(this, SWT.NONE | SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
clist = new CTComposite(scrolledComposite, SWT.NONE);
clistlayout = new GridLayout();
clist.setLayout(clistlayout);
scrolledComposite.setContent(clist);
scrolledComposite.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event arg0) {
updateLayout();
}
});
}