Skip to content

Commit 36d50c9

Browse files
committed
2 parents 2f44b5c + cd59d29 commit 36d50c9

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

CodenameOne/src/com/codename1/ui/Calendar.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,37 @@ public Calendar() {
120120
* @param tmz a reference timezone
121121
*/
122122
public Calendar(long time, TimeZone tmz) {
123+
this(time, java.util.TimeZone.getDefault(), null, null);
124+
}
125+
126+
/**
127+
* Constructs a calendar with the current date and time with left and right images set
128+
*
129+
* @param leftArrowImage an image for calendar left arrow
130+
* @param rightArrowImage an image for calendar right arrow
131+
*/
132+
public Calendar(Image leftArrowImage, Image rightArrowImage) {
133+
this(System.currentTimeMillis(), java.util.TimeZone.getDefault(), leftArrowImage, rightArrowImage);
134+
}
135+
136+
/**
137+
* Creates a new instance of Calendar set to the given date based on time
138+
* since epoch (the java.util.Date convention)
139+
*
140+
* @param time time since epoch
141+
* @param tmz a reference timezone
142+
* @param leftArrowImage an image for calendar left arrow
143+
* @param rightArrowImage an image for calendar right arrow
144+
*/
145+
public Calendar(long time, TimeZone tmz, Image leftArrowImage, Image rightArrowImage) {
123146
super(new BorderLayout());
124147
this.tmz = tmz;
125148
setUIID("Calendar");
126149
mv = new MonthView(time);
127150

128-
Image leftArrow = UIManager.getInstance().getThemeImageConstant("calendarLeftImage");
129-
if (leftArrow != null) {
130-
Image rightArrow = UIManager.getInstance().getThemeImageConstant("calendarRightImage");
151+
Image leftArrow = leftArrowImage != null ? leftArrowImage : UIManager.getInstance().getThemeImageConstant("calendarLeftImage");
152+
Image rightArrow = rightArrowImage != null ? rightArrowImage : UIManager.getInstance().getThemeImageConstant("calendarRightImage");
153+
if (leftArrow != null && rightArrow != null) {
131154
final Button left = new Button(leftArrow, "CalendarLeft");
132155
final Button right = new Button(rightArrow, "CalendarRight");
133156
ActionListener progress = new ActionListener() {

CodenameOne/src/com/codename1/ui/TextArea.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public TextArea(String text, int rows, int columns, int constraint){
301301
public TextArea(String text, int maxSize){
302302
this(text,maxSize, 1, 3, ANY);
303303
}
304-
304+
305305
/**
306306
* Creates an area with the given text, this constructor
307307
* will create a single line text area similar to a text field!

0 commit comments

Comments
 (0)