Results 1 to 5 of 5
- 03-31-2012, 07:40 PM #1
Senior Member
- Join Date
- Dec 2011
- Posts
- 102
- Rep Power
- 0
problem with combining JFrame+JLabel+JTextField
Hi,
I've been asked to make a program that pops up a form with textfields and stuff.
I've started working on it and saw that textfields i've made wouldn't show up on the frame when i run the program.
The idea is to create a frame which has labels and in every label there're text fields. I didn't add all the test fields yet (because i've realized I'm not doing it right
), thought the first label "PersonalInformation is written already so u can see what I've done wrong.
Here's the class:
Thanks a lot guys. (dunno what I'd have done without this forumJava Code:class ApplicationForm extends JFrame { private JLabel PersonalInformation = new JLabel("Personal Information"); private JLabel ListOfReferences = new JLabel("List of references"); private JLabel ProgramingLanguages = new JLabel("Programing Languages"); private JTextField FirstName = new JTextField("First Name:",10); private JTextField LastName = new JTextField("Last Name:"); private JTextField Adress = new JTextField("Adress:"); private JTextField Cellular = new JTextField("Cellular:"); public ApplicationForm (){ super("Application Form"); setSize(550,400); setVisible(true); setAlwaysOnTop(isAlwaysOnTop()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.PersonalInformation.add(FirstName); this.PersonalInformation.add(LastName); this.PersonalInformation.add(Adress); this.PersonalInformation.add(Cellular); add(PersonalInformation,BorderLayout.NORTH); add(ListOfReferences,BorderLayout.CENTER); add(ProgramingLanguages,BorderLayout.SOUTH); } }
)
- 03-31-2012, 07:59 PM #2
Re: problem with combining JFrame+JLabel+JTextField
Can you change the code so that it will compile and execute for testing. It needs imports and a main method
If you don't understand my response, don't ignore it, ask a question.
- 03-31-2012, 08:29 PM #3
Senior Member
- Join Date
- Dec 2011
- Posts
- 102
- Rep Power
- 0
Re: problem with combining JFrame+JLabel+JTextField
yea, I've done it on my own program ofc.
I've just copied this class here though coz the main class has only the main method which has only one row that creates the object of the class above.
I've figured the last one out myself eventually, I haven't realized I can't add stuff into a JLabel, I thought it's some kind of JFrame.
I think I'll try to handle it now. in case I'll have another problem with it (surely i will : \ ), I'll post here the whole program and not just the specific class.
Thanks for your time :)
- 03-31-2012, 08:32 PM #4
Re: problem with combining JFrame+JLabel+JTextField
You don't need to post any more code than is necessary to compile, execute and show the problem. Often the whole program has a lot of unrelated stuff in it that gets in the way. A minimum sized working test program is preferred.
If you don't understand my response, don't ignore it, ask a question.
- 03-31-2012, 09:02 PM #5
Senior Member
- Join Date
- Dec 2011
- Posts
- 102
- Rep Power
- 0
Similar Threads
-
Problem Loading JTextField in JFrame / Problema al cargar JTextField en JFrame
By thor_inc in forum AWT / SwingReplies: 0Last Post: 08-30-2011, 09:18 AM -
Cannot refresh a JLabel on a JFrame
By carnotan in forum AWT / SwingReplies: 11Last Post: 03-25-2011, 03:02 PM -
JLabel/JTextfield Animation
By weikang in forum AWT / SwingReplies: 1Last Post: 01-05-2011, 02:55 PM -
[SOLVED] Adding JLabel to JFrame
By mlfatty in forum AWT / SwingReplies: 3Last Post: 03-04-2009, 11:33 PM -
help me with JFrame and JLabel
By michcio in forum New To JavaReplies: 5Last Post: 11-20-2007, 07:44 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks