Technology Evangelist, Product Engineer, Analytics Expert
Another Swing program demo where I have used 3 layouts to show up the demo which are BorderLayout, BoxLayout, GridLayout.
A layout container that arranges and resizes its components to fit in five regions: north, south, east, west, and center.
Colors in computers are generally made up using RGB mode i.e. Red, Green, Blue.
So in java if we generate random color values for RGB from 0 to 255 each we can make a whole new color out of it by passing this RGB to the color object.
One of the most basic starters program for demonstrating the proper use of Sockets in Java.
The following code makes use of Swing components to illustrate the Client GUI side and the Server side plays the role in Console mode.
In-order to convert from Celsius to Fahrenheit, we have to apply a simple logic onto Celsius "Multiply by 9, then divide by 5, then add 32".
Our code provides a simple GUI, where the user has to enter the temperature in Celsius and after clicking on convert displays the Fahrenheit temperature below button in the form of JLabel.
In-order to convert from Fahrenheit to Celsius, we have to apply a simple logic onto Celsius "Deduct 32, then multiply by 5, then divide by 9".
Our code provides a simple GUI, where the user has to enter the temperature in Fahrenheit and after clicking on convert displays the Celsius temperature below button in the form of JLabel.
JTree is a control that displays a set of hierarchical data as an outline.
We will use it as a menu to navigate through various small applications we made previously.
The following code displays various usage of Swing Components.
This is done in my first Advanced Java practical assignment, so just thought would be useful for others.
Focuses on using various Swing Components and the GridBagLayout usage.
This is an example displaying the usage of JTree Swing Component, how the default mutable nodes work, we can get their path using the TreePath class and hence we can form an heirarchical tree which on click displays the path of the node being selected.
This is an example displaying the usage of JList Swing Component Demo
Here we made a list with 3 Strings and added a display button which shows which of the list value is selected. We also made use of new Dialog box i.e. ConfirmDialogBox and also we made use of JApplet this time & not a JFrame. So inorder to initialise all the components we made use of its init() method which is called first when its loaded
This is a small JAVA Swing GUI login validation program which takes username & password from user and compares with the default values pre-defined. If successful then shows success dialog box else shows failed dialog box.