本文整理了Java中org.eclipse.swt.widgets.DateTime.setTime()
方法的一些代码示例,展示了DateTime.setTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.setTime()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.DateTime
类名称:DateTime
方法名:setTime
[英]Sets the receiver's hours, minutes, and seconds in a single operation.
[中]在单个操作中设置接收器的小时、分钟和秒。
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding
@Override
protected void doSetValue(Object source, Object value) {
if (value == null) {
// ignore null, since it cannot be applied to the DateTimeWidget
return;
}
DateTime dateTime = (DateTime) source;
Calendar cal = (Calendar) calendar.get();
cal.setTime((Date) value);
if ((dateTime.getStyle() & SWT.TIME) != 0) {
dateTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal
.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
} else {
dateTime.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH));
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui
private void initializeValues() {
boolean enableBackground = schedule.isEnabled();
boolean hours = false;
enableBackgroundRefresh.setSelection(enableBackground);
long seconds = schedule.getRefreshInterval();
if(seconds <= 60) {
seconds = 60;
}
long minutes = seconds / 60;
if(minutes >= 60) {
minutes = minutes / 60;
hours = true;
}
hoursOrMinutes.select(hours ? 0 : 1);
timeInterval.setText(Long.toString(minutes));
repeatEvery.setSelection(!schedule.getRunOnce());
Date start = schedule.getRefreshStartTime();
Calendar cal = Calendar.getInstance();
if (start != null) {
cal.setTime(start);
startTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal
.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
} else {
startTime.setTime(0, 0, 0); // default to 00:00:00
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public void handleSetTime( DateTime dateTime, JsonObject properties ) {
JsonValue hoursValue = properties.get( PROP_HOURS );
JsonValue minutesValue = properties.get( PROP_MINUTES );
JsonValue secondsValue = properties.get( PROP_SECONDS );
if( hoursValue != null && minutesValue != null && secondsValue != null ) {
dateTime.setTime( hoursValue.asInt(), minutesValue.asInt(), secondsValue.asInt() );
}
}
内容来源于网络,如有侵权,请联系作者删除!