TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Monday, 13 April 2020

Java Swing | Java Swing program | Java Swing In Hindi

Java Swing 

Java Swing  is a part of 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.

Java Swing Examples

There are two ways to create a frame:
  • By creating the object of Frame class (association)
  • By extending Frame class (inheritance)


Example:- 

    import javax.swing.*;  
    public class FirstSwingExample {  
    public static void main(String[] args) {  
   JFrame f=new JFrame();//creating instance of JFrame  
          
   JButton b=new JButton("click");//creating instance of JButton  
   b.setBounds(130,100,100, 40);//x axis, y axis, width, height  
          
   f.add(b);//adding button in JFrame  
          
   f.setSize(400,500);//400 width and 500 height  
   f.setLayout(null);//using no layout managers  
   f.setVisible(true);//making the frame visible  
   }  
   }  


example of java swing


Fig: Java Swing

No comments:

Post a Comment