Home Answers Viewqa Java-Beginners opening new window

 
 


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

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 Pages:
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
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 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
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
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 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
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
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
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
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
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
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
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
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
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
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 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
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
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
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
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
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
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
Window
Window  how to create an window of a person like regestration form
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
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
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
Window Container in Flex4
Window Container in Flex4 : This container are use window applications in flex 4. Spark Window container is provide a way if user want to create own window. The Window container are provide layout and content of operating system window
Second Window
Java NotesExample - Second Window The main program of this example is basically identical to that in Example - First Window, but here we define a subclass of JFrame (a window) that constructs a JPanel to put the one component
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
popup window checkbox and sbumit button
popup window checkbox and sbumit button  Hi, Requirement: popup window having multiple checkboxes, I have to select couple of checkboxes and click... = " "; var countries = form.countries.value; var myStringArray = new Array(); var
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
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
Popup Window using Ajax In JSP
Database" button. New Pop window winopenradio.jsp will open which... Popup Window using Ajax In JSP  ... Window application using Ajax in JSP. For this, we will create the following
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
Benefits of Window 8 for Business
this new operating system can benefit them, and Benefits of Windows 8 for Businesses... to shell out money to purchase new set of Hardware. Efforts have been made to increase.... In addition to this, new operating system offers automated backup
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> Location Fill Up Your Details <center> <form action="hit" method="POST">
closing the internet explorer window of any version without confirmation using javascript
closing the internet explorer window of any version without confirmation using... microsoft internet explorer window on onload event without confirmation. It should support all the versions of IE. In future if new version comes. It should
New to Java?
New to Java?       If you are new to Java technology and you want to learn Java and make career... of Abstract Window Toolkit (AWT), Swing and Java2D. With the help of input method
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
MySQL For Window
MySQL For Window       MySQL...;    Basic MySQL Window tutorial This MySQL tutorial is a guide for new MySQL users, providing a reference of very basic, step by step
Displaying search results in same panel of gridview in same jframe window.
Displaying search results in same panel of gridview in same jframe window.  Hello Sir, I have a search frame window from which we can... 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.  Hello Sir, I have a search frame window from which we can... in the Jtable gridview format in the sam epanel of jframe window .But when i execute
Window Blind
Window Blind  Custom built . Over 30 years of shutter experience. Free in-home consultations

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.