Skip to content

Latest commit

 

History

History
113 lines (85 loc) · 2.57 KB

README.md

File metadata and controls

113 lines (85 loc) · 2.57 KB

Table of Contents

1. Install

1.1. Brief introduction

swt calendar widget

1.2. Requirements

jdk 1.8+
maven-3.2.3+
swt 4.2.1+

1.3. Install from source code

    #windows
    $mvn clean install -Pwin_x86_64 -Dmaven.test.skip=true
    
    #mac
    $mvn clean install -Pmac_x86_64 -Dmaven.test.skip=true
    
    #linux
    $mvn clean install -Plinux_x86_64 -Dmaven.test.skip=true

2. Simple usage

2.1. Select date

XCalendar x = new XCalendar(text.getParent(), SWT.DATE);
x.setup(v -> true, true);
x.show(text.getParent(), text.getBounds());

date

2.2. Select date time

XCalendar x = new XCalendar(text.getParent(), SWT.LONG);
x.setup(v -> true, true);
x.show(text.getParent(), text.getBounds());

datetime

2.3. Select year

XCalendar x = new XCalendar(text.getParent(), SWT.SHORT);
x.setup(v -> true, true);
x.show(text.getParent(), text.getBounds());

year

2.4. Select year month

XCalendar x = new XCalendar(text.getParent(), SWT.MEDIUM);
x.setup(v -> true, true);
x.show(text.getParent(), text.getBounds());

year_month

2.5. Select time

XCalendar x = new XCalendar(text.getParent(), SWT.TIME);
x.setup(v -> true, true);
x.show(text.getParent(), text.getBounds());

time

2.6. Filters

x.setup(v -> v.after(new Date()), true);

disable

2.7. XCalendarSelectEvent

XCalendar x = new XCalendar(text.getParent(), SWT.MEDIUM);
x.setup(v -> true, true);
x.addXCalendarEventListener(new XCalendarEventListener() {
    @Override
    public void onEvent(XCalendarEvent event) {
        if (!(event instanceof XCalendarSelectEvent)) return;
        XCalendarSelectEvent s = (XCalendarSelectEvent) event;
        // your code goes here.            
    }
});
x.show(text.getParent(), text.getBounds());