org.eclipse.swt.widgets.DateTime.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中org.eclipse.swt.widgets.DateTime.<init>()方法的一些代码示例,展示了DateTime.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.<init>()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.DateTime
类名称:DateTime
方法名:<init>

DateTime.<init>介绍

[英]Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
[中]给定该类的父类和描述其行为和外观的样式值,构造该类的新实例。
样式值是类SWT中定义的一个样式常量,适用于该类的实例,或者必须通过按位或将两个或多个SWT样式常量(即,使用int“|”运算符)组合在一起来生成。类描述列出了适用于该类的样式常量。样式位也继承自超类。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
  dialog.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) );
  dialog.setImage( GUIResource.getInstance().getImageSpoon() );
  dialog.setLayout( new GridLayout( 3, false ) );
  final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
  final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
  new Label( dialog, SWT.NONE );
  new Label( dialog, SWT.NONE );
  Button ok = new Button( dialog, SWT.PUSH );
  ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  ok.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendar.getYear() );
    cal.set( Calendar.MONTH, calendar.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, time.getHours() );
    cal.set( Calendar.MINUTE, time.getMinutes() );
    cal.set( Calendar.SECOND, time.getSeconds() );
    wReadFrom.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) );
    dialog.close();
   }
  } );
  dialog.setDefaultButton( ok );
  dialog.pack();
  dialog.open();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
  dialog.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) );
  dialog.setImage( GUIResource.getInstance().getImageSpoon() );
  dialog.setLayout( new GridLayout( 3, false ) );
  final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
  final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
  new Label( dialog, SWT.NONE );
  new Label( dialog, SWT.NONE );
  Button ok = new Button( dialog, SWT.PUSH );
  ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  ok.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendar.getYear() );
    cal.set( Calendar.MONTH, calendar.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, time.getHours() );
    cal.set( Calendar.MINUTE, time.getMinutes() );
    cal.set( Calendar.SECOND, time.getSeconds() );
    wReadFrom.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) );
    dialog.close();
   }
  } );
  dialog.setDefaultButton( ok );
  dialog.pack();
  dialog.open();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM );
  dialogto.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) );
  dialogto.setImage( GUIResource.getInstance().getImageSpoon() );
  dialogto.setLayout( new GridLayout( 3, false ) );
  final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER );
  final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME );
  new Label( dialogto, SWT.NONE );
  new Label( dialogto, SWT.NONE );
  Button okto = new Button( dialogto, SWT.PUSH );
  okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  okto.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendarto.getYear() );
    cal.set( Calendar.MONTH, calendarto.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() );
    cal.set( Calendar.MINUTE, timeto.getMinutes() );
    cal.set( Calendar.SECOND, timeto.getSeconds() );
    wReadTo.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) );
    dialogto.close();
   }
  } );
  dialogto.setDefaultButton( okto );
  dialogto.pack();
  dialogto.open();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM );
  dialogto.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) );
  dialogto.setImage( GUIResource.getInstance().getImageSpoon() );
  dialogto.setLayout( new GridLayout( 3, false ) );
  final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER );
  final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME );
  new Label( dialogto, SWT.NONE );
  new Label( dialogto, SWT.NONE );
  Button okto = new Button( dialogto, SWT.PUSH );
  okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  okto.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendarto.getYear() );
    cal.set( Calendar.MONTH, calendarto.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() );
    cal.set( Calendar.MINUTE, timeto.getMinutes() );
    cal.set( Calendar.SECOND, timeto.getSeconds() );
    wReadTo.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) );
    dialogto.close();
   }
  } );
  dialogto.setDefaultButton( okto );
  dialogto.pack();
  dialogto.open();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

dialog.setLayout( new GridLayout( 3, false ) );
final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
new Label( dialog, SWT.NONE );
new Label( dialog, SWT.NONE );

代码示例来源:origin: pentaho/pentaho-kettle

dialogto.setLayout( new GridLayout( 3, false ) );
final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER );
final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME );
new Label( dialogto, SWT.NONE );
new Label( dialogto, SWT.NONE );

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

/**
 * Creates the "Example" widgets.
 */
@Override
void createExampleWidgets () {
  /* Compute the widget style */
  int style = getDefaultStyle();
  if (dateButton.getSelection ()) style |= SWT.DATE;
  if (timeButton.getSelection ()) style |= SWT.TIME;
  if (calendarButton.getSelection ()) style |= SWT.CALENDAR;
  if (shortButton.getSelection ()) style |= SWT.SHORT;
  if (mediumButton.getSelection ()) style |= SWT.MEDIUM;
  if (longButton.getSelection ()) style |= SWT.LONG;
  if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN;
  if (borderButton.getSelection ()) style |= SWT.BORDER;
  if (weekNumbersButton.getSelection ()) style |= SWT.CALENDAR_WEEKNUMBERS;
  /* Create the example widgets */
  dateTime1 = new DateTime (dateTimeGroup, style);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

startTime = new DateTime(area, SWT.TIME | SWT.BORDER);
gridData = new GridData();
gridData.horizontalSpan = 2;

代码示例来源:origin: BiglySoftware/BiglyBT

shell.setLayout(layout);
DateTime calendar = new DateTime(shell, SWT.CALENDAR | SWT.LONG );
GridData gridData = new GridData(GridData.FILL_BOTH);
calendar.setLayoutData(gridData);

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

calendar = new DateTime(this, SWT.CALENDAR);
calendar.addSelectionListener(new SelectionAdapter() {

代码示例来源:origin: atdl4j/atdl4j

dateClock = new org.eclipse.swt.widgets.DateTime( c, style | SWT.BORDER | SWT.DATE | ( showDay ? SWT.MEDIUM : SWT.SHORT ) );
dateClock.setLayoutData(clockGD);
timeClock = new org.eclipse.swt.widgets.DateTime( c, style | SWT.BORDER | SWT.TIME | SWT.MEDIUM );
timeClock.setLayoutData(clockGD);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

argumentsDate = new DateTime(multiArgumentComposite, SWT.DATE | SWT.MEDIUM | SWT.BORDER);
data= new GridData(SWT.FILL, SWT.FILL, true, false);
argumentsDate.setLayoutData(data);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void createPopupShell (int year, int month, int day) {
  popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
  popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
  if (font != null) popupCalendar.setFont (font);
  if (fg != null) popupCalendar.setForeground (fg);
  if (bg != null) popupCalendar.setBackground (bg);

  mouseEventListener = new Listener () {
    @Override
    public void handleEvent (Event event) {
      if (event.widget instanceof Control) {
        Control c = (Control)event.widget;
        if (c != down && c.getShell () != popupShell)
          dropDownCalendar (false);
      }
    }
  };

  int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint};
  for (int i=0; i < listeners.length; i++) {
    popupShell.addListener (listeners [i], popupListener);
  }
  listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
  for (int i=0; i < listeners.length; i++) {
    popupCalendar.addListener (listeners [i], popupListener);
  }
  addListener (SWT.Dispose, popupListener);
  if (year != -1) popupCalendar.setDate (year, month, day);
}

代码示例来源:origin: org.xworker/xworker_swt

DateTime dateTime = new DateTime(parent, style);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void createPopupShell (int year, int month, int day) {
  popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
  popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
  if (font != null) popupCalendar.setFont (font);
  if (fg != null) popupCalendar.setForeground (fg);
  if (bg != null) popupCalendar.setBackground (bg);

  mouseEventListener = new Listener () {
    @Override
    public void handleEvent (Event event) {
      if (event.widget instanceof Control) {
        Control c = (Control)event.widget;
        if (c != down && c.getShell () != popupShell)
          dropDownCalendar (false);
      }
    }
  };

  int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint};
  for (int i=0; i < listeners.length; i++) {
    popupShell.addListener (listeners [i], popupListener);
  }
  listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
  for (int i=0; i < listeners.length; i++) {
    popupCalendar.addListener (listeners [i], popupListener);
  }
  addListener (SWT.Dispose, popupListener);
  if (year != -1) popupCalendar.setDate (year, month, day);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void createPopupShell (int year, int month, int day) {
  popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
  popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
  if (font != null) popupCalendar.setFont (font);
  if (fg != null) popupCalendar.setForeground (fg);
  if (bg != null) popupCalendar.setBackground (bg);

  mouseEventListener = new Listener () {
    @Override
    public void handleEvent (Event event) {
      if (event.widget instanceof Control) {
        Control c = (Control)event.widget;
        if (c != down && c.getShell () != popupShell)
          dropDownCalendar (false);
      }
    }
  };

  int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint};
  for (int i=0; i < listeners.length; i++) {
    popupShell.addListener (listeners [i], popupListener);
  }
  listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
  for (int i=0; i < listeners.length; i++) {
    popupCalendar.addListener (listeners [i], popupListener);
  }
  addListener (SWT.Dispose, popupListener);
  if (year != -1) popupCalendar.setDate (year, month, day);
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

popupShell.isPopup = true;
popupShell.window.setHasShadow(true);
popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
if (font != null) popupCalendar.setFont (font);

代码示例来源:origin: org.xworker/xworker_swt

@Override
public Object create(ActionContext actionContext) {
  dateTime = new DateTime((Composite) actionContext.get("parent"), SWT.TIME | SWT.LONG | SWT.BORDER);
  dateTime.addSelectionListener(new SelectionListener() {
    @Override

代码示例来源:origin: org.xworker/xworker_swt

DateTime dateTime = new DateTime((Composite) actionContext.get("parent"), SWT.TIME | SWT.LONG | SWT.BORDER);

相关文章

DateTime类方法