本文整理匯總了Java中org.eclipse.swt.widgets.List.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java List.setFont方法的具體用法?Java List.setFont怎麽用?Java List.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.List
的用法示例。
在下文中一共展示了List.setFont方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createPopup
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
void createPopup(String[] items, int selectionIndex) {
// create shell and list
popup = new Shell (getShell(), SWT.NO_TRIM | SWT.ON_TOP);
int style = getStyle();
int listStyle = SWT.SINGLE | SWT.V_SCROLL;
if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
list = new List (popup, listStyle);
if (font != null) list.setFont(font);
if (foreground != null) list.setForeground(foreground);
if (background != null) list.setBackground(background);
int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
if (items != null) list.setItems(items);
if (selectionIndex != -1) list.setSelection(selectionIndex);
}
示例2: addMachineTab
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private static void addMachineTab(final String name) {
final CTabItem tabItem = new CTabItem(tabHandsetName, SWT.MULTI | SWT.V_SCROLL);
tabItem.setImage(new Image(display, ClassLoader
.getSystemResourceAsStream("icons/device.png")));
tabItem.setText(name);
listHandsets = new List(tabHandsetName, SWT.BORDER);
tabItem.setControl(listHandsets);
listHandsets.setFont(new Font(display, "宋體", 10, SWT.NONE));
listHandsets.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
if (event.detail == 0) {
//select handset
if (listHandsets.getSelectionIndex() >= 0) {
device = findDevices.getDevices()[listHandsets.getSelectionIndex()];
//get device node from tree
listHandsets.setMenu(null);
createHandsetRightClickRecord();
listHandsets.setMenu(handsetMenu);
}
}
}
});
//show it
tabHandsetName.setSelection(tabItem);
}
示例3: addRemoteHandsetsList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private static void addRemoteHandsetsList() {
final CTabItem cloudHandsetsTabItem = new CTabItem(tabHandsetName, SWT.V_SCROLL
| SWT.H_SCROLL);
cloudHandsetsTabItem.setText("雲端設備");
cloudHandsetsTabItem.setImage(new Image(display, ".\\icons\\view.png"));
cloudHandsetsList = new List(tabHandsetName, SWT.BORDER);
cloudHandsetsTabItem.setControl(cloudHandsetsList);
cloudHandsetsList.setFont(new Font(display, "宋體", 10, SWT.NONE));
//show it
}
示例4: createPopup
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
void createPopup(String[] items, int selectionIndex) {
// create shell and list
popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP);
int style = getStyle();
int listStyle = SWT.SINGLE | SWT.V_SCROLL;
if ((style & SWT.FLAT) != 0)
listStyle |= SWT.FLAT;
if ((style & SWT.RIGHT_TO_LEFT) != 0)
listStyle |= SWT.RIGHT_TO_LEFT;
if ((style & SWT.LEFT_TO_RIGHT) != 0)
listStyle |= SWT.LEFT_TO_RIGHT;
list = new List(popup, listStyle);
if (font != null)
list.setFont(font);
if (foreground != null)
list.setForeground(foreground);
if (background != null)
list.setBackground(background);
int[] popupEvents = { SWT.Close, SWT.Paint };
for (int i = 0; i < popupEvents.length; i++)
popup.addListener(popupEvents[i], listener);
int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse,
SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose };
for (int i = 0; i < listEvents.length; i++)
list.addListener(listEvents[i], listener);
if (items != null)
list.setItems(items);
if (selectionIndex != -1)
list.setSelection(selectionIndex);
}
示例5: createList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private List createList(Composite parent) {
List list = new List(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
list.setFont(parent.getFont());
list.addSelectionListener(getSelectionListener());
return list;
}
示例6: createPopup
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
void createPopup( String[] items, int selectionIndex )
{
// create shell and list
popup = new Shell( getShell( ), SWT.NO_TRIM | SWT.ON_TOP );
int style = getStyle( );
int listStyle = SWT.SINGLE | SWT.V_SCROLL;
if ( ( style & SWT.FLAT ) != 0 )
listStyle |= SWT.FLAT;
if ( ( style & SWT.RIGHT_TO_LEFT ) != 0 )
listStyle |= SWT.RIGHT_TO_LEFT;
if ( ( style & SWT.LEFT_TO_RIGHT ) != 0 )
listStyle |= SWT.LEFT_TO_RIGHT;
list = new List( popup, listStyle );
if ( font != null )
list.setFont( font );
if ( foreground != null )
list.setForeground( foreground );
if ( background != null )
list.setBackground( background );
int[] popupEvents = {
SWT.Close, SWT.Paint, SWT.Deactivate
};
for ( int i = 0; i < popupEvents.length; i++ )
popup.addListener( popupEvents[i], listener );
int[] listEvents = {
SWT.MouseUp,
SWT.Selection,
SWT.Traverse,
SWT.KeyDown,
SWT.KeyUp,
SWT.FocusIn,
SWT.Dispose
};
for ( int i = 0; i < listEvents.length; i++ )
list.addListener( listEvents[i], listener );
if ( items != null )
list.setItems( items );
if ( selectionIndex != -1 )
list.setSelection( selectionIndex );
}