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.

SWING / NOTES</>↗
Swing01 Aug 2007

How do I get the available Swing look and feel?

The code snippet below describe how we can obtain the available look and feel in the current Swing platform. This information can then be made available to the user, so they can change to look and feel of the application in their preferences. package org.kodejava.swing; import javax.swing.UIManager; public class AvailableLookAndFeel { public static void main(String[] […]

Wayan · 1 min read
SWING / NOTES</>↗
Swing31 Jul 2007

How do I format JTextField text to uppercase?

To change JTextField text to upper case can be easily done by adding a DocumentFilter to the JTextField component using the setDocumentFilter() method. The DocumentFilter allow us to filter action for changes in the document such as insert, replace and remove. The code snippet below show us how to do it. package org.kodejava.swing; import javax.swing.JFrame; […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing29 Jul 2007

How do I add key listener event handler to JTextField?

In this small Swing code snippet we demonstrate how to use java.awt.event.KeyAdapter abstract class to handle keyboard event for the JTextField component. The snippet will change the characters typed in the JTextField component to uppercase. A better approach for this use case is to use the DocumentFilter class. See the following code snippet How do […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing26 Jul 2007

How do I change JFrame image icon?

This code snippet demonstrates how to change a JFrame image icon using the setIconImage() method. package org.kodejava.swing; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.WindowConstants; import java.awt.Dimension; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; public class FrameIconExample extends JFrame { public static void main(String[] args) { FrameIconExample frame = new FrameIconExample(); frame.setDe...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API23 Jul 2007

How do I use Console class to read user input?

In the previous example, How do I read user input from console using Scanner class?, we use the java.util.Scanner class to read user input. In this example we use another new class introduced in the Java 1.6, the java.io.Console class. The Console class provide methods like readLine() and readPassword(). The readPassword() method can be used […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API22 Jul 2007

How do I read user input from console using java.util.Scanner class?

In JDK 1.5 a java.util.Scanner class was introduced to handle user input in console application. This class enable us to read string, integer, long, etc. package org.kodejava.util; import java.util.Scanner; public class ScannerDemo { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // Read string input for username System.out.print("Username: "); String username = […]

Wayan · 1 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.