Skip to main content



      Home
Home » Archived » Visual Editor (VE) » extending an extended JFrame
extending an extended JFrame [message #102901] Fri, 19 August 2005 13:55 Go to next message
Eclipse UserFriend
Originally posted by: codedragon.runbox.com

I am trying to extend a class that is an extension of JFrame. The VE seems
to insist that FooFrameExtended defines its own content pane. I am trying
to define a code Frame class that extends JFrame that my future programs
will use. What am I doing wrong?

Damon Jacobsen
example using Eclipse 3.1.0 and Visual Editor 1.1.0 :

public class FooFrame extends JFrame {
private JPanel jContentPanel = null;

public FooFrame() {
initialize();
}

private void initialize() {
this.setSize(new java.awt.Dimension(300, 200));
this.setContentPane(getJContentPanel());
}

private JPanel getJContentPanel() {
if (jContentPanel == null) {
jContentPanel = new JPanel();
}
return jContentPanel;
}
}
public class FooFrameExtended extends FooFrame {
private JPanel jPanel = null;
FooFrameExtended()
{
super();
initialize();
}
private void initialize()
{
this.getContentPane().add(getJPanel());

}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
}
return jPanel;
}

}
Re: extending an extended JFrame [message #102916 is a reply to message #102901] Fri, 19 August 2005 14:01 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

You are doing nothing wrong. The current VE doesn't recognize an
existing contentpane. That is being addressed for VE 1.2, but it doesn't
do it now.

The way to do it in the current VE is to define a separate subclass of
JPanel for the content pane and then set that as your content pane in a
JFrame subclass.
--
Thanks,
Rich Kulp
Re: extending an extended JFrame [message #610340 is a reply to message #102901] Fri, 19 August 2005 14:01 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

You are doing nothing wrong. The current VE doesn't recognize an
existing contentpane. That is being addressed for VE 1.2, but it doesn't
do it now.

The way to do it in the current VE is to define a separate subclass of
JPanel for the content pane and then set that as your content pane in a
JFrame subclass.
--
Thanks,
Rich Kulp
Previous Topic:extending an extended JFrame
Next Topic:SWT Label doesn't show up on Windows NT 4
Goto Forum:
  


Current Time: Thu Jun 12 13:48:52 EDT 2025

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

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

Back to the top