JODA-TIME / CATATAN</>↗Joda-Time25 Jul 2012
In this example you will learn how to add hours, minutes or seconds to a DateTime object in Joda-Time. Some methods are available to add or subtract hours, minutes or seconds from the object, as you can see in the example below. The DateTime object is an immutable object, which means calling one of the […]
APACHE COMMONS / CATATAN</>↗Apache Commons13 Jun 2012
In this example, you will learn how to find out if two defined date objects are on the same day. It means that we are only interested in the date information and ignoring the time information of these date objects. We will be using an API provided by the Apache Commons Lang library. So here […]
MYBATIS / CATATAN</>↗MyBatis06 Jun 2012
MyBatis comes with a complete configuration classes that allows us to create a configuration object programmatically without using the XML file. In this code snippet you’ll see how to create a SqlSessionFactory object without XML configuration file. We start by obtaining a javax.sql.DataSource object. Then we create a TransactionFactory object. With these two objects we […]
SWING / CATATAN</>↗Swing06 Jun 2012
package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class WindowTaskbarFlash extends JFrame { private WindowTaskbarFlash() throws HeadlessException { initUI(); } public static void main(String[] args) { SwingUtilities.invokeLater( () -> new WindowTaskbarFlash().setVisible(true)); } private void initUI() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); pack(); setSize(200, 200); setState(Frame.ICONIFIED); // Demonstrate flashes the application...
SWING / CATATAN</>↗Swing06 Jun 2012
In the following code snippet you’ll learn how to programmatically change the frame state of a JFrame component in a Swing application. The JFrame states are represented as a bitwise masks. You can minimize, maximize or make the JFrame state to normal, using the JFrame.setExtendedState() method. You can pass the following values as the parameter […]
SERVLET / CATATAN</>↗Servlet05 Jun 2012
The ServletContext.getContext(String uripath) enable us to access servlet context of another web application deployed on the same application server. A configuration need to be added to enable this feature. In the example below we will forward the request from the current application to the /otherapp/hello.jsp page. We place a string in the request object attribute […]