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.

AWT / NOTES</>↗
AWT11 May 2009

How do I get the number of buttons on the mouse?

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 MouseNumberOfButtons { public static void main(String[] args) { // Get the number of buttons on the mouse. On systems without a // mouse, returns -1. HeadlessException if // GraphicsEnvironment.isHeadless() […]

Wayan · 1 min read
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
CORE API / NOTES</>↗
Core API09 May 2009

How do I get the name of current executed method?

package org.kodejava.lang; public class GetCurrentMethodName { public static void main(String[] args) { // Get the current executing method name String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); System.out.println("methodName = " + methodName); GetCurrentMethodName obj = new GetCurrentMethodName(); obj.executeAMethod(); } private void executeAMethod() { // Get the current executing method name String methodName = Thread.currentThread().getStackTra...

Wayan · 1 min read
JDBC / NOTES</>↗
JDBC05 May 2009

How do I convert java.util.Date to java.sql.Date?

package org.kodejava.jdbc; import java.util.Date; public class UtilDateToSqlDate { public static void main(String[] args) { // Create a new instance of java.util.Date Date date = new Date(); // To covert java.util.Date to java.sql.Date we need to // create an instance of java.sql.Date and pass the long // value of java.util.Date as the parameter. java.sql.Date sqlDate = […]

Wayan · 1 min read
JDOM / NOTES</>↗
JDOM04 May 2009

How do I remove an attribute from XML element in JDOM?

The following example shows you how to remove attributes from an XML element. We will remove attribute named userid from the <row> element. To remove an attribute you can call the removeAttribute(String name) method of the Element object. package org.kodejava.jdom; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.input.SAXBuilder; import org.jdom2.output.Format; import org.jdom2.output.XMLOutputter; import java.io.File; public class JDOMRemoveAttribute […...

Wayan · 2 min read
JDOM / NOTES</>↗
JDOM03 May 2009

How do I remove an element from XML document in JDOM?

This example show you how to remove an element from XML document. In the code snippet below we start by loading an XML document and display its original contents. After that we find the element <row>, and remove the <address> element from it. To get the first child we are using the getChild() method from […]

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