File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes not showing JLabel and TextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "not showing JLabel and TextField" Watch "not showing JLabel and TextField" New topic

not showing JLabel and TextField

numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
hi to all...
i am new in java and try to learn awing....The program that i made is not showing me any TextField and JLabel ...

i also have made a Main class to run it....
Darryl Burke

Joined: May 03, 2008
Posts: 5115

Please review Christophe Verré's response on your your earlier thread.

There's a lot wrong here. One,your class extends JFrame but also constructs a JFrame f, which is never used. Then, there's a setVisible(true) before any components are added. And since JFrame has a default BorderLayout, and you add 10 components without any constraints, only the last of these will be managed by the layout manager.

I suggest you go through the Swing tutorial trail, doing all the exercises as you go along. There's really no substitute for learning how to do things correctly.

luck, db
There are no new questions, but there may be new answers.
numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
thank you very much sir

i make a database and also define a interface to retrieve data from database...i created four button out these four button only one button is working and reaming are not.....when i click on these button and receive a message on cmd which is like that...

java.sql.SQlException Result set type is TYPE_FOREWORD_ONLY

i did not getting it please tell me about that?
Rob Spoor

Joined: Oct 27, 2005
Posts: 20276

Please create a new thread in our JDBC forum for that problem. It's not GUI related, and a related but still different problem from the one this thread is about.

But the reason is simple: by default you can only go forward in ResultSets. The (Prepared)Statement must be created using one of the other types (TYPE_SCROLL_INSENSITIVE or TYPE_SCROLL_SENSITIVE).

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: not showing JLabel and TextField
It's not a secret anymore!