SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

APACHE COMMONS / NOTES</>↗
Apache Commons05 Dec 2008

How do I add query string to HttpMethod object?

To send query string information in HTTP GET command you either using passing a simple string or an array of NameValuePair object into the HttpMethod‘s setQueryString() method. We also need to encode the parameter values before passing it to the method. package org.kodejava.commons.httpclient; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.util.URIUtil; import org.apache.commons.httpclient.methods.GetMethod; import java.io.IOException; public cla...

Wayan · 2 min read
APACHE COMMONS / NOTES</>↗
Apache Commons04 Dec 2008

How do I set a proxy for HttpClient?

In this example you will see how to configure proxy when using the Apache Commons HttpClient library. package org.kodejava.commons.httpclient; import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache....

Wayan · 2 min read
APACHE COMMONS / NOTES</>↗
Apache Commons30 Nov 2008

How do I perform HTTP GET method?

Below is an example using Commons HttpClient library to retrieve information from a website using HTTP GET method. The response will be returned as stream by the HttpMethod.getResponseBodyAsStream() method. If you want something simple you can get the response as string by using the HttpMethod.getResponseBodyAsString() method. package org.kodejava.commons.httpclient; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.a...

Wayan · 2 min read
CORE API / NOTES</>↗
Core API26 Nov 2008

How do I format date using a locale based format?

The code below demonstrate how to format date information for a specific locale. In the example utilize the java.text.SimpleDateFormat class. package org.kodejava.text; import java.util.Locale; import java.util.Date; import java.text.SimpleDateFormat; public class FormatDateLocale { public static void main(String[] args) { // Defines an array of Locale we are going to use for // formatting date information. Locale[] […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing25 Nov 2008

How do I customize JButton icons?

The example below shows you how we can customize the icon for JButton Swing components. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class JButtonCustomIcon extends JFrame { public JButtonCustomIcon() throws HeadlessException { initialize(); } private void initialize() { setSize(500, 500); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLayout(new FlowLayout(FlowLayout.LEFT)); JButton button = new JButton("Press Me!"); // Below is ho...

Wayan · 1 min read
SWING / NOTES</>↗
Swing25 Nov 2008

How do I customize JCheckBox icons?

JCheckBox can have a different icon for its states, there are default icon, a selected icon, disabled icon, pressed icon or rollover icon, etc. See the code below and have a try on it. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class JCheckBoxCustomIcon extends JFrame { public JCheckBoxCustomIcon() throws HeadlessException { initialize(); } private void […]

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.