本文整理匯總了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);
}