Here is an example showing the Data addition and subtraction using Calendar in Java. Continue reading Java – Date Addition and Subtraction
Category Archives: Java
Java – Directory/File Browse Button using JFileChooser
The following Demo.java demonstrates the usage of JFileChooser.
Demo.java Continue reading Java – Directory/File Browse Button using JFileChooser
Java – Get Current Date and Time
I found a very good example for showing current datetime in Java. Continue reading Java – Get Current Date and Time
Java – Show Confirmation Box Using JOptionPane
Working on Java Swing recently. The following example shows you how to create confirmation box. Continue reading Java – Show Confirmation Box Using JOptionPane
Java – Check File and Directory Existence
You can Check the file/directory existence as follow. Continue reading Java – Check File and Directory Existence
Java – Check if a string contains integer only
The following static function helps you to check if a string contains number.
public static boolean checkIfNumber(String in) {
try {
Integer.parseInt(in);
} catch (NumberFormatException ex) {
return false;
}
return true;
}
Continue reading Java – Check if a string contains integer only
Java – Check Empty String
If you don’t want to use Apache Commons which i show you in previous post. You can use the following static function to check if a string is empty.
public static boolean notEmpty(String s) {
return (s != null && s.length() > 0);
}
Done =)
Reference:
Java – Check Empty String with Apache Commons
Apache Commons IO provides the StringUtils Class for checking empty string in Java.
Add the Apache Commons Lang in the pom.xml. Continue reading Java – Check Empty String with Apache Commons
Java – Split a String into an Array
The following example convert a comma separated string into an array. Continue reading Java – Split a String into an Array
Java – JCalendar for Date Selection
Previously i have created two posts about a simple Swing Date Picker.
Here comes a better solution – JCalendar.
JCalendar is Java Bean which provides a complete feature of a Date Picker in Java. For more information, please visit JCalendar Java Bean, a Java Date Chooser Continue reading Java – JCalendar for Date Selection