Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Hiding a JFrame
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


T.Thanga meena
Hiding a JFrame
1 Answer(s)      2 years and 11 months ago
Posted in : Java Beginners


Hi All,

I need to open two windows at a time and need not to access the behind one when I am using the first one. When I am clicking the behind one it?s getting access.It should not get access.How to do this one.Please help me.


Advertisement
View Answers

October 10, 2011 at 1:09 PM


1)PassData.java:

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

class PassData extends JFrame
{
    JTextField text;
    PassData(){
        JLabel l=new JLabel("Name: ");
        text=new JTextField(20);
        JButton b=new JButton("Send");
        setLayout(null);
        l.setBounds(10,10,100,20);
        text.setBounds(120,10,150,20);
        b.setBounds(120,40,80,20);
        add(l);
        add(text);
        add(b);
        setVisible(true);
        setSize(300,100);
          b.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
            String value=text.getText();
            NextPage page=new NextPage(value);
            page.setVisible(true);
            setVisible(false);
            }
        });
    }
        public static void main(String[] args) 
    {
        new PassData();
    }
}

2)NextPage.java:

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

class NextPage extends JFrame
{
  NextPage(String st)
   {
     setLayout(null);
     setDefaultCloseOperation(javax.swing. WindowConstants.DISPOSE_ON_CLOSE);
     setTitle("Welcome");
     JLabel lab=new JLabel("Welcome  "+st);
     lab.setBounds(10,10,500,20);
     add(lab);
     setSize(300, 100);
      }
 }


Related Tutorials/Questions & Answers:
Hiding a JFrame
Hiding a JFrame  Hi All, I need to open two windows at a time... javax.swing.*; import java.awt.event.*; class PassData extends JFrame { JTextField... java.awt.*; import java.awt.event.*; class NextPage extends JFrame { NextPage
Hiding a JFrame
Hiding a JFrame  Hi All, I need to open two windows at a time... javax.swing.*; import java.awt.event.*; class PassData extends JFrame { JTextField... java.awt.*; import java.awt.event.*; class NextPage extends JFrame { NextPage
Advertisements
JFrame
JFrame  write an application with a JFrame that five labels describing reasons that a customer might not buy your product(for example "Too expensive") every time the user clicks a Jbutton, remove one of the negative reasons
jframe
jframe  Create a JFrame for the Summervale Resort. Allow the user to view the information about different rooms available, dining options and activities offered. Include at least two options in each menu and display appropriate
JFrame
Jframe. How can i do it. Please help me to do it. Or what else can i have
Hiding Source Code - WebSevices
Hiding Source Code  Is there any way to prevent viewing source code in browser
Cursor hiding in jQuery
Cursor hiding in jQuery  Hello sir I want to hide the mouse cursor in entire web page. I heard from one of my friend that it is possible using JQuery. Please give me code ?   Hi friend Your problem is very simple
Hiding form values using ajax
Hiding form values using ajax  i am trying to show and hide form values with ajax but it's not working,but in javascript it is working.Can anyone will help me to the work in ajax please. Thanks in advance
Hiding and showing elements on the page
Hiding and showing elements on the page       Hiding and showing elements on the page .hide( ) This method is used to hide the matched elements
Jtree Nodes auto Hiding Problem
Jtree Nodes auto Hiding Problem  Have a nice day to everyone I am using Jtree and developed one hierarchic model as per requirement but i am having large no. of node so i have to hide of fold those node which i am not looking
Refresh JFrame
Refresh JFrame  How to refersh a JFrame and its componets
how to reset JFrame
how to reset JFrame  how to reset JFrame
refresh checkbox jframe
refresh checkbox jframe  How to refresh checkbox button in JFrame
jframe background color not showing
jframe background color not showing  jframe background color is not showing. please suggest.   Just add the background color to JPanel and then add it to JFrame. For example .. JFrame myFrame = new JFrame(); JPanel
jumping frame jFrame to jInternalframe
jumping frame jFrame to jInternalframe  Afternoon sir, I want to ask... and sub menu(employee). in Form Login(jFrame) have username(textfield1) and password(passwordfield1), in Menu(jframe) have Menu employee(jMenu),creaby(jlabel1
Removing the Title Bar of a JFrame
Removing the Title Bar of a JFrame  How to remove the Title Bar of a JFrame in Swing Application?   Please check the tutorial Removing the Title Bar of a Frame for the source code and example description. Thanks
JFRAME - Java Beginners
javax.swing.*; import java.awt.event.*; public class MenuExample extends JFrame
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...("serial") public class AddPage extends JFrame { JDesktopPane pane = new
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...("serial") public class AddPage extends JFrame { JDesktopPane pane = new
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...("serial") public class AddPage extends JFrame { JDesktopPane pane = new
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to move label in jframe in java?
how to move label in jframe in java?  please any one can give me code for moving a java label in Jframe
Java Spring Desktop application with multiple classes and jframe
is called,this Jframe is not disposing or hiding... and classes...How to close one Jframe from another..Please tell... First jframe...;This is not disposing Jframe2** t.dispo(); } Second Jframe package
JFrame Button click to start play
JFrame Button click to start play  i made a game and and i add a button in new jframe and i want when i click it it start to play...can anyone help me
JFrame Components Printing - Swing AWT
JFrame Components Printing  hi sir i am doing a project so i am working in netbeans i have to print a JFrame it contains Labels and few textboxfields so i want to take the whole JFrame contents for printing so would you
setbackground image to JFrame - Java Beginners
setbackground image to JFrame   how to setbackground image to JFrame... TransparentBackgroundImage { public static void main(String[] args) { JFrame frame = new JFrame(); frame.addWindowListener( new WindowAdapter() { public
Advertisements
 

 

 

DMCA.com