Java Swing
swing is a set of program component s for Java programmers that provide the ability to create graphical user interface ( GUI ) components, such as buttons and scroll bars, that are independent of the windowing system for specific operating system . Swing components are used with the Java Foundation Classes (JFC).
That is used to create window-based applications. It is built on the top of AWT (Abstract Windowing Toolkit) API and entirely written in Java.
Unlike AWT, Java Swing provides platform-independent and lightweight components. The javax.swing package provides classes for java swing API such as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu, JColorChooser etc.
Popular Java Editors
To write your Java programs, you will need a text editor. There is even more sophisticated IDE available in the market. But for now, you can consider one of the following −
· Notepad − On Windows machine, you can use any simple text editor like Notepad (Recommended for this tutorial).
· Netbeans − Netbeans is a Java IDE that is open source and free, which can be downloaded from https://www.netbeans.org/index.html.
· Eclipse − Eclipse is also a Java IDE developed by the Eclipse open source community and can be downloaded from https://www.eclipse.org/
Setting Up the Path for Windows 10
Assuming you have installed Java in c:\Program Files\java\jdk<version> directory −
Step 1 − Right-click on ‘This pc’ and select 'Properties'.
Step 2 − Click the 'Environment variables' button under the 'Advanced' tab.
Step 3 − Alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk<version>\bin'.
Setting Up the Path for Linux, UNIX
Environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your Shell documentation if you have trouble doing this.
Example, if you use bash as your shell, then you would add the following line to the end '.bashrc: export PATH=/path/to/java:$PATH'.
Swing Features
· Light Weight − Swing components are independent of native Operating System's API as Swing API controls are rendered mostly using pure JAVA code instead of underlying operating system calls.
· Rich Controls − Swing provides a rich set of advanced controls like Tree, Tabbed Pane, slider, color picker, and table controls.
· Highly Customizable − Swing controls can be customized in a very easy way as visual appearance is independent of internal representation.
· Pluggable look-and-feel − SWING based GUI Application look and feel can be changed at run-time, based on available values.
0 comments:
Post a Comment