本文整理汇总了Java中org.eclipse.swt.widgets.ScrollBar.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollBar.getSize方法的具体用法?Java ScrollBar.getSize怎么用?Java ScrollBar.getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.ScrollBar
的用法示例。
在下文中一共展示了ScrollBar.getSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeTrim
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private int computeTrim(Rectangle area, Table table, int tableWidth) {
Point preferredSize= computeTableSize(table, area.width, area.height);
int trim;
if (tableWidth > 1) {
trim= tableWidth - table.getClientArea().width;
} else {
// initially, the table has no extend and no client area - use the border with
// plus some padding as educated guess
trim= 2 * table.getBorderWidth() + 1 ;
}
if (preferredSize.y > area.height) {
// Subtract the scrollbar width from the total column width
// if a vertical scrollbar will be required, but is not currently showing
// (in which case it is already subtracted above)
ScrollBar vBar= table.getVerticalBar();
if (!vBar.isVisible()) {
Point vBarSize= vBar.getSize();
trim += vBarSize.x;
}
}
return trim;
}
示例2: needHScroll
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
boolean needHScroll(Rectangle contentRect, boolean vVisible) {
ScrollBar hBar = getHorizontalBar();
if (hBar == null)
return false;
Rectangle hostRect = getBounds();
int border = getBorderWidth();
hostRect.width -= 2 * border;
ScrollBar vBar = getVerticalBar();
if (vVisible && vBar != null)
hostRect.width -= vBar.getSize().x;
if (!expandHorizontal && contentRect.width > hostRect.width)
return true;
if (expandHorizontal && minWidth > hostRect.width)
return true;
return false;
}
示例3: needVScroll
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
boolean needVScroll(Rectangle contentRect, boolean hVisible) {
ScrollBar vBar = getVerticalBar();
if (vBar == null)
return false;
Rectangle hostRect = getBounds();
int border = getBorderWidth();
hostRect.height -= 2 * border;
ScrollBar hBar = getHorizontalBar();
if (hVisible && hBar != null)
hostRect.height -= hBar.getSize().y;
if (!expandVertical && contentRect.height > hostRect.height)
return true;
if (expandVertical && minHeight > hostRect.height)
return true;
return false;
}
示例4: createListViewer
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private void createListViewer(Composite editorComposite) {
fListViewer = new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER);
fListViewer.setLabelProvider(new ColorListLabelProvider());
fListViewer.setContentProvider(new ColorListContentProvider());
GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true);
gd.heightHint = convertHeightInCharsToPixels(26);
int maxWidth = 0;
for (Iterator<List<HighlightingColorListItem>> it = content.values().iterator(); it.hasNext();) {
for (Iterator<HighlightingColorListItem> j = it.next().iterator(); j.hasNext();) {
HighlightingColorListItem item = j.next();
maxWidth = Math.max(maxWidth, convertWidthInCharsToPixels(item.getDisplayName().length()));
}
}
ScrollBar vBar = ((Scrollable) fListViewer.getControl()).getVerticalBar();
if (vBar != null) {
// scrollbars and tree indentation guess
maxWidth += vBar.getSize().x * 3;
}
gd.widthHint = maxWidth;
fListViewer.getControl().setLayoutData(gd);
fListViewer.setInput(content);
fListViewer.setSelection(new StructuredSelection(content.values().iterator().next()));
fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
handleSyntaxColorListSelection();
}
});
}
示例5: handleBodyResize
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
protected void handleBodyResize() {
int availableWidth = subForm.getSize().x;
final ScrollBar verticalScrollBar = subForm.getVerticalBar();
if (verticalScrollBar != null && verticalScrollBar.isVisible()) {
availableWidth -= verticalScrollBar.getSize().x;
}
final TeamExplorerResizeEventArg arg = new TeamExplorerResizeEventArg(availableWidth);
context.getEvents().notifyListener(TeamExplorerEvents.FORM_RESIZED, arg);
subForm.layout(true, true);
subForm.reflow(true);
}
示例6: computeMaximumWidthOfAllColumns
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private int computeMaximumWidthOfAllColumns()
{
ScrollBar vBar = tree.getVerticalBar();
boolean scrollBarShown = vBar.isVisible();
return comp.getClientArea().width - tree.getBorderWidth() - tree.getColumnCount() * tree.getGridLineWidth()
- ((scrollBarShown) ? vBar.getSize().x : 0);
}
示例7: hasHScroll
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private boolean hasHScroll(int w, boolean visible) {
if (getHorizontalBar() == null)
return false;
Rectangle b = getBounds();
b.width -= 2 * getBorderWidth();
ScrollBar vBar = getVerticalBar();
if (visible && vBar != null)
b.width -= vBar.getSize().x;
return w > b.width;
}
示例8: hasVScroll
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private boolean hasVScroll(int h, boolean visible) {
if (getVerticalBar() == null)
return false;
Rectangle b = getBounds();
b.height -= 2 * getBorderWidth();
ScrollBar hBar = getHorizontalBar();
if (visible && hBar != null)
b.height -= hBar.getSize().y;
return h > b.height;
}
示例9: onResizeTabInfo
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private void onResizeTabInfo() {
// horizontal scroll bar ishidden, only the vertical scrollbar can be displayed
int infoContainerWidth = _tab4Container.getBounds().width;
final ScrollBar vertBar = _tab4Container.getVerticalBar();
if (vertBar != null) {
// vertical bar is displayed
infoContainerWidth -= vertBar.getSize().x;
}
final Point minSize = _infoContainer.computeSize(infoContainerWidth, SWT.DEFAULT);
_tab4Container.setMinSize(minSize);
}
示例10: calcMinSize
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private Point calcMinSize() {
if (isLineWrap) {
final ScrollBar bar = scrolledComposite.getVerticalBar();
int verticalSize = 0;
if (bar != null) {
verticalSize = bar.getSize().x + 10;
}
return textArea.computeSize(scrolledComposite.getSize().x - verticalSize, SWT.DEFAULT, false);
}
else {
return textArea.computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
}
}
示例11: layout
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
* Our layout performs these jobs:
* 1. compute the width that is needed to display the amount of days in the plan
* 2. update the horizontal scroll bar to match the new width
* 3. resize the children to fit their contents
*/
@Override
protected void layout(Composite composite, boolean flushCache) {
if (inLayout) {
return;
}
DaysComposite sc = (DaysComposite)composite;
ScrollBar hBar = sc.getHorizontalBar();
int compositeHeight = sc.getSize().y;
int scrollBarHeight = hBar.getSize().y;
if (scrollBarHeight >= compositeHeight) {
// the view is so short that only the horizontal bar can be seen
return;
}
try {
inLayout = true;
int childHeight = compositeHeight - scrollBarHeight;
int clientWidth = sc.getClientArea().width;
int contentWidth;
int childWidth = DEFAULT_WIDTH;
Control[] children = composite.getChildren();
if (children.length == 0) {
contentWidth = clientWidth;
} else {
Control representative = children[0];
Point size = representative.computeSize(SWT.DEFAULT, childHeight, flushCache);
childWidth = size.x;
contentWidth = Math.max(dayCount * childWidth, clientWidth);
}
hBar.setMaximum (contentWidth);
hBar.setThumb (Math.min (contentWidth, clientWidth));
for (Control child : children) {
child.setSize(childWidth, childHeight);
}
} finally {
inLayout = false;
}
}
示例12: getVerticalScrollBarWidth
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
* Returns the vertical scroll bar width.
*
* @return Width
*/
protected int getVerticalScrollBarWidth() {
int width = 0;
ScrollBar scrollBar = getVerticalBar();
if (scrollBar != null) {
width = scrollBar.getSize().x;
}
return width;
}
示例13: getHorizontalScrollBarHeight
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
* Returns the horizontal scroll bar height.
*
* @return Height
*/
protected int getHorizontalScrollBarHeight() {
int height = 0;
ScrollBar scrollBar = getHorizontalBar();
if (scrollBar != null) {
height = scrollBar.getSize().y;
}
return height;
}
示例14: updateColumnWidth
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
public void updateColumnWidth()
{
int hw = getSize().x;
ScrollBar sb = getVerticalBar();
if ( sb != null && sb.isVisible() )
hw -= sb.getSize().x;
hw /= 2;
hw -= getBorderWidth();
colStat.setWidth( hw );
colValue.setWidth( hw );
layout();
}
示例15: layout
import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
protected void layout(Composite composite, boolean flushCache) {
if (inLayout)
return;
ScrolledComposite sc = (ScrolledComposite) composite;
if (sc.content == null)
return;
ScrollBar hBar = sc.getHorizontalBar();
ScrollBar vBar = sc.getVerticalBar();
if (hBar != null) {
if (hBar.getSize().y >= sc.getSize().y) {
return;
}
}
if (vBar != null) {
if (vBar.getSize().x >= sc.getSize().x) {
return;
}
}
inLayout = true;
Rectangle contentRect = sc.content.getBounds();
if (!sc.alwaysShowScroll) {
boolean hVisible = sc.needHScroll(contentRect, false);
boolean vVisible = sc.needVScroll(contentRect, hVisible);
if (!hVisible && vVisible)
hVisible = sc.needHScroll(contentRect, vVisible);
if (hBar != null)
hBar.setVisible(hVisible);
if (vBar != null)
vBar.setVisible(vVisible);
}
Rectangle hostRect = sc.getClientArea();
if (sc.expandHorizontal) {
contentRect.width = Math.max(sc.minWidth, hostRect.width);
}
if (sc.expandVertical) {
contentRect.height = Math.max(sc.minHeight, hostRect.height);
}
if (hBar != null) {
hBar.setMaximum(contentRect.width);
hBar.setThumb(Math.min(contentRect.width, hostRect.width));
int hPage = contentRect.width - hostRect.width;
int hSelection = hBar.getSelection();
if (hSelection >= hPage) {
if (hPage <= 0) {
hSelection = 0;
hBar.setSelection(0);
}
contentRect.x = -hSelection;
}
}
if (vBar != null) {
vBar.setMaximum(contentRect.height);
vBar.setThumb(Math.min(contentRect.height, hostRect.height));
int vPage = contentRect.height - hostRect.height;
int vSelection = vBar.getSelection();
if (vSelection >= vPage) {
if (vPage <= 0) {
vSelection = 0;
vBar.setSelection(0);
}
contentRect.y = -vSelection;
}
}
sc.content.setBounds(contentRect);
inLayout = false;
}