This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes What is wrong with this JInternalFrame Code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "What is wrong with this JInternalFrame Code?" Watch "What is wrong with this JInternalFrame Code?" New topic
Author

What is wrong with this JInternalFrame Code?

Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 436
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


Help gets you when you need it!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20


Why is the Integer there? What happens if you omit it?
[ March 04, 2008: Message edited by: Rob Prime ]

SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 436
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

Joined: Jun 09, 2003
Posts: 4632
in the posted code 'luf' has no size

missing is the
luf.setBounds(..);
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
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().


bitguru blog
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 436
Thank you Brain for replying.

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




Tahnk you,

Maki Jav
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is wrong with this JInternalFrame Code?