Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » A Problem with a visual class that extends other visual class
A Problem with a visual class that extends other visual class [message #108238] Tue, 27 September 2005 12:15 Go to next message
Eclipse UserFriend
Originally posted by: kuleza.eunet.yu

First class extends JDialog, and has JContentPane with JTable and 2
JButtons on it. When I try to add new visual class that extends my first
class Visual Editor makes new JContentPane for Child, so I cannot see
Parents components on Child. If I try to delete JContentPane from Child, I
see Parent components but there comes a new problem. Child has no
JContentPane and I cannot add other components on child. And I need that,
thats the whole point.

I don't know if anyone else has the same problem, probably it's something
simple,
but I can't see what am I doing wrong...

Thanks in advance

Damir Kujovic
Re: A Problem with a visual class that extends other visual class [message #108252 is a reply to message #108238] Tue, 27 September 2005 15:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

This is a current restriction in the VE. We don't support inherited
content panes. We are working on this though and hope to have it working
in VE 1.2


--
Thanks,
Rich Kulp
Re: A Problem with a visual class that extends other visual class [message #108355 is a reply to message #108252] Wed, 28 September 2005 20:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kuleza.eunet.yu

Thanks on the information. When can we exspect new version? It will save a
lot of effort. And I have another question. I tried to solve the problem
with inheriting by editing source code and I used Visual Editor to put
components on temporary form and then I copied the code to the Child
class. I have a Main class with a main metod that calls the Child class.
Parent is not showing anywhere, it has 2 buttons on a JContentPane. Child
extends Parent and when I launch aplication, Child has the same look as a
Parent, wich is OK, but when I try to add, let's say, JTable on ScrolPane
on Child it's not showing anywhere. Please help me, I don't want to draw
15 very similiar forms one by one :-)

Thanks in advance

Damir





Here's the code:


public class Main {

public static void main(String[] args) {
Child2 c = new Child2();
c.show();
}
}

******************************************

public class Parent extends JFrame {

protected javax.swing.JPanel jContentPaneParenta = null;

protected JButton jButton = null;
protected JButton jButton1 = null;
/**
* This is the default constructor
*/
public Parent() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300,200);
this.setContentPane(getJContentPaneParenta());
this.setTitle("Parent");
}
/**
* This method initializes jContentPaneParenta
*
* @return javax.swing.JPanel
*/
protected javax.swing.JPanel getJContentPaneParenta() {
if(jContentPaneParenta == null) {
jContentPaneParenta = new javax.swing.JPanel();
jContentPaneParenta.setLayout(new java.awt.BorderLayout());
jContentPaneParenta.add(getJButton(), java.awt.BorderLayout.WEST);
jContentPaneParenta.add(getJButton1(), java.awt.BorderLayout.EAST);
}
return jContentPaneParenta;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
protected JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setText("1");
jButton.addMouseListener(new java.awt.event.MouseListener() {
public void mouseClicked(java.awt.event.MouseEvent e) {
System.out.println("mouseClicked()"); // TODO Auto-generated Event
stub mouseClicked()

}
public void mouseEntered(java.awt.event.MouseEvent e) {}
public void mouseExited(java.awt.event.MouseEvent e) {}
public void mousePressed(java.awt.event.MouseEvent e) {}
public void mouseReleased(java.awt.event.MouseEvent e) {}
});
}
return jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
protected JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setText("2");
}
return jButton1;
}
}


*******************************************************

public class Child2 extends Parent {

protected JTable jTable = null;
protected JScrollPane jScrollPane = null;

/**
* This is the default constructor
*/

public Child2() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/

private void initialize() {
this.setSize(300,200);
this.setContentPane(jContentPaneParenta);
jContentPaneParenta.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
}

/**
* This method initializes jTable
*
* @return javax.swing.JTable
*/
protected JTable getJTable() {
if (jTable == null) {
jTable = new JTable();
}
return jTable;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
protected JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJTable());
}
return jScrollPane;
}


}
Re: A Problem with a visual class that extends other visual class [message #108362 is a reply to message #108355] Thu, 29 September 2005 14:10 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

You won't be able to see Child2 in Main because main is not a visual
class, nor does it have a constructor that has an initialize method call
in it. We don't parse the main method itself. We parse the instance of
class through the initialize() method.


--
Thanks,
Rich Kulp
Re: A Problem with a visual class that extends other visual class [message #610878 is a reply to message #108238] Tue, 27 September 2005 15:02 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

This is a current restriction in the VE. We don't support inherited
content panes. We are working on this though and hope to have it working
in VE 1.2


--
Thanks,
Rich Kulp
Re: A Problem with a visual class that extends other visual class [message #610885 is a reply to message #108252] Wed, 28 September 2005 20:42 Go to previous message
Eclipse UserFriend
Originally posted by: kuleza.eunet.yu

Thanks on the information. When can we exspect new version? It will save a
lot of effort. And I have another question. I tried to solve the problem
with inheriting by editing source code and I used Visual Editor to put
components on temporary form and then I copied the code to the Child
class. I have a Main class with a main metod that calls the Child class.
Parent is not showing anywhere, it has 2 buttons on a JContentPane. Child
extends Parent and when I launch aplication, Child has the same look as a
Parent, wich is OK, but when I try to add, let's say, JTable on ScrolPane
on Child it's not showing anywhere. Please help me, I don't want to draw
15 very similiar forms one by one :-)

Thanks in advance

Damir





Here's the code:


public class Main {

public static void main(String[] args) {
Child2 c = new Child2();
c.show();
}
}

******************************************

public class Parent extends JFrame {

protected javax.swing.JPanel jContentPaneParenta = null;

protected JButton jButton = null;
protected JButton jButton1 = null;
/**
* This is the default constructor
*/
public Parent() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300,200);
this.setContentPane(getJContentPaneParenta());
this.setTitle("Parent");
}
/**
* This method initializes jContentPaneParenta
*
* @return javax.swing.JPanel
*/
protected javax.swing.JPanel getJContentPaneParenta() {
if(jContentPaneParenta == null) {
jContentPaneParenta = new javax.swing.JPanel();
jContentPaneParenta.setLayout(new java.awt.BorderLayout());
jContentPaneParenta.add(getJButton(), java.awt.BorderLayout.WEST);
jContentPaneParenta.add(getJButton1(), java.awt.BorderLayout.EAST);
}
return jContentPaneParenta;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
protected JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setText("1");
jButton.addMouseListener(new java.awt.event.MouseListener() {
public void mouseClicked(java.awt.event.MouseEvent e) {
System.out.println("mouseClicked()"); // TODO Auto-generated Event
stub mouseClicked()

}
public void mouseEntered(java.awt.event.MouseEvent e) {}
public void mouseExited(java.awt.event.MouseEvent e) {}
public void mousePressed(java.awt.event.MouseEvent e) {}
public void mouseReleased(java.awt.event.MouseEvent e) {}
});
}
return jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
protected JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setText("2");
}
return jButton1;
}
}


*******************************************************

public class Child2 extends Parent {

protected JTable jTable = null;
protected JScrollPane jScrollPane = null;

/**
* This is the default constructor
*/

public Child2() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/

private void initialize() {
this.setSize(300,200);
this.setContentPane(jContentPaneParenta);
jContentPaneParenta.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
}

/**
* This method initializes jTable
*
* @return javax.swing.JTable
*/
protected JTable getJTable() {
if (jTable == null) {
jTable = new JTable();
}
return jTable;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
protected JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJTable());
}
return jScrollPane;
}


}
Re: A Problem with a visual class that extends other visual class [message #610886 is a reply to message #108355] Thu, 29 September 2005 14:10 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

You won't be able to see Child2 in Main because main is not a visual
class, nor does it have a constructor that has an initialize method call
in it. We don't parse the main method itself. We parse the instance of
class through the initialize() method.


--
Thanks,
Rich Kulp
Previous Topic:VE installation problem (newbie)
Next Topic:Problem with the properties view of VE 1.1.0.1
Goto Forum:
  


Current Time: Thu Apr 25 10:18:25 GMT 2024

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

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

Back to the top