Java Code Examples for org.eclipse.swt.widgets.DateTime#setDate()
The following examples show how to use
org.eclipse.swt.widgets.DateTime#setDate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskEditor.java From codeexamples-eclipse with Eclipse Public License 1.0 | 6 votes |
@Override public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(); layout.numColumns = 2; parent.setLayout(layout); new Label(parent, SWT.NONE).setText("Summary"); Text text = new Text(parent, SWT.BORDER); text.setText(todo.getSummary()); text.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); new Label(parent, SWT.NONE).setText("Description"); Text lastName = new Text(parent, SWT.BORDER); lastName.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); lastName.setText(todo.getDescription()); new Label(parent, SWT.NONE).setText("Done"); Button doneBtn = new Button(parent, SWT.CHECK); doneBtn.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); doneBtn.setSelection(todo.isDone()); new Label(parent, SWT.NONE).setText("Due Date"); DateTime dueDate = new DateTime(parent, SWT.CHECK); dueDate.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); Date date = todo.getDueDate(); dueDate.setDate(date.getYear(), date.getMonth(), date.getDay()); }
Example 2
Source File: DateTimeSelectorDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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; }
Example 3
Source File: DateTimeSelectorDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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; }
Example 4
Source File: ResourceChartDialogEx.java From logbook with MIT License | 2 votes |
/** * DateTimeにCalendarの年月日をセットします * * @param cal * @param dateTime */ private static void setCalendar(Calendar cal, DateTime dateTime) { dateTime.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH)); }