本文整理了Java中org.eclipse.swt.widgets.DateTime.setSeconds()
方法的一些代码示例,展示了DateTime.setSeconds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.setSeconds()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.DateTime
类名称:DateTime
方法名:setSeconds
[英]Sets the receiver's seconds.
Seconds is an integer between 0 and 59.
[中]设置接收器的秒数。
秒是介于0和59之间的整数。
代码示例来源:origin: org.xworker/xworker_swt
public static void setValue(ActionContext actionContext) throws ParseException{
Object value = actionContext.get("value");
Date timeValue = null;
if(value instanceof Date){
timeValue = (Date) value;
}else if(value == null){
timeValue = new Date(0);
}else{
value = value.toString();
if(value != ""){
SimpleDateFormat sf = new SimpleDateFormat((String) actionContext.get("pattern"));
timeValue = sf.parse(value.toString());
}
}
if(timeValue != null){
DateTime dt = (DateTime) actionContext.get("control");
GregorianCalendar c = new GregorianCalendar();
c.setTime(timeValue);
dt.setHours(c.get(Calendar.HOUR_OF_DAY));
dt.setMinutes(c.get(Calendar.MINUTE));
dt.setSeconds(c.get(Calendar.SECOND));
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Sets the receiver's hours, minutes, and seconds in a single operation.
*
* @param hours an integer between 0 and 23
* @param minutes an integer between 0 and 59
* @param seconds an integer between 0 and 59
*
* @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>
*
* @since 1.2
*/
public void setTime( int hours, int minutes, int seconds ) {
checkWidget();
if( checkTime( hours, minutes, seconds ) ) {
setHours( hours );
setMinutes( minutes );
setSeconds( seconds );
}
}
代码示例来源:origin: atdl4j/atdl4j
public void setValue(Comparable<DateTime> value)
{
// Convert to UTC time for UTCTimestampT and UTCTimeOnlyT.
// Performing UTCDateT and MonthYearT coversion could produce an unexpected result.
// No conversion is needed for LocalMktTimeT, TZTimestampT, and TZTimeOnlyT.
if ( parameter == null || parameter instanceof UTCTimestampT || parameter instanceof UTCTimeOnlyT )
{
logger.debug( "setValue() parameter: " + parameter + " value: " + value );
// -- no need to adjust DateTime --
}
// -- Force control to display time portion in local
DateTime tempLocalTzDateTime = ((DateTime)value).withZone( DateTimeZone.getDefault() );
if ( showMonthYear )
{
dateClock.setMonth( tempLocalTzDateTime.getMonthOfYear() - 1 );
dateClock.setYear( tempLocalTzDateTime.getYear() );
}
if ( showDay )
{
dateClock.setDay( tempLocalTzDateTime.getDayOfMonth() );
}
if ( showTime )
{
timeClock.setHours( tempLocalTzDateTime.getHourOfDay() );
timeClock.setMinutes( tempLocalTzDateTime.getMinuteOfHour() );
timeClock.setSeconds( tempLocalTzDateTime.getSecondOfMinute() );
}
}
代码示例来源:origin: org.xworker/xworker_swt
dateTime.setHours(calendar.get(Calendar.HOUR_OF_DAY));
dateTime.setMinutes(calendar.get(Calendar.MINUTE));
dateTime.setSeconds(calendar.get(Calendar.SECOND));
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
void readData( final DateTime dateTime ) {
String value = WidgetLCAUtil.readPropertyValue( dateTime, PROP_HOURS );
if( value != null ) {
dateTime.setHours( NumberFormatUtil.parseInt( value ) );
}
value = WidgetLCAUtil.readPropertyValue( dateTime, PROP_MINUTES );
if( value != null ) {
dateTime.setMinutes( NumberFormatUtil.parseInt( value ) );
}
value = WidgetLCAUtil.readPropertyValue( dateTime, PROP_SECONDS );
if( value != null ) {
dateTime.setSeconds( NumberFormatUtil.parseInt( value ) );
}
ControlLCAUtil.processSelection( dateTime, null, true );
ControlLCAUtil.processMouseEvents( dateTime );
ControlLCAUtil.processKeyEvents( dateTime );
ControlLCAUtil.processMenuDetect( dateTime );
WidgetLCAUtil.processHelp( dateTime );
}
内容来源于网络,如有侵权,请联系作者删除!