How to have a jLabel update its values automatically from the values in a jTextField.This article will describe how to update the jLabel from the jTextfield values automatically along with example source code. Assume that you have a jLabel called jLabel3 and a jTextfield called jTextField1 Here is the source code to be used.The keyReleased Continue Reading …
Category: Java
Java run code before exit of the application
If you want to run a section of code immediately before your application exits then this article will tell you how to do it. We will be using the WindowClosing event of the main JFrame class of your application. In the Deign View of your application in the project component navigator right click the JFrame Continue Reading …
Open windows help file on button click in java application
This article will describe how to open a windows help file .chm file in a java application as a result of a button click or click on a menu item, along with example source code to achieve the result. Add the following code to the actionperformed event of the button or the menu item Continue Reading …
Encrypt and Decrypt a file in java
This article will describe how to encrypt and decrypt a file in java. We shall demonstrate file encryption using example source code.This source code has been tested to work not only on text files but also on audio video files and images.The name of the file, encrypt/decrypt and the password to be used for the Continue Reading …
Design java swing application with multiple windows
This article will describe how to design a java swing application with multiple windows.The multiple windows will be created with the help of multiple overlapping jPanels of same size within the main jFrame.The example source code will fully illustrate this.You will thus be able to invoke multiple gui windows on click event, where actually one Continue Reading …
Set windows look and feel in java swing application
Setting windows look and feel in a java swing application is easy.This article will explain with the required source code ,how to set windows look and feel for your java swing application. Go to the class which has the main function. Comment the code for the existing look and feel and add the following code Continue Reading …
Running java program from command line
To run a java program from the command line you basically have to execute the compiled jar file. If you have compiled the .jar file then to run the .jar file containing your java program from the command line at the command prompt simply type the arguments are optional Continue Reading …
Set image as icon for jLabel in java
This article will describe how to set a image as icon for a jLabel with example source code.The image will appear as the background of the jLabel.First the image object is created from the image file.Next the scaled instance image object is created.Next the ImageIcon object is created.The SetIcon method is ised to set the Continue Reading …