Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » a Labell is never added to JPanel. Is that right?
a Labell is never added to JPanel. Is that right? [message #63534] Thu, 30 September 2004 20:20 Go to next message
David Bo Jensen is currently offline David Bo JensenFriend
Messages: 11
Registered: July 2009
Junior Member
Hi,
Eclipse-sdk-3.0.1-win32
EMF SDK 2.0.1
GEF SDK 3.0.1
VE SDK 1.0.1

Here is what I did
1) I created a "visual class" by clicking on the menu. The superclass was
javax.swing.JFrame
That created a JFrame with a JPanel according to the generated source code.
Why is a JPanel added?

2) Then I added with the mouse a JLabel to the JPanel but that is not
reflected in the generated source code. See below. Is that a fault?
If I save and close and reenter into eclipse, I can no longer see my label.

import javax.swing.JFrame;
import javax.swing.JLabel;
/*
* Created on Sep 30, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/

/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class FrameC extends JFrame {

private javax.swing.JPanel jContentPane = null;

private JLabel jLabel = null; //
@jve:decl-index=0:visual-constraint="162,6"
/**
* This is the default constructor
*/
public FrameC() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300,200);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(new java.awt.BorderLayout());
}
return jContentPane;
}
/**
* This method initializes jLabel
*
* @return javax.swing.JLabel
*/
private JLabel getJLabel() {
if (jLabel == null) {
jLabel = new JLabel();
jLabel.setText("JLabel");
jLabel.setSize(88, 16);
}
return jLabel;
}
}

--
Regards
David Bo Jensen
Re: a Labell is never added to JPanel. Is that right? [message #63558 is a reply to message #63534] Thu, 30 September 2004 20:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

David Bo Jensen wrote:
> Hi,
> Eclipse-sdk-3.0.1-win32
> EMF SDK 2.0.1
> GEF SDK 3.0.1
> VE SDK 1.0.1
>
> Here is what I did
> 1) I created a "visual class" by clicking on the menu. The superclass was
> javax.swing.JFrame
> That created a JFrame with a JPanel according to the generated source code.
> Why is a JPanel added?

Because JFrame's require a content pane. The JPanel is the content pane.
(Note: Currently we can't handle implicit children. In other words we
can't handle the fact that JFrame already has a content pane, so we need
to explicitly create one).

>
> 2) Then I added with the mouse a JLabel to the JPanel but that is not
> reflected in the generated source code. See below. Is that a fault?
> If I save and close and reenter into eclipse, I can no longer see my label.

You didn't add it to the JPanel. It looks like you dropped it on the
freeform (the white area) and not the JPanel.

--
Thanks,
Rich Kulp
Re: a Labell is never added to JPanel. Is that right? [message #63580 is a reply to message #63558] Thu, 30 September 2004 21:00 Go to previous messageGo to next message
David Bo Jensen is currently offline David Bo JensenFriend
Messages: 11
Registered: July 2009
Junior Member
>
> > 2) Then I added with the mouse a JLabel to the JPanel but that is not
> > reflected in the generated source code. See below. Is that a fault?
> > If I save and close and reenter into eclipse, I can no longer see my
label.
>
> You didn't add it to the JPanel. It looks like you dropped it on the
> freeform (the white area) and not the JPanel.
>
It is correct that the area is white, but during the whole process I see
nothing, but the white area. And then the jpanel which later disapears. Is
that right?
Re: a Labell is never added to JPanel. Is that right? [message #63602 is a reply to message #63580] Thu, 30 September 2004 21:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

No that is not right. When you create a subclass of JFrame, you should
at least see the JFrame on the white surface. Then inside the JFrame,
assuming it has been sized large enough, will be the content pane. The
content pane is typically gray. You would drop the JLabel there on the
gray content pane. If everything is white then something is wrong.


--
Thanks,
Rich Kulp
Re: a Labell is never added to JPanel. Is that right? [message #63625 is a reply to message #63602] Thu, 30 September 2004 21:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

In fact, go to the Help Contents and look up the Visual Editor help.
There is a tuturial in there on how to use the VE. There will be
pictures so you can see what it should look like.


--
Thanks,
Rich Kulp
It's all white, but I might have found a workaround [message #63647 is a reply to message #63580] Thu, 30 September 2004 21:41 Go to previous message
David Bo Jensen is currently offline David Bo JensenFriend
Messages: 11
Registered: July 2009
Junior Member
It's also white with JDialog.
By rearangeing the sequence of the methods, something became visible.

--
David Bo Jensen
Re: It's all white, but I might have found a workaround [message #63669 is a reply to message #63647] Thu, 30 September 2004 21:39 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

There is something wrong. If it was created through the VE you shouldn't
be needing to rearrange the methods.


--
Thanks,
Rich Kulp
Re: a Labell is never added to JPanel. Is that right? [message #600269 is a reply to message #63534] Thu, 30 September 2004 20:49 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

David Bo Jensen wrote:
> Hi,
> Eclipse-sdk-3.0.1-win32
> EMF SDK 2.0.1
> GEF SDK 3.0.1
> VE SDK 1.0.1
>
> Here is what I did
> 1) I created a "visual class" by clicking on the menu. The superclass was
> javax.swing.JFrame
> That created a JFrame with a JPanel according to the generated source code.
> Why is a JPanel added?

Because JFrame's require a content pane. The JPanel is the content pane.
(Note: Currently we can't handle implicit children. In other words we
can't handle the fact that JFrame already has a content pane, so we need
to explicitly create one).

>
> 2) Then I added with the mouse a JLabel to the JPanel but that is not
> reflected in the generated source code. See below. Is that a fault?
> If I save and close and reenter into eclipse, I can no longer see my label.

You didn't add it to the JPanel. It looks like you dropped it on the
freeform (the white area) and not the JPanel.

--
Thanks,
Rich Kulp
Re: a Labell is never added to JPanel. Is that right? [message #600276 is a reply to message #63558] Thu, 30 September 2004 21:00 Go to previous message
David Bo Jensen is currently offline David Bo JensenFriend
Messages: 11
Registered: July 2009
Junior Member
>
> > 2) Then I added with the mouse a JLabel to the JPanel but that is not
> > reflected in the generated source code. See below. Is that a fault?
> > If I save and close and reenter into eclipse, I can no longer see my
label.
>
> You didn't add it to the JPanel. It looks like you dropped it on the
> freeform (the white area) and not the JPanel.
>
It is correct that the area is white, but during the whole process I see
nothing, but the white area. And then the jpanel which later disapears. Is
that right?
Re: a Labell is never added to JPanel. Is that right? [message #600290 is a reply to message #63580] Thu, 30 September 2004 21:00 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

No that is not right. When you create a subclass of JFrame, you should
at least see the JFrame on the white surface. Then inside the JFrame,
assuming it has been sized large enough, will be the content pane. The
content pane is typically gray. You would drop the JLabel there on the
gray content pane. If everything is white then something is wrong.


--
Thanks,
Rich Kulp
Re: a Labell is never added to JPanel. Is that right? [message #600311 is a reply to message #63602] Thu, 30 September 2004 21:02 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

In fact, go to the Help Contents and look up the Visual Editor help.
There is a tuturial in there on how to use the VE. There will be
pictures so you can see what it should look like.


--
Thanks,
Rich Kulp
It's all white, but I might have found a workaround [message #600317 is a reply to message #63580] Thu, 30 September 2004 21:41 Go to previous message
David Bo Jensen is currently offline David Bo JensenFriend
Messages: 11
Registered: July 2009
Junior Member
It's also white with JDialog.
By rearangeing the sequence of the methods, something became visible.

--
David Bo Jensen
Re: It's all white, but I might have found a workaround [message #600332 is a reply to message #63647] Thu, 30 September 2004 21:39 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

There is something wrong. If it was created through the VE you shouldn't
be needing to rearrange the methods.


--
Thanks,
Rich Kulp
Previous Topic:a Labell is never added to JPanel. Is that right?
Next Topic:Can't launch simple SWT app...
Goto Forum:
  


Current Time: Tue Sep 17 14:23:06 GMT 2024

Powered by FUDForum. Page generated in 1.05282 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top