當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrolledComposite.addListener方法代碼示例

本文整理匯總了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--;
			}
		}
	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:PropertyDialogBuilder.java

示例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 );
}
 
開發者ID:rherrmann,項目名稱:eclipse-extras,代碼行數:9,代碼來源:ImageViewer.java

示例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();
	});
}
 
開發者ID:CollabThings,項目名稱:collabthings.swt,代碼行數:70,代碼來源:ObjectContextView.java

示例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();
		}
	});
}
 
開發者ID:CollabThings,項目名稱:collabthings.swt,代碼行數:65,代碼來源:SearchView.java

示例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();
		}
	});
}
 
開發者ID:CollabThings,項目名稱:collabthings.swt,代碼行數:65,代碼來源:UserSearchView.java


注:本文中的org.eclipse.swt.custom.ScrolledComposite.addListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。