Skip to main content

Jframe Form Designing sample

Advance JAva-Jframe Form Designing sample Code




import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;



public class Sample extends JFrame 
{
public Sample()
{
    setTitle("Home");
  
 
getContentPane().setBackground(Color.orange); 
     setSize(300,200);
     setLayout(null);
  
  
  setDefaultCloseOperation(EXIT_ON_CLOSE);
 
   setLocation(100, 100);
 
      
 
  JLabel l0=new JLabel("Registration");
       l0.setBounds(10,0,100,20);
  add(l0);
 JLabel l1=new JLabel("Enter Name");
 l1.setBounds(30,20,100,20);
 add(l1);
     JTextField textFieldUserName = new JTextField(50);
    textFieldUserName.setBounds(110,20,60,20);
      add(textFieldUserName);
   
   
      JButton b1=new JButton("Click Me");
 b1.setBounds(30,100,100,20);
 add(b1);
  
  
    JLabel l2=new JLabel("Select city");
 l2.setBounds(30,50,100,20);
 add(l2);
  
  JComboBox c1=new JComboBox();
  c1.addItem ("pune");
   c1.addItem ("Nagar");
c1.addItem ("Nasik");
 
c1.setBounds(110,50,100,20);
 add(c1);
   
   
     
      setVisible(true);
 




}


public static void main(String s[])
{
Sample obj=new Sample();

}

}

Labels

Show more

Popular posts from this blog

jbutton Click Event example Advance Java

Jbutton Click Event example Advance Java  Change frame Color On Button click Advance Java  import javax.swing.*; import java.awt.*; import java.awt.event.*;      class FrameDemo extends JFrame implements ActionListener {       JButton btn; Container c;          FrameDemo() {               c=this.getContentPane();        JButton btn= new JButton("Click"); btn.setBounds(100,50,100,50);         c.add(btn);         c.setLayout(null);        btn.addActionListener(this); }                    public void actionPerformed(ActionEvent a) {                     c.setBackground(Color.RED); } }        // cre...

Nested Classes sample program

Nested Classes In Java, just like methods, variables of a class too can have another class as its member. Writing a class within another is allowed in Java. The class written within is called the nested class , and the class that holds the inner class is called the outer class . class Outer {  private class Inner  {    void dispaly()    {        System.out.println("this is inner class");       }   }  void call()  {    Inner obj=new Inner();    obj.dispaly();  } } class InnerDemo { public static void main(String s[]) {  Outer ob=new Outer();  ob.call(); } } Example solve watch video for understanding  // inner class By Prakash Sonar class outer {  private class Inner  {    void display()   {      System.out.println...

java project using CMD Source Code Download

java project using CMD Source Code Download import java.sql.*; import java.*; import java.io.*; class whileInfinite { public static void main(String s[]) {  try{ while(true) { System.out.println("Select Your Choice :"); System.out.println("________________________________________"); System.out.println("1. Insert record :"); System.out.println("2. disply all records :"); System.out.println("3. display Specific record :"); System.out.println("4. update record:"); System.out.println("5. delete Record:"); System.out.println("6. Exit:"); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));           System.out.println("Enter your choice"); int choice = Integer.parseInt(reader.readLine()); System.out.println("yo entered"+ choice); switch(choice) { case 1:whileInfinite obj=new whileInfin...