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.

HIBERNATE / NOTES</>↗
Hibernate12 Oct 2008

How do I create a pagination using Criteria?

To create a pagination or limit the result set returned by the Criteria query we can use the setFirstResult() and setMaxResults() method. The setFirstResult() method defines the first row to start with and the setMaxResults() method defines the maximum number of records to read. Let’s see the demo below. package org.kodejava.hibernate; import org.hibernate.SessionFactory; import org.hibernate.Session; […]

Wayan · 2 min read
HIBERNATE / NOTES</>↗
Hibernate07 Oct 2008

How do I create a Criteria object?

This example show you how to create an instance of Hibernate Criteria class. To create a Criteria we call the factory method of the Session object and pass the persistence class as parameter. To execute the Criteria query we simply call the list() method. package org.kodejava.hibernate; import org.hibernate.SessionFactory; import org.hibernate.Session; import org.hibernate.HibernateException; import org.hibernate.Criteria; import […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing05 Oct 2008

How do I create a message dialog box?

This example demonstrate how to create a message dialog box using the JOptionPane class methods. In the code below you’ll see the use of JOptionPane.showMessageDialog(), JOptionPane.showInputDialog() and JOptionPane.showConfirmDialog(). package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class MessageDialogDemo extends JFrame { public MessageDialogDemo() throws HeadlessException { initialize(); } public static void main(String[] args) { SwingUtilities....

Wayan · 2 min read
CORE API / NOTES</>↗
Core API03 Oct 2008

How do I execute external command and obtain the result?

This example demonstrate how to execute an external command from Java and obtain the result of the command. Here we simply execute a Linux ls -al command on the current working directory and display the result. package org.kodejava.lang; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; public class ProcessResult { public static void main(String[] args) { try […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing01 Oct 2008

How do I get the JFrame of a component?

This code snippet gives an example on how to get the JFrame of a component. In this example we try to get the JFrame from a button action listener event. To get the JFrame we utilize the SwingUtilities.getRoot() method and this will return the root component of the component tree in out small program below […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing30 Sep 2008

How do I disable JFrame close button?

To disable the close operation on a JFrame, when user click the close icon on the JFrame, we can set the value of the default close operation to WindowConstants.DO_NOTHING_ON_CLOSE. package org.kodejava.swing; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.HeadlessException; public class DisableCloseButtonDemo extends JFrame { p...

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.