JavaFX 8 DatePicker month-year-pane modify - java

i have a Datepicker as shown here :
DatePickerImage
What i need is in the calendar popup.
There are 2 spinners, 1 for month and 1 for Year.
I want to obtain a DatePicker with 1 spinner showing month and year.
Exemple : DatePicker Single Spinner
There is a class DatepickerContent wich contains a method createMonthYearPane() but i don't know if it is relevant.
Any help appreciated.
Thank You.

You need to change css, can be default CSS file called modena.css. In this stylesheet is applied for every JavaFX components.
You can find this file in the JavaFX jar file jfxrt.jar (should be located /jdk1.8.x/jre/lib/ext/jfxrt.jar). After unzipping that jar file you should find the modena.css under com/sun/javafx/scene/control/skin/modena/
Find in the file a commented section DatePicker and you get all style properties that you are looking for.
Here is the modena.css
Have a nice coding :)

Related

How to document runtime of a function with Javadoc

I'm want to document the asymptotic runtime of a function, as it will be used for algorithm-engineering for graph problems.
What's the most idiomatic way to do this? Is there a way to create new tags in Javadoc like #return or #author?
I provided an example below, which is the method to delete a vertex in the graph.
/**
* Runtime: O( degreeOf(v) ) because every neighbour of [v] also needs to be updated.
*/
fun deleteVertex(v: V): SimpleGraph<V> {
if (v in m.keys) {
for (nb in m[v]!!)
m[nb]!!.remove(v)
m.remove(v)
}
return this
}
To create custom tags for Javadocs, simply follow these instructions.
You can create other customizations for Javadoc. For example, in Eclipse, you can create "templates" so that when you create new classes or add new methods, the IDE automatically apply this template to add a (Javadoc) comment formatted in the prescribed style of the template you applied. You can save these templates in an XML file so that you could share it with other members of your team. I am sure that IntelliJ and other modern IDEs will have similar features. I am just more familiarized with Eclipse. Here is a video I created many years ago on how to create a Code Formatter in Eclipse. If you advance to the 1:48 mark, you will see "Code Template" right above the "Code Formatter" option I selected in the video. Creating a code template is much easier than a formatter.
To do this, simply click on Windows > Preferences menu to get the Preferences popup. There, select Java > Code Style > Code Templates. in the right pane, expand Comments and select the component you wish to create a comment template for, for example Methods. Click Edit button and format the Javadoc comment to your liking. Obviously, you will have to do a bit of research to get really creative with your comments. For example, you might need to figure out how to use system variables or create your own. For example, in the image below, I made use the year variable to apply the current year whenever I create a new class.
Once you finish with all your template customizations, simply click the Export button and use the File Chooser dialog to save the file wherever you would like.
One last tip, if you need to embed code snippets in your Javadocs, you can follow the recommendations in this article. I do this very often. Sometimes I find it useful to embed a few lines of code to illustrate different use cases for the method. That way, other developers can see how to use the method in the correct context.

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

How to add in pop-up to jtextFiled view in java

I have developed a java gui that contains two jTextField views for displaying the source and destination file paths. And , the user selects more than one file path , i would like to display previous paths in a pop-up attached to the jTextField. This is a common feature in almost all app.
Does anyone knows how this is called, in order to google how to do it?
It is called editable JComboBox.

Java Hyperlink to file in text editor

I have a question related to hyperlinks in java.
How can I set hyperlink in java file to point to another java file loaded on the text editor in Eclipse, when I have the filename and code line:
ex. Test.java:102
How to show the given code line of that file on the text editor?
Thank you!
The Java language does not know hyperlinks.
JavaDoc does know hyperlinks, which you can easily access in the Eclipse editor by typing either the # sign and choose a local member or by typing the name of an external class and hitting controlspace, then choose the right link.
Fortunately, you cannot directly create links to lines. Lines change in time, the contract of the class (the description of the methods/fields) is what should remain relatively static. When configured correctly, Eclipse will even change your links if you refactor your code (e.g. rename your method or class).
You cannot create hyperlinks to lines -afaik, but you can create links to fields or functions in javadoc:
/**
* {#link package.ClassName#fieldOrFunction}
*/
doing it like that allows you to ctrl-click on the "fieldOrFunction" and jumps right there (at least in eclipse)
2 years later, I know...
If you are looking for hyperlinks from any file surround it with parenthesis like so
(AnotherClass.java:52)
ctrl click will take you there if it knows of that class.

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