how to create frame in swings

Ads
 

how to create frame in swings

how to create frame in swings

View Answers

August 23, 2011 at 5:09 PM

Simple Example

import javax.swing.*;

public class FrameExample{
  public static void main(String[] args){
  JFrame frame = new JFrame("Frame in Java Swing");
  frame.setSize(400, 400);
  frame.setVisible(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

Another Example

import java.awt.*;
    import javax.swing.*;
    class FrameExample 
    {
        public static void main(String[] args) 
        {
            JFrame f=new JFrame();
            f.setLayout(null);

            JLabel lab1=new JLabel("Name");
            JLabel lab2=new JLabel("Age");

            JTextField text1=new JTextField(20);
            JTextField text2=new JTextField(20);

            lab1.setBounds(10,10,100,20);
            text1.setBounds(120,10,100,20);

            lab2.setBounds(10,40,100,20);
            text2.setBounds(120,40,100,20);

            f.add(lab1);
            f.add(text1);
            f.add(lab2);
            f.add(text2);

            f.setVisible(true);
            f.setSize(300,150);
        }
    }

For more information, visit the following link:

Swing Tutorials

Ads









Related Tutorials/Questions & Answers:
how to create frame in swings
how to create frame in swings  how to create frame in swings
How to create form in Swings
How to create form in Swings  How to create registration, login and question form in Java Swing?   Creating different forms in Java Swing - Examples how to create registration form in swing swing login form example
Advertisements
How to create XML from Swings
How to create XML from Swings  How to create XML using Swings. I have a Swing GUI and capturing all data from it.When i click on submit, an xml...[]){ CreateXML frame=new CreateXML(); frame.setSize(300,300); frame.setVisible(true
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
How To Create Internal Frames In Java
will demonstrate you how to create frames within a frame. In this example we...How To Create Internal Frames In Java In this tutorial we will learn about how to create a frame within a frame. Some times you will need to display a frame
how can we store the encrypted passwaord in swings?
how can we store the encrypted passwaord in swings?   how can we store the encrypted passwaord in swings
How to center a frame
How to center a frame In this tutorial, you will learn how to center a frame on screen. A Frame is a top-level window having a title and a border and its... and minimize also. Here we are going to center the frame on the screen
how to add panel inside frame?
how to add panel inside frame?  I prepared a Frame with two labels and text fields and one button.when ever user clicks on the button two text fields should be appear(those text fields should be added to the panel) .I want
how to print JInternal frame component ?
how to print JInternal frame component ?  hello sir, i devalop a swing application .but problem is that how display report & print it. some data prefech from database & keep to jtable but how it is print with table
Java Swing Create XML file
Java Swing Create XML file In this tutorial, you will learn how to create XML file using swings. Here is a code that accepts the data from the user through... on frame to accept the data from the user. A button is there to perform an action
how to add audio clip in swings with event handling
how to add audio clip in swings with event handling  hello dear, i wanna to play audio clip in java program in JFrame in swings by event handling... how it can be done...... thanks alot
How to make frame of the picture, make frame of the picture, frame of the picture
How to make frame of the picture       This is about a frame example that has been made by some steps, I have mention here all the steps to make this effect. Take picture: First
SWINGS
SWINGS  WHAT ARE THE DIFFERENCES BETWEEN AWT AND SWINGS
How to Synchronize the Entire collection Frame Work?
How to Synchronize the Entire collection Frame Work?  How to Synchronize the Entire collection Frame Work?   I Think We must implement the Through Sub Interfaces of Collection Frame work
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which... of that frame ,frame is displaying but no other content. that frame contains
How to make non resizable frame in Swing?
How to make non resizable frame in Swing?  I want code for making JFrame no re-sizable in the Swing based desktop application. Share me the code for this purpose. Thanks   Hi, Please check the tutorial Making a Frame
how to create notepad in java
how to create notepad in java  how to create notepad in java
how can i print the selected content of a frame
how can i print the selected content of a frame  hello sir, I am designing a bill calculate program. I want to print the bill in crystal form. I want to skip all the text fields shapes and all the button from the frame.. but all
how to create session for login
how to create session for login  how to create session for login? how to display uploaded resume and images in the profile
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which... of that frame ,frame is displaying but no other content. that frame contains
How to create a class in java
How to create a class in java  I am a beginner in programming and tried to learn how to do programming in Java. Friends please explain how can I create a class in Java
how to create web aplli
how to create web aplli  how to Create a web application using any technology to display 10 most relevant tweets from Twitter in real-time for the keyword "@cldmgc
how to create web aplli
how to create web aplli  how to Create a web application using any technology to display 10 most relevant tweets from Twitter in real-time for the keyword "@cldmgc
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much
how to create a table
how to create a table  create table tablename (name varchar(10),name.... Use the following query: create table tablename (name varchar(10),address varchar(10)); For more information, visit the following link: Java Create
swings
swings  Thank you deepak it is fine.... I think you have gone through mine sent code in that i am not able add that Textfield dynamically. Can youhelp me how can i add textfields dynamically in my code lookin forward to hear
How To Create a Table.
How To Create a Table.  How To Create a Table?   Hi friends, If you want to create a table, you can run the CREATE TABLE statement..._config.php"; $sql = "CREATE TABLE user_info(" . " id INTEGER NOT NULL" . ", name
How to set the Gradient Color as a background color for Java Frame?
How to set the Gradient Color as a background color for Java Frame?  How to set the Gradient Color as a background color for Java Frame
how to display duplicate elements with out using collection Frame work?
how to display duplicate elements with out using collection Frame work?  how to display duplicate elements with out using collection Frame work
how to create rdd in pyspark
how to create rdd in pyspark  Hi, I am have to create an RDD from a String in PySpark. How to do this? How to create rdd in pyspark?   Hi, Its easy you can use the following code example: data = sc.parallelize(list
how to create uiwebview programmatically
how to create uiwebview programmatically  How to create uiwebview programmatically in iPhone application?   Given is the code that will create the WebView programmatically in iPhone.. CGRect webFrame = CGRectMake(0.0

Ads