Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 153548 Details for
Bug 296655
DateTime control: CALENDAR style returns zero hours, minutes, seconds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Snippet to reproduce bug
Snippet251.java (text/plain), 2.39 KB, created by
Elias Volanakis
on 2009-12-01 20:04:31 EST
(
hide
)
Description:
Snippet to reproduce bug
Filename:
MIME Type:
Creator:
Elias Volanakis
Created:
2009-12-01 20:04:31 EST
Size:
2.39 KB
patch
obsolete
>package org.eclipse.riena.sample.snippets; > >/* > * DateTime example snippet: create a DateTime calendar, date, and time in a dialog. > * > * For a list of all SWT example snippets see > * http://www.eclipse.org/swt/snippets/ > */ >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.SelectionAdapter; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.layout.GridData; >import org.eclipse.swt.layout.GridLayout; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.DateTime; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Label; >import org.eclipse.swt.widgets.Shell; > >public class Snippet251 { > > public static void main(String[] args) { > Display display = new Display(); > final Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > > Button open = new Button(shell, SWT.PUSH); > open.setText("Open Dialog"); > open.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM); > dialog.setLayout(new GridLayout(3, false)); > > final DateTime calendar = new DateTime(dialog, SWT.CALENDAR | SWT.BORDER); > final DateTime date = new DateTime(dialog, SWT.DATE | SWT.SHORT); > final DateTime time = new DateTime(dialog, SWT.TIME | SWT.SHORT); > > new Label(dialog, SWT.NONE); > new Label(dialog, SWT.NONE); > Button ok = new Button(dialog, SWT.PUSH); > ok.setText("OK"); > ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); > ok.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > dump(calendar, "Calendar date selected (MM/DD/YYYY) = "); > dump(date, "Date selected (MM/YYYY) = "); > dump(time, "Time selected (HH:MM) = "); > dialog.close(); > } > > private void dump(DateTime dateTime, String msg) { > System.out.println(String.format("%s: %s.%s.%s %s:%s.%s", msg, dateTime.getDay(), dateTime > .getMonth() + 1, dateTime.getYear(), dateTime.getHours(), dateTime.getMinutes(), > dateTime.getSeconds())); > } > }); > dialog.setDefaultButton(ok); > dialog.pack(); > dialog.open(); > } > }); > shell.pack(); > shell.open(); > > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 296655
: 153548 |
160072