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



Home Answers Viewqa Java-Beginners Hiding a JFrame

Have Programming Question? Ask it here!
 
 
 


T.Thanga meena
Hiding a JFrame
1 Answer(s)      2 years and 9 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
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
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
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
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
insert image in JFrame - Development process
); } static public void main(String args[]) throws Exception { JFrame frame = new JFrame("Display image"); Panel panel = new ShowImage
JFrame components printing - Swing AWT
JFrame components printing  hi sir thanks a lot for your reply... but i go through the link that you have specified http://www.roseindia.net/java... PrintExample extends JFrame implements ActionListener { public static void main
JFrame components printing - Swing AWT
JFrame components printing  hi sir thanks a lot for your reply... but i go through the link that you have specified http://www.roseindia.net/java... PrintExample extends JFrame implements ActionListener { public static void main
JFrame Components Printing - Swing AWT
JFrame Components Printing  hi sir thanks a lot for your reply... but i go through the link that you have specified http://www.roseindia.net/java... this public class PrintExample extends JFrame implements ActionListener { public
display multiple images from postgres database in jframe
display multiple images from postgres database in jframe  i just want to display multiple images on jframe by firing a query on postgres database
Java Image On JFrame Title
How to set Image On JFrame In this section, you will learn how to set an image on JFrame title using Java program. For this, we have created an object of JFrame class. Then, we have used Toolkit.getDefaultToolkit().getImage
How to create file from input values in Jframe ?
How to create file from input values in Jframe ?  hi i m doing my... an object for it.my java code is public class submit { JFrame frame; JTextArea text1; void form() { frame=new JFrame("details you have entered are"); JPanel
passing data from one jframe to another
passing data from one jframe to another  I have two JFrame,built... in the first Jframe to another JLabel in the other JFrame.Can you please help me,how...*; import java.awt.event.*; class PassData extends JFrame { JTextField text
how to draw a table on jframe in java - Java Beginners
how to draw a table on jframe in java  how to draw a table on jframe in java?  Hi friend, import java.awt.*; import... scrollPane = new JScrollPane(table); JFrame frame = new JFrame
Exception when opening a excel file in JFrame
Exception when opening a excel file in JFrame  Hello, I have a problem when trying to display a Excel file in a Jframe. The exception is like...() throws ExcelException{ JFrame frame= new JFrame("Test application
Program to read the text from a file and display it on a JFrame.
Program to read the text from a file and display it on a JFrame.  ...*; class MegaViewer1 extends JFrame { JTabbedPane jtp1=new JTabbedPane... java.lang.*; import java.awt.*; class MegaViewer1 extends JFrame { JTabbedPane jtp1
how to open one Jframe from main method call
how to open one Jframe from main method call  I have downloaded...(is a JFrame) Rules.java(is a JFrame) PlayGame.java have three buttons Play - i... Rules.java Jframe should be opened Exit - exits the application Now what i want
how to use a JInternalFrame in a JFrame to create a chat window in a client/server app?
how to use a JInternalFrame in a JFrame to create a chat window in a client/server app?  how to use a JInternalFrame within a JFrame? i want to create a client/server app. i know that JIternalFrame should be used
Adding text in to text area of jframe at new line with different background colour
Adding text in to text area of jframe at new line with different background colour  Hi, I am reading text from text file and i want to write... colour. it is possible in text area of jframe
java program to read multiple files from a directory and display them on a jframe
java program to read multiple files from a directory and display them on a jframe  hi guys i want to write a java program that will read all files in a directory and display them one by on on a jframe on jpanel with specific key
Displaying search results in same panel of gridview in same jframe window.
Displaying search results in same panel of gridview in same jframe window... search and see the results in the same panel of the Jframe in Gridview Jtable... in the Jtable gridview format in the sam epanel of jframe window .But when i execute
Displaying search results in same panel of gridview in same jframe window.
Displaying search results in same panel of gridview in same jframe window... search and see the results in the same panel of the Jframe in Gridview Jtable... in the Jtable gridview format in the sam epanel of jframe window .But when i execute
Problem in setting IP address for a JFrame Class Desktop Application
Problem in setting IP address for a JFrame Class Desktop Application  I have designed a browser for our final year project, it is working well. But when we put it in a system which has a proxy setting for internet connection
navigating the value of JTextField from one JFrame to another - Swing AWT
navigating the value of JTextField from one JFrame to another  hello... JFrame .... Can anyone plz tell me how we can do this...can anybody give me... java.awt.event.*; public class NavigateTextField extends JFrame{ JLabel
navigating the value of JTextField from one JFrame to another - Swing AWT
navigating the value of JTextField from one JFrame to another  Hello first of all thankyou very very much for your reply.. the code which you gave... JFrame{ JLabel label1,label2; JTextField text1,text2; JPanel panel; JButton
Advertisements
 

 

 

DMCA.com