本文整理汇总了Java中org.eclipse.swt.custom.ScrolledComposite.getClientArea方法的典型用法代码示例。如果您正苦于以下问题:Java ScrolledComposite.getClientArea方法的具体用法?Java ScrolledComposite.getClientArea怎么用?Java ScrolledComposite.getClientArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.ScrolledComposite
的用法示例。
在下文中一共展示了ScrolledComposite.getClientArea方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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 ));
}
}
示例3: updateScrolledComposite
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
public static void updateScrolledComposite(ScrolledComposite sc) {
Control content = sc.getContent();
if (content != null && !content.isDisposed()) {
Rectangle r = sc.getClientArea();
sc.setMinSize(content.computeSize(r.width, SWT.DEFAULT ));
}
}
示例4: computeSize
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
private Point computeSize(Control child, int wHint, int hHint) {
Object layoutData = child.getLayoutData();
if (layoutData instanceof TimelineLayoutData) {
TimelineLayoutData data = (TimelineLayoutData) layoutData;
if (data.maximized) {
ScrolledComposite parent = (ScrolledComposite) child.getParent().getParent();
Rectangle a = parent.getClientArea();
return new Point(a.width, a.height - 2);
}
if (data != null && data.preferredSize != null) {
return data.preferredSize;
}
}
return child.computeSize(wHint, hHint, true);
}
示例5: updatePageIncrement
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
/**
* Updates the page scroll increment for given composite.
*
* @param scomp
*/
public static void updatePageIncrement( ScrolledComposite scomp )
{
ScrollBar vbar = scomp.getVerticalBar( );
if ( vbar != null )
{
Rectangle clientArea = scomp.getClientArea( );
int increment = clientArea.height - 5;
vbar.setPageIncrement( increment );
}
}
示例6: postConstruct
import org.eclipse.swt.custom.ScrolledComposite; //导入方法依赖的package包/类
@PostConstruct
public void postConstruct(Composite parent) {
GridLayout gl_parent = new GridLayout(1, false);
gl_parent.verticalSpacing = 0;
gl_parent.marginWidth = 0;
gl_parent.marginHeight = 0;
gl_parent.horizontalSpacing = 0;
parent.setLayout(gl_parent);
part = partService
.findPart("org.bbaw.bts.ui.corpus.part.AnnotationsPart");
resizeListener = new Listener() {
@Override
public void handleEvent(
org.eclipse.swt.widgets.Event event) {
Rectangle r = scrollComposite
.getClientArea();
composite.layout();
scrollComposite.setMinSize(composite
.computeSize(r.width, SWT.DEFAULT));
}
};
selectionListener = new Listener() {
@Override
public void handleEvent(
org.eclipse.swt.widgets.Event event) {
RelatedObjectGroup roGroup = (RelatedObjectGroup) event.widget;
selfselection = true;
setSelectedInternal(new Vector<>(Arrays.asList(roGroup)), true);
selfselection = false;
}
};
scrollComposite = new ScrolledComposite(parent,
SWT.V_SCROLL | SWT.H_SCROLL);
scrollComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
scrollComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
scrollComposite.setMinWidth(100);
scrollComposite.setMinHeight(400);
composite = new Composite(scrollComposite, SWT.BORDER);
scrollComposite.setExpandHorizontal(true);
scrollComposite.setExpandVertical(true);
scrollComposite.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
Rectangle r = scrollComposite.getClientArea();
scrollComposite.setMinSize(composite.computeSize(r.width,
SWT.DEFAULT));
}
});
composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
composite.setLayout(new GridLayout(1, false));
((GridLayout)composite.getLayout()).marginHeight = 0;
((GridLayout)composite.getLayout()).marginWidth = 0;
((GridLayout)composite.getLayout()).verticalSpacing = 0;
// populate extended annotation filter menu and initialize context node
extendAnnotationsFilterMenu();
scrollComposite.setContent(composite);
constructed = true;
// request input from text editor
eventBroker.post(BTSUIConstants.EVENT_EGY_TEXT_EDITOR_INPUT_REQUESTED+"annotations_part", relatingObjectsEvent);
}