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.

SWING / NOTES</>↗
Swing21 Apr 2007

How do I close a JFrame application?

Closing a JFrame application can be done by setting the default close operation of the frame. There are some defined constants for the default operation. These constants defined in the javax.swing.WindowConstants interface include EXIT_ON_CLOSE, HIDE_ON_CLOSE, DO_NOTHING_ON_CLOSE and DISPOSE_ON_CLOSE. To exit an application we can set the default close operation to EXIT_ON_CLOSE, this option will call […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API16 Apr 2007

How do I create a method that accept varargs in Java?

Varargs (variable arguments) is a new feature in Java 1.5 which allows us to pass multiple values in a single variable name when calling a method. Of course, it can be done easily using array but the varargs add another power to the language. The varargs can be created by using three periods (…) after […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API15 Apr 2007

How do I use the Stack class in Java?

Stack is an extension of the java.util.Vector class that provided a LIFO (last-in-first-out) data structure. This class provide the usual method such as push() and pop(). The peek method is used the get the top element of the stack without removing the item. package org.kodejava.util; import java.util.Stack; public class StackExample { public static void main(String[] […]

Wayan · 2 min read
SERVLET / NOTES</>↗
Servlet13 Apr 2007

How do I set the maximum age of a cookie?

package org.kodejava.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "CookieExpirationServlet", urlPatterns = "/cookie-expiration") public class CookieExpirationServlet extends HttpServlet { @Override protected void doGet(H...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API11 Apr 2007

How do I know the class of an object?

For instance, you have a collection of objects in an List object, and you want to do some logic based on the object’s class. This can easily be done using the instanceof operator. The operator returns true if an object is an instance of a specified class, if not it will return false. The instanceof […]

Wayan · 2 min read
APPLET / NOTES</>↗
Applet07 Apr 2007

How do I change an applet background color?

By default, the applet will usually have a grey background when displayed in a web browser. If you want to change it then you can call the setBackground(java.awt.Color) method and choose the color you want. Defining the background color in the init() method will change the color as soon as the applet initialized. package org.kodejava.applet; […]

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.