opening new window

opening new window

View Answers

July 18, 2009 at 11:25 AM

Hi Friend,

Try the following code:

1)'A.java'

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

public class A{
JTextField text;
JLabel label;
JPanel panel;
JButton button;
JFrame frame;
public A(){
frame=new JFrame();
panel=new JPanel(new GridLayout(2,2));
text=new JTextField();
label=new JLabel("Enter Name:");
button=new JButton("SUBMIT");
panel.add(label);
panel.add(text);
panel.add(button);
frame.add(panel,BorderLayout.CENTER);

button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String value=text.getText();
B page=new B();
page.setVisible(true);
JLabel label = new JLabel("Welcome:"+value);
page.getContentPane().add(label);
frame.disable();
}
});
frame.setSize(300,100);
frame.setVisible(true);
}
public static void main(String arg[])
{


A ab=new A();
}

}

2) 'B.java'

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

class B extends JFrame
{
B()
{
setDefaultCloseOperation(javax.swing.
WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Welcome");
setSize(300, 100);
}
}

Thanks









Related Tutorials/Questions & Answers:
opening new window - Java Beginners
opening new window  Hi All, I have two classes with me , lets say... window.i.e., I want to know, how a new window(B) can be opened by clicking a button on the first(parent)window.The show() method does open a new window
JAVA SCRIPT CODE FOR OPENING A WEBSITE IN A NEW WINDOW - Java Beginners
JAVA SCRIPT CODE FOR OPENING A WEBSITE IN A NEW WINDOW   PLS... DATA, IT MUST OPEN A WEB SITE IN A NEW WINDOW. SPECIFICATION:MAKING ONLY "1... in solving the problem : JavaScript Window Open function poponload
Advertisements
Opening a new window in Echo3
Opening a new window in Echo3   ... will create a new Window. To create this example we have created two class files... of an application. Here we have created a new Window by constructing the object
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet       This is the example of opening a url from.... When you click the button "google", new browser window will open
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet  ... will open new browser window and then show you the web page. Opening a new... how to open a new window from an applet. You can use the code given
opening new browser with new JSESSIONID using java
opening new browser with new JSESSIONID using java  I am facing... one IE browser and manually. And i ran my LaunchURL.java file, it is opening new.... I have to open a new browser window with new JSESSIONID. Here is my code
JavaScript Open link in new window
JavaScript Open link in new window...; In this section, you will learn how to open a new window on clicking the link using JavaScript.  To open a new window with a link within the web
how to focus on the new window opened from JSF ?
how to focus on the new window opened from JSF ?  Hi guys, I have commandLink with action which using javascript to open a new window(window.open()). Problem is, the new window opens at background behind the current window
Opening a URL from an Applet
in a new, top-level window "string"  - show in a frame... Opening a URL from an Applet       Introduction This is the example of opening a url in same
ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window'
ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window' ...: ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window' How to remove the ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window
ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window'
ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window' ...: ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window' How to remove the ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window
ModuleNotFoundError: No module named 'odoo8-addon-mail-read-new-window'
ModuleNotFoundError: No module named 'odoo8-addon-mail-read-new-window' ...: ModuleNotFoundError: No module named 'odoo8-addon-mail-read-new-window' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-mail-read-new-window'
ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window'
ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window' ...: ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window' How to remove the ModuleNotFoundError: No module named 'django-visit-on-site-in-new-window
Java - Opening a URL from an Applet
"_blank"    - show in a new, top-level window... Java - Opening a URL from an Applet       This is the example of opening a url in same
Code for opening a new mail from the default mail box and copy the database contents
Code for opening a new mail from the default mail box and copy the database contents  Guys, here is how it goes when i click on a button say "mail... respectively be fetched ,and my default mail should be opened and a new mail
Window
Window  how to create an window of a person like regestration form
JSP Window. Open
;       JSP Window. Open  is used to open a new window in JSP. The JavaScript function  window.open( ) open a new browser...','window name','attribute1, attribute2') : The method allows you to open a new
changes in netbeans/ browser so that each application run opens in a new window of browser
changes in netbeans/ browser so that each application run opens in a new window of browser  hieeee... I want to change netbeans setting. So that each time i run an application it opens up in a new window rather than a new tab
Opening Notepad
Opening Notepad  Sir/madam I want to open notepad from java applications and save the contents on it. Can someone please help me to do this. With Regards Vaishnavi Vishwanath   To open the notepad, just go through
datetime picker is not opening
in this date time picker is not opening. The same opens in JSP code. My code... variables var winCal; var dtToday=new Date(); var Cal; var docCal; var MonthName... of calendar window. var cnLeft="500";//left coordinate of calendar window var
window in center
window in center  if i run the programme thw window is in lie in top left corner i want a window open in center
new
new    hi i am jane pls explain the difference between string greeting = good morning string greeting = new string ("good morning
new
new    hi i am jane pls explain the difference between heap memory and stack memory
new
new  hi the difference between string sname = good morning string sname =new("good morning
Multi window
contains all the details. when i submit this page, a new window opens and asks to enter password. if password entered is correct, the flow goes to previous window
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html
Opening a browser only with body from a java program
Opening a browser only with body from a java program  Hi all, I got following requirement, Opening a browser window only with body and title bar. And based on some condition, after some time, i have to close the browser window
ModuleNotFoundError: No module named 'opening_hours'
ModuleNotFoundError: No module named 'opening_hours'  Hi, My... 'opening_hours' How to remove the ModuleNotFoundError: No module named 'opening_hours' error? Thanks   Hi, In your python
Window Blind
Window Blind  Custom built . Over 30 years of shutter experience. Free in-home consultations
Chat window
the chat window pops up.. It is a div in the chat homepage.. There are few other... in the same application. I want to know how to retain the chat window (along..., the chat window should be constant across all pages in the application for current
window closing
window closing  hello, In my project i have login,logout and some jsp pages are there and each jsp page is using javascript and onunload script. and i need one solution that,when ever user trying to close browser window
IllegalStateException for file opening
){ } File requiredFile = new File(strabsoluteFileName... { OutputStream os = response.getOutputStream(); FileInputStream fis = new... File</th></tr> <% File f = new File("C:/UploadedFiles"); File
IllegalStateException for file opening
){ } File requiredFile = new File(strabsoluteFileName... { OutputStream os = response.getOutputStream(); FileInputStream fis = new... File</th></tr> <% File f = new File("C:/UploadedFiles"); File
Window Script
Window Script  i want to write windows script can you help me in writing those i want to write script so that it follows below steps Step 1) downloading file from FTP 2) Unzip it 3) Edit it 4) zip it 5) upload again to FTP
opening node in treeview struts layout - Struts
opening node in treeview struts layout  Example of opening node in treeview struts layoutopening node in treeview struts layout Hello every one, i am new to this group , i am having the same problem , Struts Layout tree view
"opening video data error" in j2me
"opening video data error" in j2me  Any one know about the error c When i am trying to play video on spice device its throw an exception, but the same code work on other devices very well please tell me the issue behind
Opening IE from Java Swing Application in Kiosk mode
window is opening. But I want to open the IE window in Kiosk mode or without address...Opening IE from Java Swing Application in Kiosk mode  Hi All, I want... & Regards, Abhijith   Here is a simple example of opening IE
Opening files with .jnlp extension on browser!?!?!
Opening files with .jnlp extension on browser!?!?!  I working on UEngine, where to switch into the design phase it creates a PorcessDesigner.jnlp file which gets downloaded on client's side on runtime. I searched into the code
active window means
active window means  active window means what?   The active window is the term used to describe the window that is currently being used
ModuleNotFoundError: No module named 'osm-humanized-opening-hours'
ModuleNotFoundError: No module named 'osm-humanized-opening-hours'  ...: No module named 'osm-humanized-opening-hours' How to remove the ModuleNotFoundError: No module named 'osm-humanized-opening-hours' error? Thanks
ModuleNotFoundError: No module named 'osm_opening_hours'
ModuleNotFoundError: No module named 'osm_opening_hours'  Hi, My... named 'osm_opening_hours' How to remove the ModuleNotFoundError: No module named 'osm_opening_hours' error? Thanks   Hi, In your
JavaScript Open Modal Window
is used to open a new window. It lets the user interact with both of the windows i.e. original window and new opened window. Here we are going to open a popup... to communicate with the original window until the new window is closed. This can
Passing values from child window to parent window.
Passing values from child window to parent window.  Hai, I'm having a requirement ,in that when i open a (pop-up)child window from a parent window,the child window will contain multiple checkboxes and when i select multiple
window addsubview remove in iPhone
window addsubview remove in iPhone  Hi, How to add a splash screen or some other view and then remove it and add new view. I want program for iPhone and iPad.ADS_TO_REPLACE_1 Thank you.   Hi, To add a new view you
child window - Development process
child window  I want to create new small window on my website using java script. But i couldn't hide the status bar in small window. How to do this one ? Kindly help me.   Hi Friend, Please visit the following
opening internet browser in java program - Swing AWT
opening internet browser in java program  i want a code to open...; browsers.length && browser == null; count++) if (Runtime.getRuntime().exec(new... = browsers[count]; Runtime.getRuntime().exec(new String[] {browser, url
making help window
making help window   how to make help window in gui with java
pop up window in java
pop up window in java  How to open a pop up window in Java
POP UP WINDOW
POP UP WINDOW  Dear Sir, Can you please help in providing the methos for opening up a pop up window just after selecting an option from a drop...',then a pop up window should open with name,designation and roll number.Please help me
How to clear a Dos Window? - Java Beginners
How to clear a Dos Window?  problem with the following code: This code is opening another dos window.Is it possible to close the first dos window without exiting from the second window...I don't want to open two windows...how

Ads