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</>↗
AWT09 May 2009

How do I get the location of mouse pointer?

MouseInfo provides methods for getting information about the mouse, such as mouse pointer location and the number of mouse buttons. package org.kodejava.awt; import java.awt.*; public class MouseInfoDemo { public static void main(String[] args) { int i = 0; while (i < 10) { // Get the location of our mouse x and y coordinate using […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT17 Apr 2009

How do I get screen’s display mode information?

This example shows graphics devices display mode information such as the display width, height, refresh-rate and bit-depth. This information can be obtained from GraphicsDevice.getDisplayMode() method which return an instance of java.awt.DisplayMode. We can also get the size of a screen using the following example How do I get my screen size?, but this example can […]

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

How do I get number of available screens?

This code shows how to get number of available screen devices on the local machine or local graphics environment. We obtain the number of screens by getting the length of array returned by GraphicsEnvironment.getScreenDevices() method. This process can produce a HeadlessException to happen if we try to run this code on a machine that doesn’t […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT06 Feb 2008

How do I create mouse event using Robot class?

In this example we are automating the process of creating mouse event using the java.awt.Robot class. package org.kodejava.awt; import java.awt.AWTException; import java.awt.Robot; import java.awt.event.InputEvent; public class MovingMouseDemo { public static void main(String[] args) { try { Robot robot = new Robot(); // Move mouse cursor to 200, 500 robot.mouseMove(200, 500); // Press the mouse button […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT05 Feb 2008

How do I get the color of a screen pixel?

The example here show us how to get the color of a pixel in the screen. We use the Robot.getPixelColor(int x, int y) method to obtain the Color of the pixel. package org.kodejava.awt; import java.awt.Color; import java.awt.Robot; import java.awt.AWTException; public class ColorPickerDemo { public static void main(String[] args) { try { Robot robot = new […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT04 Feb 2008

How do I create key press event using Robot class?

In this example we use the java.awt.Robot class to generate a key press event. We can call the keyPress(int keyCode) method to produce this event. package org.kodejava.awt; import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; public class CreatingKeyboardEvent { public static void main(String[] args) { try { Robot robot = new Robot(); // Create a three seconds […]

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.