SupportWriter space ↗
A JOURNAL ABOUT TECHNOLOGY

Learn something new.
Write. Share.

A space to connect knowledge, one line of code a day.
Discover tutorials, ideas, and notes from a learning journey.

1967 notes & counting ↙
FOR YOUR CURIOSITY

Latest notes.

AWT / NOTES</>↗
AWT19 Apr 2010

How do I print a file using the default registered application?

The example code below shows you how to print a file using the default registered application’s print command for the corresponding file type. As an example, on Windows notepad.exe is the default application for printing a .txt file. To print a file using the default registered application we call the java.awt.Desktop.print(File) method. The print() method […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT19 Apr 2010

How do I edit a file using the default registered application?

For editing a file using the default registered or associated application we can do a call to the java.awt.Desktop.edit(File) method. In the code snippet below we will edit a PNG file. Using the edit() method of the Desktop class will open the default registered application for PNG files. For example on Windows there could be […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT16 Apr 2010

How do I open a file using the default registered application?

If you want to open a file using the default registered or associated application for those files you can use the Desktop.open(File file) method call. In the example below we’ll ask the Desktop class to open a text file. package org.kodejava.awt; import java.awt.*; import java.io.File; import java.io.IOException; public class RunningDefaultAppOpen { public static void main(String[] […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT15 Apr 2010

How do I launch user-default mail client application?

Here is an example using the java.awt.Desktop class to open user’s default mail client application. There are two methods provided, the mail() and the mail(URI uri) methods. When specifying the URI to the application will be opened with the message field filled with the mailto information. You can refer to the following document for the […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT14 Apr 2010

How do I launch user-default web browser?

The code below show you how to browse a website using the user’s default web browser. To get the default web browser you can use the Desktop class browse(URI uri) method call. package org.kodejava.awt; import java.awt.Desktop; import java.io.IOException; import java.net.URI; public class RunningDefaultBrowser { public static void main(String[] args) { URI uri = URI.create("https://kodejava.org"); try […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT05 Jan 2010

How do I turn on the Scroll Lock button?

The program below show you how to turn on the Scroll Lock button programmatically. Setting the locking state to Boolean.TRUE activate the Scroll Lock. package org.kodejava.awt; import java.awt.*; import java.awt.event.KeyEvent; public class TurnScrollLockOn { public static void main(String[] args) { // Gets the default toolkit. Toolkit toolkit = Toolkit.getDefaultToolkit(); // Update the locking state for […]

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.