• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is wrong with this JInternalFrame Code?

 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


What is wrong with this JInternalFrame Code? I have written two such application codes and they worked well but now this time JInternalFrame is not showing?

I can add it directly to JFrame and show it




Thanks in Advance,

Maki Jav
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why is the Integer there? What happens if you omit it?
[ March 04, 2008: Message edited by: Rob Prime ]
 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it is in the api. You are an SCJP and don't know about that?
Beside I said I have used this code in 2 applications before without problem. Even when I used int instead of the Integer, the result is the same.

I got this Integer from JBuilder code snippet

Container has this:
public Component add(Component comp,
int index)

Maki Jav
[ March 04, 2008: Message edited by: Maki Jav ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the posted code 'luf' has no size

missing is the
luf.setBounds(..);
 
Brian Cole
Author
Ranch Hand
Posts: 908
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maki Jav:
Maybe it is in the api. You are an SCJP and don't know about that?
Beside I said I have used this code in 2 applications before without problem. Even when I used int instead of the Integer, the result is the same.

I got this Integer from JBuilder code snippet

Container has this:
public Component add(Component comp,
int index)


Maybe instead of deriding Mr. Prime you should listen to him, since he's trying to help you.

Of course it's in the API, no 'maybe' about it. In fact there are four add() methods:

add(Component comp) // #1
add(Component comp, int index) // #2
add(Component comp, Object constraints) // #3
add(Component comp, Object constraints, int index) // #4

When you call desktopPane.add(luf,new Integer(1)) you are passing a java.lang.Integer object as a layout constraint to #3. If that's not your intent, then don't do that.

If you use an "int instead of the Integer" then you are invoking #2. This might be ok, but what's your motivation for doing this? Most of us would just call #1 and be done with it.

That may or may not have anything to do with your problem. It's hard to say without knowing more about your LookUpForm class. I presume that it's a subclass of JInternalFrame and that its constructor calls one of setSize()/setBounds()/pack().
 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Brain for replying.

It size that was not defined for luf ie lookUpForm the JInternalFrame.




Tahnk you,

Maki Jav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic