AWT / NOTES</>↗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 / NOTES</>↗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 / NOTES</>↗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 / NOTES</>↗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 […]
JASYPT / NOTES</>↗Jasypt10 Apr 2009
This code demonstrate how to use the StandardPBEByteEncryptor class to encrypt and decrypt bytes information. package org.kodejava.jasypt; import org.jasypt.encryption.pbe.StandardPBEByteEncryptor; import java.util.Arrays; public class ByteEncryptorDemo { public static void main(String[] args) { String text = "The quick brown fox jumps over the lazy dog"; System.out.println("Text = " + Arrays.toString(text.getBytes())); StandardPBEByteEncryptor encryptor = new StandardPBEByte...
JASYPT / NOTES</>↗Jasypt08 Apr 2009
This example is showing you how to use the Jasypt API to write a simple code to do string encryption and decryption. In this example we are going to use the BasicTextEncryptor class which use the PBEWithMD5AndDES algorithm. This class is an implementation of the TextEncryoptor interface. You can download the library from their website, […]