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



Home Answers Viewqa Java-Beginners opening new window

Have Programming Question? Ask it here!
 
 
 


vandana
opening new window
1 Answer(s)      4 years and 9 months ago
Posted in : Java Beginners



Advertisement
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
Opening a URL from an Applet       Introduction This is the example of opening a url in same window from an applet. This program shows that how a url is opened 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
Java - Opening a URL from an Applet
;    - show in a new, top-level window "string"... Java - Opening a URL from an Applet       This is the example of opening a url in same
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
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
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
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html
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
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 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
"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 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
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 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
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
JFrame - Window
. . . this.setTitle("My new window... Java: JFrame - Window Description The javax.swing.JFrame class is used to create a "window". This window has a few characteristics of its own (title
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
Example - Tiny Window
; //Note 2 window = new JFrame... Java NotesExample - Tiny Window The example discussed here is used to create tiny window in swing. The TinyWindow.java - Creates a very small window
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. Thank you.   Hi, To add a new view you can use following
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
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
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
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
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
Error Opening File - Java Interview Questions
Error Opening File  Dear, Please if help me to resolve this problem. I have an application in java that works correctly under Eclipse... this generated file, a message was displayed: Error opening file. But If I
Passing values from child window to parent window.
Passing values from child window to parent window.  http://www.roseindia.net/java/pass-value-example/pass-value-child-to-parent.shtml I have gone thru the link but my requirement is checkboxes.can u please explain
Help with opening a text file upon closing a program.
Help with opening a text file upon closing a program.  I need some...() { mainFrame = new JFrame("Swimming Pool Volume Calculator"); calcButton = new JButton("Calculate Volume
First Window
(String[] args) { JFrame window = new JFrame("My First Window... variable to hold JFrame. window = new JFrame(); // Create new... Java NotesExample - First Window This is about the simplest GUI
Exception when opening a excel file in JFrame
Exception when opening a excel file in JFrame  Hello, I have...() throws ExcelException{ JFrame frame= new JFrame("Test application...( new BorderLayout()); JWorkbook workbook = new JWorkbook
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
The Window Event - Swing AWT
The Window Event  hey plz i need help here... plz modify... extends JFrame implements ActionListener { JButton exit_button = new..., 700); setTitle("The Window Button"); setVisible(true
 

 

 

DMCA.com