Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-09-2008, 02:46 PM
geork's Avatar
Member
 
Join Date: Jan 2008
Posts: 14
geork is on a distinguished road
problem with getting new JFrames
hey everone!
i have a little problem with this program i wrote:
Code:
class uu { public static void main(String args[]){ new u(); } }
Code:
import static java.lang.System.out; import javax.swing.*; import java.util.Scanner ; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; class u extends JFrame implements ActionListener{ JTextField TextFieldText1 = new JTextField(10); JTextField TextFieldText2 = new JTextField(10); JTextField TextFieldText3 = new JTextField(10); JLabel label1 = new JLabel("type in name, address and money"); JLabel label2 = new JLabel("click finish to finish"); JLabel label3 = new JLabel("or addUser to add an account"); JButton finishButton = new JButton("finish"); JButton addUserButton = new JButton("addUser"); public u(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ; setLayout(new FlowLayout()) ; add(TextFieldText1); add(TextFieldText2); add(TextFieldText3); add(label1); add(label2); add(label3); add(finishButton); finishButton.addActionListener(this); add(addUserButton); addUserButton.addActionListener(this); pack(); setVisible(true); } public void actionPerformed(ActionEvent e){ if(e.getSource()==addUserButton){ TextFieldText1.setEnabled(false); TextFieldText2.setEnabled(false); TextFieldText3.setEnabled(false); new u(); new uuu(); }else{ TextFieldText1.setEnabled(false); TextFieldText2.setEnabled(false); TextFieldText3.setEnabled(false); new uuu(); } } }
Code:
import javax.swing.*; import java.util.Scanner ; import java.awt.FlowLayout; class uuu extends u { public uuu(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ; setLayout(new FlowLayout()) ; add(new JLabel(TextFieldText1.getText())); add(new JLabel(TextFieldText2.getText())); add(new JLabel(TextFieldText3.getText())); pack(); setVisible(true); } }
when i execut it and click any button it just made another u class and never went to uuu.
thankyou if you can help me
__________________
he who laughs last probabely just got the joke
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Handling Two JFrames hiranya AWT / Swing 2 11-05-2007 09:23 AM


All times are GMT +3. The time now is 04:42 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org