本文整理了Java中org.eclipse.swt.widgets.List.setScrollWidth()
方法的一些代码示例,展示了List.setScrollWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.setScrollWidth()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.List
类名称:List
方法名:setScrollWidth
暂无
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void remove (int index, boolean fixScroll) {
if (index != itemCount - 1) fixSelection (index, false);
System.arraycopy (items, index + 1, items, index, --itemCount - index);
items [itemCount] = null;
updateRowCount();
if (fixScroll) setScrollWidth();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
@Override
public void setFont (Font font) {
checkWidget ();
super.setFont (font);
if ((style & SWT.H_SCROLL) != 0) setScrollWidth ();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void setScrollWidth (int newWidth, boolean grow) {
newWidth += INSET;
int width = (int)/*64*/OS.SendMessage (handle, OS.LB_GETHORIZONTALEXTENT, 0, 0);
if (grow) {
if (newWidth <= width) return;
OS.SendMessage (handle, OS.LB_SETHORIZONTALEXTENT, newWidth, 0);
} else {
if (newWidth < width) return;
setScrollWidth ();
}
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Removes all of the items from the receiver.
* <p>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void removeAll () {
checkWidget();
items = new String [4];
itemCount = 0;
updateRowCount();
setScrollWidth();
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Adds the argument to the end of the receiver's list.
*
* @param string the new item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #add(String,int)
*/
public void add (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
if (itemCount == items.length) {
String [] newItems = new String [itemCount + 4];
System.arraycopy (items, 0, newItems, 0, items.length);
items = newItems;
}
items [itemCount++] = string;
updateRowCount();
setScrollWidth(string);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void setFont (NSFont font) {
super.setFont (font);
double /*float*/ ascent = font.ascender ();
double /*float*/ descent = -font.descender () + font.leading ();
((NSTableView)view).setRowHeight ((int)Math.ceil (ascent + descent) + 1);
setScrollWidth();
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Removes the items from the receiver which are
* between the given zero-relative start and end
* indices (inclusive).
*
* @param start the start of the range
* @param end the end of the range
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void remove (int start, int end) {
checkWidget();
if (start > end) return;
if (!(0 <= start && start <= end && end < itemCount)) {
error (SWT.ERROR_INVALID_RANGE);
}
int length = end - start + 1;
for (int i=0; i<length; i++) remove (start, false);
setScrollWidth();
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Sets the receiver's items to be the given array of items.
*
* @param items the array of items
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the items array is null</li>
* <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setItems (String [] items) {
checkWidget();
if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
for (int i=0; i<items.length; i++) {
if (items [i] == null) error (SWT.ERROR_INVALID_ARGUMENT);
}
this.items = new String [items.length];
System.arraycopy (items, 0, this.items, 0, items.length);
itemCount = items.length;
((NSTableView)view).reloadData();
setScrollWidth();
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
updateRowCount();
if (index != itemCount) fixSelection (index, true);
setScrollWidth(string);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void setScrollWidth (TCHAR buffer, boolean grow) {
RECT rect = new RECT ();
int /*long*/ newFont, oldFont = 0;
int /*long*/ hDC = OS.GetDC (handle);
newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
OS.DrawText (hDC, buffer, -1, rect, flags);
if (newFont != 0) OS.SelectObject (hDC, oldFont);
OS.ReleaseDC (handle, hDC);
setScrollWidth (rect.right - rect.left, grow);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
setScrollWidth();
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Sets the text of the item in the receiver's list at the given
* zero-relative index to the string argument.
*
* @param index the index for the item
* @param string the new text for the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setItem (int index, String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE);
items [index] = string;
NSTableView tableView = (NSTableView)view;
NSRect rect = tableView.rectOfRow (index);
tableView.setNeedsDisplayInRect (rect);
setScrollWidth(string);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Adds the argument to the end of the receiver's list.
* <p>
* Note: If control characters like '\n', '\t' etc. are used
* in the string, then the behavior is platform dependent.
* </p>
* @param string the new item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #add(String,int)
*/
public void add (String string) {
checkWidget ();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
TCHAR buffer = new TCHAR (getCodePage (), string, true);
int result = (int)/*64*/OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer);
if (result == OS.LB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED);
if (result == OS.LB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED);
if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, true);
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, true);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
if (newFont != 0) OS.SelectObject (hDC, oldFont);
OS.ReleaseDC (handle, hDC);
setScrollWidth (newWidth, false);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
if (newFont != 0) OS.SelectObject (hDC, oldFont);
OS.ReleaseDC (handle, hDC);
setScrollWidth (newWidth, false);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
error (SWT.ERROR_INVALID_RANGE);
if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, false);
if (index < topIndex) {
topIndex -= 1;
内容来源于网络,如有侵权,请联系作者删除!