JXDatePicker questions (Part 1) - java

I want to use JXDatePicker in my project. I am first time to learn swingx. My questions is:
(1) How to clear the "Today is [today date]"?
(2) How to show the current date in dd-MM-YYYY before I click the datepicker choose calendar?
(3) How to change the icon of the button?

(1) How to clear the "Today is [today date]"?
Use JXDatePicker#setLinkPanel and supply what ever you want...
(2) How to show the current date in dd-MM-YYYY before I click the datepicker choose calendar?
Use JXDatePicker#setFormats
(3) How to change the icon of the button?
You can change the popup buttons icon using something like UIManager.put("JXDatePicker.arrowIcon", icon). The look and feel expects an Icon
This is a global change, all instance of JXDatePicker will pick it. You could instantiate a custom BasicDatePickerUI and override it's createPopupButton method to return create the JButton yourself. This would allow you to customise a single instance of JXDatePicker

Related

How to show a calendar when I click a textField with java

I would like to display a calendar, onto which I would click a text field from which I would choose a date.
After the date is chosen, I would like it - the date - to be inserted again back to this text field where I chose the date from.
Can you help me guys!!
I would like to use JXDatePicker for the calendar.

Java display calendar-like data

I am working on java and i want to make my java GUI display data like this.
What component or what layout should i use?
First, i think i should do something with JTable to display the table like this.
Second, in each day in this calendar it is clickable. and I think I'll use JButton.I'm not sure if it's ok.
third, the most top of the calendar, i have no idea how to make it display like that.

how to customize android default classes(datepicker,numpicker,etc)

I want to make a custom date-picker for android and I need to change something in datepicker.class file in android.widget package. In fact, I want to change the year and month for solar hijri calendar.
I found source code of datepicker.java in http://alvinalexander.com/java/jwarehouse/android/core/java/android/widget/DatePicker.java.shtml - but I don't know how to change and replace it with default android class. Does anybody know how to do this?
The dirty way to do this is to copy the source code for the datepicker class, and rename/modify it as your own class for the hijri calendar. You could then import or extend this new class to work with your code.
You could use this custom view which implement jalali date on it
https://github.com/alibehzadian/PersianDatePicker
you could just copy the classes ,layout , values on it and paste them in your project and now you have datepicker for jalali date jsut follow the usage instructions on the provided link

Java SWT DateTime - Get Selection?

I've got a DateTime (SWT.TIME) and want to know if the hours or minutes or seconds are selected.
I would like to get this information because I want that the User can scroll the mouse wheel in order to change the selected values accordingly.
Unfortunately I couldn't find any way to get the selected element of the DateTime Control. Does anybody have an idea?
DateTime provides many methods for getting the selected date. Like getHours, getMinutes, getDay, and so on. It's unclear to me what's your exact question, but appropiate setters are there as well.

Swing time picker

Im looking for a pretty and decent time picker component. There are a lot of alternatives for date picking on Swing but no for time.
I've seen nice Date/Time components picking on JQuery ( for example: http://trentrichardson.com/examples/timepicker/ ). There is something similar on Swing?
Thanks in advance.
Use JSpinner with SpinnerNumberModel
I would suggest the TimePicker component of the LGoodDatePicker library. The time can be chosen with the (default) "drop down" menu, with (optional) "spinner" style buttons, or both.
Fair disclosure: I'm the primary developer.
The TimePicker can be customized with optional settings. A few of the settings are the language (locale), default times in the drop down menu, fonts and colors, display/menu/parsing formats, 12 or 24 hour clock, seconds or nanoseconds precision, and so forth.
The library also includes the DatePicker and DateTimePicker components. All three components are easy to use. (They can each be instantiated with a single line of code.)
I've pasted screenshots of the components and the demo application below.
Project Home page: https://github.com/LGoodDatePicker/LGoodDatePicker .
( Click to enlarge the demo screenshot. )
I think you will like the ease of JCalendar. It offers a JDateChooser, a JDayChooser or a JSpinnField, written by Kai Toedter', available here: JCalendar 1.4.
You can get your dates like this:
java.util.Date fromDate = jDateChooser1.getDate();
JSpinnField lets you set max and min values easily:
jSpinField1.setMaximum(59);
jSpinField1.setMinimum(0);

Categories