how to create frame in swings

Ads

 
 

Share on Google+Share on Google+

raveen
how to create frame in swings
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners

how to create frame in swings

Ads
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 go from one frame to another frame in swings - Java Beginners
how to go from one frame to another frame in swings  Hi, My task is to go from one frame to another.......... let us think that iam having two buttons on a frame........button names are ok and next........ when iam clicking
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
how can i close particular frame in swings - Java Beginners
how can i close particular frame in swings  Hi, I want to know, how can we close a particular frame when mulitple frames are appearing as output... on second frame close button, it should only get close....iam trying this in swings
How to Create Button on Frame
How to Create Button on Frame       In this section, you will learn how to create Button on  frame the topic of Java AWT package. In the section, from the generated output
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 CheckBox On frame
How to create CheckBox On frame     ... will learn how to create CheckBox on the frame. In the Java AWT, top-level windows... can learn in very efficient manner. In this section, you will see how to create
Create a Frame in Java
Create a Frame in Java       Introduction This program shows you how to create a frame in java AWT package. The frame in java works like the main window where your
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
To Create a Frame with Preferences
To Create a Frame with Preferences       In this section you will learn how to use the preferences in frame... with frame window. the required package to use the preferences with frame window
Creating a Frame
Creating a Frame : Swing Tutorials       This program shows you how to create a frame in Java Swing...;javax.swing.*; public class Swing_Create_Frame{   public 
Create multiple pie chart in single frame using JFreeChart
you how to create a multiple pie charts in a single frame in jsp page using... Create multiple pie chart in single frame using JFreeChart.... In the code given below we have extended class ApplicationFrame to create 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 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
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 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
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
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 can i close a frame. - Java Beginners
how can i close a frame.  Hi, My question is how can we close a frame when an action is taken......For example let us think that we have a frame and in that table is displayed and one button is added to that frame
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 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 display jsp frame - Java Beginners
how display jsp frame  Hi all, I am creating two jsp in frame... Create User Manage User... in another frame,you have to use target attribute of tag in your footer.jsp.
how to connect swings with jdbc... - Java Beginners
how to connect swings with jdbc...  Hi friends, Is it possible, to connect swings with data base like oracle....i want to store data into database... by using servlets and jsp but is it possible by using swings........ for data base
How to create an input box?
How to create an input box?  How to create an input box
How to create arrays in JavaScript?
How to create arrays in JavaScript?  How to create arrays in JavaScript
How to create a confirmation box?
How to create a confirmation box?  How to create a confirmation box
how to create notepad in java
how to create notepad in java  how to create notepad in java