Creating GUI in Java
To create form screens in Java, import javax.swing.The JOptionPane; library is used. The following is an example of a simple graphics screen that collects.
What is Gui
GUI (graphical user interface) , graphical user interface , visual, intuitive, user friendly (user friendly) ,easy and practical relationship between the program and the user , saving the user from having to have knowledge of the computer, information input/output is provided interface called.Each operating system wants to offer a visually pleasing and user-friendly interface to provide the best user experience.A programmer , to be able to have a good interface, it is necessary to have a mastery of GUI programming.You can use the GUI classes stored in the kernel of the operating system-APIs, or you can use your own drawing procedures and create your own interface system by working more professional.
In short, it is the generic name used to refer to all of the icons, Windows, buttons, and panels, instead of the commands that are run on computers and their outputs.
Gui in Java
Java, a programming language, uses AWT (Abstract window Toolkit) and swing libraries for GUI. The first library created for the interface requirement in Java is AWT. But due to some shortcomings of AWT, a new component set is needed. This new component kit is the swing. The main reason for stopping AWT development was that it was not compatible with Java’s basic policy, “write once, run everywhere”. With an interpreter before compiling applications written in Java language.files with class extensions are translated.This file is an arachodd and is intended to work on each system to produce the same result. In other words, you can run the same code in the Windows operating system as in the Linux operating system.However, programs written with AWT could cause inconsistent results on different systems, and in some cases they could extend to working errors. The swing library is a huge package with all the components required to provide all the tools needed in both GUI and for writing portable applications.
Create Gui Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | package de.vogella.eclipse.ide.first; import javax.swing.JOptionPane; public class MyFirstClass { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hi Eclips"); String fn = JOptionPane.showInputDialog("first number"); String sn = JOptionPane.showInputDialog("second number"); int num1 = Integer.parseInt(fn); int num2 = Integer.parseInt(sn); int sum = num1 + num2; JOptionPane.showMessageDialog(null, "Message Opensourceprojects.org" +sum, "the title", JOptionPane.PLAIN_MESSAGE); } } |