本文整理匯總了Java中org.eclipse.swt.widgets.Combo.pack方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.pack方法的具體用法?Java Combo.pack怎麽用?Java Combo.pack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.pack方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
void init() {
// this.setLayout(new GridLayout(2, false));
this.setLayout(new FillLayout());
day = new Combo(this, SWT.READ_ONLY);
for (int i=1; i<=31; ++i)
day.add(""+i);
day.select(0);
day.pack();
// day.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
month = new Combo(this, SWT.READ_ONLY);
for (int i=1; i<=12; ++i)
month.add(""+i);
month.select(0);
month.pack();
// month.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
year = new StyledText(this, SWT.SINGLE | SWT.CENTER | SWT.LEFT | SWT.BORDER);
year.setText("2000");
// year.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
this.pack();
addListener();
}
示例2: createScheduleTimeSection
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Composite createScheduleTimeSection(final Composite parent) {
final Composite timeSection = new Composite(parent, SWT.NONE);
SWTUtil.gridLayout(timeSection, 2);
final TimeZone tz = TimeZone.getDefault();
final Locale locale = Locale.getDefault();
final Calendar now = new GregorianCalendar(tz, locale);
scheduleTimeCombo = new Combo(timeSection, SWT.READ_ONLY);
// List the day in 30 minute internals.
final Calendar time = Calendar.getInstance();
CalendarUtils.removeTime(time);
secondsAfterMidnight = new int[48];
for (int i = 0; i < 48; i++) {
scheduleTimeCombo.add(TIME_FORMAT.format(time.getTime()));
secondsAfterMidnight[i] = CalendarUtils.getSecondsSinceMidnight(time);
time.add(Calendar.MINUTE, 30);
}
// Select a default time (3am) using the same algorithm as
// Microsoft's client
setScheduleTimeAsSecondsAfterMidnight(10800);
scheduleTimeCombo.pack();
SWTUtil.createLabel(timeSection, tz.getDisplayName(tz.inDaylightTime(now.getTime()), TimeZone.LONG));
return timeSection;
}