how-to

Java runtime & enviroment

Runtime

newHow to make simple java program with command-line tools ? How to get version of installed Java JDK ?  

Java Virtual Machine (JVM)

How to get free JVM heap memory ? How to deallocate memory for objects that are no longer needed ?  

Java basic

Working with Char

How to check if character is number ? newHow to convert int code to ASCII char - and back ?  

Working with String

How to convert String to lower/upper cases ? How to split string to parts ? How to work with StringTokenizer - how to split string to parts ?
How to work with String throught StringBuilder class ?    

Conversion between types

Number ->
How to convert number to string ? newHow to format currency ?  
String ->
How to convert string to number ? How to convert string to date ? How to convert string to time ?
How to convert string to char[] array ? How to convert string to byte[] array ?
Date ->
How to convert date to string ?    

Working with Date

How to calc with date ? newHow to get string weekday names ?  

Classes

Object instance

How to check if instance is descendant of particular class ? How to disable instantiate of class ? How to make shallow and deep copy of object ?
How to implement Cloneable interface for clone() method ?

Serialization

How to serialize object instance into file stream ? How to use "serialver" tool (serialver.exe) ? How to use "serialVersionUID" with serialization ?
How to serialize object instance into XML file ? How to serialize object into XML with JAXB API ? How to serialize multiple objects into XML with JAXB API ?

Reflection

How to list classes fields and methods ?    

Arrays

Basic

How to create array ? How to go through an array ? newHow to create multidimensional array ?

Advanced

How to copy array values between arrays ? How to quickly write array elements ? How to sort array elements ?
How to sort array elements in descenting order ? How to make custom array sorting ?

Collections

ArrayList

How to use ArrayList ?    

Hashtable

How to go throught Hashtable keys and values ?    

HashMap

How to use HashMap ?    

TreeMap

How to use TreeMap ?    

Generic

Common

newHow use generic with ArrayList ?    

Window applications [+SWING]

Common

How to dynamically add new component to window ? How to create and set new font ? newHow to use InputVerifier class ?
newHow to set frame`s own default close operation ?

Layouts

newHow to work with a CardLayout (notebook style) ?    

Look and Feel

How to set look and feel to default ? How to set look and feel in running application ? How to set external look and feel (from .jar) ?
newHow to get default TextField background color ?

Working with windows

How to make simplest window application ? How to center the window ?  

System dialogs

How to create simplest classic message box ? How to create message box with own image ? How to create input dialog with question ?
How to create input dialog ? How to create input dialog with predefined options ? How to use JFileChooser for open/save dialog ?

Combobox (JComboBox)

How to clear all items from JComboBox ? How to add items to JComboBox ?  

Edits (Textboxs)

How to set password char in JPasswordField ?    

Label (JLabel)

How to set image to JLabel ?    

Listbox (JList)

How to clear all items from JList ? How to add items to JList ?  

Scrollbar (JScrollbar)

How to check and write current scrollbar position ?    

Tree (JTree)

newHow to clear all items from JTree ? newHow to add items into JTree ?  

File & Directory

File

How to check if file exists ? How to get (separate) file extention ? How to delete file ?
How to rename file ?

Directory

How to check if directory exists ?    

File - reading and writing

How to create easy text file ? How to read data from text file ? How to serialize object instance into file stream ?
How to read text file with Scanner class ?

XML

How to serialize object instance into XML file ? How to use JAXB API - how to store object into XML ? How to use JAXB API - how to store multiple objects into XML ?

Data compressing

How to compress files into ZIP archive ?    

Others

How to list files in directory with filtering ? How to get path separator ? How to get file separator ?
How to work with line separator ?

Databases

Connection

How to make DB connection to database [oracle] How to make DB connection via DataSource class ? How to get more information about connected database ?
How to list tables/views in database ?

Events

java.awt.event.MouseAdapter()

How to check mouse doubleclick ?    

java.awt.event.AdjustmentListener()

newHow to check and write current scrollbar position ?    

Adjustable events

newHow to check and write current scrollbar position ?    

Mouse events

How to check mouse doubleclick ?    

Graphics

Images

How to convert image to other format ? How to get available formats for image reading/writing ? How to read image from resource ?
How to read image from resources as java.awt.Image instance ?

Screen

How to get screen size ? How to capture screenshot ?  

Fonts

newHow to create and set new font ? How to get throught all fonts ? newHow to get throught all font families ?

Coordinates

How to get current mouse screen position ? newHow to convert screen coordinates to component-based coordinates ?  

Mouse

newHow to get current mouse screen position ?    

Math

Functions

How to compute absolute value ? newHow to compute square root ?  

Rounding

How to round number value ? How to round number to two decimal places ?  

Random numbers

How to choose random array item ? newHow to generate random int value from interval ?  

Others

How to use modulo operator - is a number even or odd ? How to convert degrees to radians and back ? newHow to generate prime number ?
newHow to compute with better precision (BigInteger/BigDecimal) ?

Network

Mail

newHow to launch default mail client for sending message ?    

Web

newHow to launch default web browser for web page browsing ?    

Addresses

How to get local IP address and host name ? How to get device MAC address ?  

Client

How to make easy socket client (DayTime protocol) ?    

Internationalization

Locale

How to get current Locale ? How to set Locale ? How to list available Locale ?
How to get decimal separator ?

Security

Security providers

newHow to get list of installed security providers ?    

Others

Clipboard

newHow to copy/paste string into/from clipboard ? How to copy/paste image into/from clipboard ?  

Memory

How to get free JVM heap memory ? How to deallocate memory for objects that are no longer needed ?  

System

How to list system properties ? How to get operation system name ? How to call external program/application ?
newHow to read output from external application/process ?

System tray

How to add icon to system tray ? How to add icon with information message to system tray ? How to add icon to system tray and show info message after doubleclick on it ?
How to add icon with popup menu to system tray ?

Cursors

How to set cursor ?    

Media

How to do a beep sound ?