本文整理匯總了Java中org.eclipse.swt.widgets.DateTime.getDay方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.getDay方法的具體用法?Java DateTime.getDay怎麽用?Java DateTime.getDay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.DateTime
的用法示例。
在下文中一共展示了DateTime.getDay方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAbsoluteDate
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
public static AbsoluteDate getAbsoluteDate(DateTime date, DateTime time)
{
int year = date.getYear();
int month = date.getMonth() + 1;
int day = date.getDay();
int hours = time.getHours();
int minutes = time.getMinutes();
int seconds = time.getSeconds();
return new AbsoluteDate(year, month, day, hours, minutes, seconds, utc);
}
示例2: validate
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@Override
public void validate(Control control) throws ValidationException {
if (control.isDisposed()) {
return;
}
String fieldValue = null;
if (control instanceof Text) {
fieldValue = ((Text) control).getText();
} else if (control instanceof CCombo) {
fieldValue = ((CCombo) control).getText();
} else if (control instanceof DateTime) {
// create an unformatted date containing all of the fields
boolean fieldSet = false;
DateTime dateTime = (DateTime) control;
if (dateTime.getYear() != 0) {
fieldSet = true;
} else if (dateTime.getMonth() != 0) {
fieldSet = true;
} else if (dateTime.getDay() != 0) {
fieldSet = true;
} else if (dateTime.getHours() != 0) {
fieldSet = true;
} else if (dateTime.getMinutes() != 0) {
fieldSet = true;
} else if (dateTime.getSeconds() != 0) {
fieldSet = true;
}
if (fieldSet) {
fieldValue = "dummyValue";
}
}
if (fieldValue != null) {
if ("".equals(fieldValue)) {
throw new ValidationException("This field is required");
}
} else {
throw new ValidationException("The value provided must be of type string from a supported control");
}
}