SWING / CATATAN</>↗Swing22 Apr 2009
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) { […]
SWING / CATATAN</>↗Swing18 Apr 2009
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 […]
AWT / CATATAN</>↗AWT17 Apr 2009
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 […]
AWT / CATATAN</>↗AWT14 Apr 2009
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 […]
JASYPT / CATATAN</>↗Jasypt13 Apr 2009
Every application that you’ll create may require an authentication process. This authentication process will at least contains a process of checking user’s login name and their password. To make the system reliable the password we usually stored the password in an encrypted form. The BasicPasswordEncryptor which implements the PasswordEncryptor interface provide a BasicPasswordEncryptor.encryptPassword(String password) method […]
JASYPT / CATATAN</>↗Jasypt12 Apr 2009
Creating a digest of a string message can be easily done using the general digester class Digester. First we need to get an instance of Digester, we call the class constructor and pass SHA-1 as the algorithm. After having a Digester instance we create the message digest by executing or calling the Digester.digest(byte[] binary) method […]