當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTime.setTime方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.DateTime.setTime方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.setTime方法的具體用法?Java DateTime.setTime怎麽用?Java DateTime.setTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.DateTime的用法示例。


在下文中一共展示了DateTime.setTime方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createArea

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
protected void createArea(Composite parent) {
	Composite area = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(2, true);
	layout.marginWidth = 10;
	layout.horizontalSpacing = 10;
	area.setLayout(layout);
	area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	Label label = new Label(area, SWT.LEFT);
	label.setText("Set the build start time and interval days:");
	label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	
	time = new DateTime(area, SWT.TIME);
	time.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND));
	time.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	
	interval = new Combo(area, SWT.DROP_DOWN | SWT.BORDER);
	for(int i = 1; i <= 14; ++i)
		interval.add(String.valueOf(i));
	interval.select(intervalDays - 1);
	interval.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}
 
開發者ID:AlexWengh,項目名稱:HMM,代碼行數:23,代碼來源:TimeScheduleDialog.java

示例2: construct

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@Override
public Control construct(Composite parent) {
	// TODO Auto-generated method stub
	Composite composite = new Composite(parent, SWT.NONE);
	GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
			.grab(true, true).applyTo(composite);
	GridLayoutFactory.swtDefaults().numColumns(1).applyTo(composite);
	
	DateTime time = new DateTime(composite, SWT.TIME);
	time.setTime(11, 22, 33);
	
	
	DateTime time2 = new DateTime(composite, SWT.TIME|SWT.SHORT);
	time2.setTime(11, 22, 33);
			
	DateTime time3 = new DateTime(composite, SWT.TIME|SWT.LONG);
	time3.setTime(11, 22, 33);
	
	
	DateTime time4 = new DateTime(composite, SWT.TIME|SWT.MEDIUM);
	time4.setTime(11, 22, 33);
	time4.setEnabled(false);
	
			
	return null;
}
 
開發者ID:xored,項目名稱:q7.quality.mockups,代碼行數:27,代碼來源:Time.java

示例3: createCalendarArea

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
private Composite createCalendarArea(Composite parent){
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout gd = new GridLayout(1, false);
	gd.marginLeft = 2; // SWT BUG 
	composite.setLayout(gd);
	dateSelection = new DateTime(composite, SWT.CALENDAR);
	dateSelection.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
	Composite dateComposite = new Composite(composite, SWT.NONE);
	dateComposite.setLayout(new GridLayout(2, true));
	dateComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	Label label = new Label(dateComposite, SWT.NONE);
	label.setText("Zeitpunkt");
	label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
	
	timeSelection = new DateTime(dateComposite, SWT.TIME);
	timeSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	timeSelection.setTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE),
		date.get(Calendar.SECOND));
	dateSelection.setDate(date.get(Calendar.YEAR), date.get(Calendar.MONTH),
		date.get(Calendar.DAY_OF_MONTH));
	
	getShell().setText(Messages.DateTimeSelectorDialog_enterDate); //$NON-NLS-1$
	return composite;
}
 
開發者ID:elexis,項目名稱:elexis-3-core,代碼行數:25,代碼來源:DateTimeSelectorDialog.java

示例4: createDefaultArea

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
private Composite createDefaultArea(Composite parent){
	Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	Label label = new Label(composite, SWT.NONE);
	label.setText("Zeitpunkt");
	label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
	Composite dateComposite = new Composite(composite, SWT.NONE);
	dateComposite.setLayout(new GridLayout(2, true));
	dateComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	timeSelection = new DateTime(dateComposite, SWT.TIME);
	timeSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	dateSelection = new DateTime(dateComposite, SWT.CALENDAR);
	dateSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	timeSelection.setTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE),
		date.get(Calendar.SECOND));
	dateSelection.setDate(date.get(Calendar.YEAR), date.get(Calendar.MONTH),
		date.get(Calendar.DAY_OF_MONTH));

	getShell().setText(Messages.DateTimeSelectorDialog_enterDate); //$NON-NLS-1$
	return composite;
}
 
開發者ID:elexis,項目名稱:elexis-3-core,代碼行數:23,代碼來源:DateTimeSelectorDialog.java

示例5: createDialogArea

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
	// create a composite with standard margins and spacing
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(2, false);
	layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	composite.setLayout(layout);
	composite.setLayoutData(new GridData(GridData.FILL_BOTH));
	applyDialogFont(composite);
	
	if (showTime){
		Label timeLbl = new Label(composite, SWT.NULL);
		timeLbl.setText("Time:");
		time = new DateTime(composite, SWT.TIME);
		if (currentValue!= null){
			time.setTime(currentValue.get(Calendar.HOUR_OF_DAY),
					currentValue.get(Calendar.MINUTE),
					currentValue.get(Calendar.SECOND));
		}
	}
	
	if (showDate){
		Label dateLbl = new Label(composite, SWT.NULL);
		dateLbl.setText("Date:");
		date = new DateTime(composite, SWT.CALENDAR);
		if (currentValue!= null){
			date.setDate(currentValue.get(Calendar.YEAR),
				currentValue.get(Calendar.MONTH),
				currentValue.get(Calendar.DAY_OF_MONTH));
		}
	}
	
	return composite;
}
 
開發者ID:ShoukriKattan,項目名稱:ForgedUI-Eclipse,代碼行數:38,代碼來源:DateTimeDialog.java

示例6: createDialogArea

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 20;
    layout.marginWidth = 20;
    layout.verticalSpacing = 2;
    container.setLayout(layout);

    Label lbl = new Label(container, SWT.NONE);
    lbl.setText("Start At:");
    Composite startComposite = new Composite(container, SWT.NONE);
    RowLayout rl = new RowLayout();
    rl.marginLeft = 0;
    rl.marginTop = 0;
    rl.marginBottom = 0;
    rl.center = true;
    startComposite.setLayout(rl);
    startDate = new DateTime(startComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
    startTime = new DateTime(startComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
    if (startTimeValue != null) {
        startDate.setDate(startTimeValue.get(Calendar.YEAR), startTimeValue.get(Calendar.MONTH),
                startTimeValue.get(Calendar.DAY_OF_MONTH));
        startTime.setTime(startTimeValue.get(Calendar.HOUR_OF_DAY), startTimeValue.get(Calendar.MINUTE),
                startTimeValue.get(Calendar.SECOND));
    }

    lbl = new Label(container, SWT.NONE);
    lbl.setText("Name:");
    name = new Text(container, SWT.BORDER);
    name.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    name.setText(nameValue);

    return container;
}
 
開發者ID:yamcs,項目名稱:yamcs-studio,代碼行數:39,代碼來源:CreateReplayDialog.java

示例7: populateControls

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
public static void populateControls(DateTime calendar, DateTime time, AbsoluteDate date)
{
    DateTimeComponents components = date.getComponents(utc);
    DateComponents dateComp = components.getDate();
    TimeComponents timeComp = components.getTime();
    int seconds = (int) Math.round(timeComp.getSecond());

    calendar.setDate(dateComp.getYear(), dateComp.getMonth() - 1, dateComp.getDay());
    time.setTime(timeComp.getHour(), timeComp.getMinute(), seconds);
}
 
開發者ID:vobject,項目名稱:maru,代碼行數:11,代碼來源:TimeUtils.java

示例8: createUpperMenu

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
private void createUpperMenu(Composite composite) {
	Group parentGroup = new Group(composite, SWT.NONE);
	parentGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	GridLayout layout = new GridLayout(9, false);
	parentGroup.setLayout(layout);
	
	date = new DateTime(parentGroup, SWT.DATE);
	fromTime = new DateTime(parentGroup, SWT.TIME);
	fromTime.setTime(0, 0, 0);
	Label label = new Label(parentGroup, SWT.CENTER);
	label.setText(" ~ ");
	toTime = new DateTime(parentGroup, SWT.TIME);
	toTime.setTime(23, 59, 59);

	label = new Label(parentGroup, SWT.RIGHT);
	label.setText("Job ID");
	searchText = new Text(parentGroup, SWT.LEFT | SWT.BORDER);
	GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
	gridData.minimumWidth = 150;
	searchText.setLayoutData(gridData);

	label = new Label(parentGroup, SWT.RIGHT);
	label.setText("Min Response Time");
	responseTimeText = new Text(parentGroup, SWT.LEFT | SWT.BORDER);
	gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
	gridData.minimumWidth = 80;
	responseTimeText.setLayoutData(gridData);

	final Button applyButton = new Button(parentGroup, SWT.PUSH);
	applyButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
	applyButton.setImage(Images.filter);
	applyButton.setText("Search");
	applyButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event event) {
			ExUtil.exec(new Runnable() {
				public void run() {
					search();
				}
			});
		}
	});
	
	searchText.addTraverseListener(new TraverseListener() {
		public void keyTraversed(TraverseEvent e) {
			if (e.detail == SWT.TRAVERSE_RETURN) {
				applyButton.notifyListeners(SWT.Selection, new Event());
			}
		}
	});
}
 
開發者ID:scouter-project,項目名稱:scouter,代碼行數:51,代碼來源:ObjectBatchHistoryView.java

示例9: createDialogArea

import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@Override
	protected Control createDialogArea(Composite parent) {
		Composite tParent = (Composite) super.createDialogArea(parent);
		tParent.setLayout(new GridLayout(2, false));
		GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
		parentData.widthHint = 500;
		tParent.setLayoutData(parentData);

		GridData gd = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create();
		// 自定義屬性名稱
		Label nameLbl = new Label(tParent, SWT.NONE);
		nameLbl.setText(Messages.getString("tmxeditor.editElementAttrDialog.customAttrName"));
		nameTxt = new Text(tParent, SWT.BORDER | SWT.READ_ONLY);
		nameTxt.setText(oldName);
		GridDataFactory.createFrom(gd).applyTo(nameTxt);
		// 自定義屬性值
		Label valueLbl = new Label(tParent, SWT.NONE);
		valueLbl.setText(Messages.getString("tmxeditor.editElementAttrDialog.customAttrValue"));
		if (oldName.equalsIgnoreCase("creationdate") || oldName.equalsIgnoreCase("changedate")) {
			Composite com = new Composite(tParent, SWT.NONE);
			GridLayout gl = new GridLayout(2, false);
			gl.marginLeft = 0;
			gl.marginWidth = 0;
			gl.marginHeight = 0;
			gl.marginBottom = 0;
			com.setLayout(gl);
			dateWidget = new DateTime(com, SWT.DROP_DOWN);
			timeWidget = new DateTime(com, SWT.DROP_DOWN | SWT.TIME | SWT.LONG);
			GridDataFactory.createFrom(gd).applyTo(com);

			Date strtodate = new Date();
			if (oldValue != null) {
				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd,HH:mm");
				ParsePosition pos = new ParsePosition(0);
				strtodate = formatter.parse(oldValue, pos);
				if (strtodate == null) {
					strtodate = new Date();
				}
			}

			Calendar cl = Calendar.getInstance();
			cl.setTime(strtodate);
			dateWidget.setDate(cl.get(Calendar.YEAR), cl.get(Calendar.MONTH), cl.get(Calendar.DATE));
			timeWidget.setTime(cl.get(Calendar.HOUR_OF_DAY), cl.get(Calendar.MINUTE), cl.get(Calendar.SECOND));
		} else {
			valueTxt = new Text(tParent, SWT.BORDER);
			valueTxt.setText(oldValue);
			valueTxt.setFocus();
			valueTxt.addModifyListener(new ModifyListener() {
				@Override
				public void modifyText(ModifyEvent e) {
					getButton(Dialog.OK).setEnabled(!valueTxt.getText().isEmpty());
				}
			});
			GridDataFactory.createFrom(gd).applyTo(valueTxt);
		}
		// 作用組
		Group applyGroup = new Group(tParent, SWT.NONE);
		applyGroup.setText(Messages.getString("tmxeditor.editElementAttrDialog.apply"));
		GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).applyTo(applyGroup);
		GridLayoutFactory.swtDefaults().numColumns(3).applyTo(applyGroup);
		// 當前選中行
		curSelectRowBtn = new Button(applyGroup, SWT.RADIO);
		curSelectRowBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		curSelectRowBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.current.line"));
		curSelectRowBtn.setSelection(true);

		// 所有過濾結果
		allFilterResultBtn = new Button(applyGroup, SWT.RADIO);
		allFilterResultBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		allFilterResultBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.allFilterResults"));

		// 整個文件/記憶庫
		allFileOrDBBtn = new Button(applyGroup, SWT.RADIO);
		allFileOrDBBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		allFileOrDBBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.allFileDatabase"));
		return tParent;
	} 
開發者ID:heartsome,項目名稱:tmxeditor8,代碼行數:79,代碼來源:EditElementAttrDialog.java


注:本文中的org.eclipse.swt.widgets.DateTime.setTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。