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.

JDOM / NOTES</>↗
JDOM02 May 2009

How do I add attributes to an XML elements in JDOM?

The program below will show you how to add attributes to an XML elements. Using JDOM library this can be easily done by calling the Element‘s setAttribute(String name, String value) method. package org.kodejava.jdom; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.output.Format; import org.jdom2.output.XMLOutputter; public class JDOMAddAttribute { public static void main(String[] args) { Document doc = new […]

Wayan · 2 min read
JDOM / NOTES</>↗
JDOM28 Apr 2009

How do I create an XML document using JDOM?

In this small program you can see how to use JDOM to create a simple xml file. Below you’ll see how to create elements of the xml document, set some text for the element. After that you can see how to use the XMLOutputter class to write the JDOM document into file and display it […]

Wayan · 3 min read
JDOM / NOTES</>↗
JDOM28 Apr 2009

How do I create a Document object in JDOM?

The following example show you how to create a simple Document object in JDOM. We can create a new document directly by creating a new instance of the Document class, for additional information we can pass an Element as an argument. To create a Document from an existing XML file we can use the SAXBuilder. […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing24 Apr 2009

How do I get the items of a JList components?

In this example you can see how we can read the items of a JList component. We also obtain the size or the number of items in the JList components. This can be done by calling JList‘s getModel() method which return a ListModel object. From the ListModel we can get the items size, and we […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing22 Apr 2009

How do I set the cell width and height of a JList component?

The cell width and height of a JList can be defined by setting the fixedCellWidth and fixedCellHeight properties. These properties have a corresponding methods called setFixedCellWidth(int width) and setFixedCellHeight(int height). package org.kodejava.swing; import javax.swing.*; import java.awt.*; import java.util.Vector; public class JListCellWidthAndHeight extends JFrame { public JListCellWidthAndHeight() { initialize(); } public static void main(String[] args) { […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing18 Apr 2009

How do I create a JList component?

JList is a component that displays a list of objects and allow user to select one or more items. To create an instance of JList we can pass a vector, an array of objects or a ListModel. In this example we will pass an array of objects that contains a date, string and numbers as […]

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