 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Brian Ray Guest
|
Posted: Tue Mar 01, 2005 9:39 pm Post subject: Suggestions for designing an subclass of an abstract class. |
|
|
We have an application that is an MDI (Multiple Document Interface), and we
need to periodically create new child documents. Our child document
abstract class is called KNetFrame, it subclasses JInternalFrame. It has
some features on it (like buttons), and we want the programmer to implement
the methods required for the buttons to work. For this reason, we have made
the class abstract. But when the programmer wants to design his new
document, the designer says that it can't instantiate the abstract class (of
course not), so it jsut makes a red screen. Does anyone have any ideas on
how we can get around this?
Thanks!
|
|
| Back to top |
|
 |
Tony Guest
|
Posted: Tue Mar 01, 2005 9:45 pm Post subject: Re: Suggestions for designing an subclass of an abstract cla |
|
|
Brian,
An excellent summary of the solution can be found at:
http://www.visi.com/~gyles19/fom-serve/cache/97.html
Cheers,
Tony.
"Brian Ray" <bray (AT) kable (DOT) com> wrote
| Quote: | We have an application that is an MDI (Multiple Document Interface), and
we
need to periodically create new child documents. Our child document
abstract class is called KNetFrame, it subclasses JInternalFrame. It has
some features on it (like buttons), and we want the programmer to
implement
the methods required for the buttons to work. For this reason, we have
made
the class abstract. But when the programmer wants to design his new
document, the designer says that it can't instantiate the abstract class
(of
course not), so it jsut makes a red screen. Does anyone have any ideas on
how we can get around this?
Thanks!
|
|
|
| Back to top |
|
 |
Kevin Dean [TeamB] Guest
|
Posted: Tue Mar 01, 2005 9:48 pm Post subject: Re: Suggestions for designing an subclass of an abstract cla |
|
|
Brian Ray wrote:
| Quote: | We have an application that is an MDI (Multiple Document Interface),
and we need to periodically create new child documents. Our child
document abstract class is called KNetFrame, it subclasses
JInternalFrame. It has some features on it (like buttons), and we
want the programmer to implement the methods required for the buttons
to work. For this reason, we have made the class abstract. But when
the programmer wants to design his new document, the designer says
that it can't instantiate the abstract class (of course not), so it
jsut makes a red screen. Does anyone have any ideas on how we can
get around this?
|
The problem is that the designer needs to instantiate an instance of
the base class in order for you to design an extended class. If you
look at the release notes (setup/release_notes.html) and search for the
word "proxy", you will find details on how to work around this problem.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
|
|
| Back to top |
|
 |
Vladislav Protasov Guest
|
Posted: Wed Mar 02, 2005 9:32 pm Post subject: Re: Suggestions for designing an subclass of an abstract cla |
|
|
Hello Brian,
What version of JBuilder are you using?
JBuilder 2005 has unique designer feature, it could design abstract classes.
i.e.
import javax.swing.*;
public abstract class MyPanel extends JPanel {
JButton jButton1 = new JButton();
public MyPanel() {
super();
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public abstract void a();
private void jbInit() throws Exception {
jButton1.setText("jButton1");
this.add(jButton1);
}
}
Best regards,
Vladislav
"Brian Ray" <bray (AT) kable (DOT) com> wrote
| Quote: | We have an application that is an MDI (Multiple Document Interface), and
we
need to periodically create new child documents. Our child document
abstract class is called KNetFrame, it subclasses JInternalFrame. It has
some features on it (like buttons), and we want the programmer to
implement
the methods required for the buttons to work. For this reason, we have
made
the class abstract. But when the programmer wants to design his new
document, the designer says that it can't instantiate the abstract class
(of
course not), so it jsut makes a red screen. Does anyone have any ideas on
how we can get around this?
Thanks!
|
|
|
| Back to top |
|
 |
Vladislav Protasov Guest
|
Posted: Wed Mar 02, 2005 9:34 pm Post subject: Re: Suggestions for designing an subclass of an abstract cla |
|
|
Hi Kevin,
Please see my reply
Best regards,
Vladislav
"Kevin Dean [TeamB]" <NkOdSePaAnM (AT) datadevelopment (DOT) com> wrote
| Quote: | Brian Ray wrote:
We have an application that is an MDI (Multiple Document Interface),
and we need to periodically create new child documents. Our child
document abstract class is called KNetFrame, it subclasses
JInternalFrame. It has some features on it (like buttons), and we
want the programmer to implement the methods required for the buttons
to work. For this reason, we have made the class abstract. But when
the programmer wants to design his new document, the designer says
that it can't instantiate the abstract class (of course not), so it
jsut makes a red screen. Does anyone have any ideas on how we can
get around this?
The problem is that the designer needs to instantiate an instance of
the base class in order for you to design an extended class. If you
look at the release notes (setup/release_notes.html) and search for the
word "proxy", you will find details on how to work around this problem.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
|
|
|
| Back to top |
|
 |
Gillmer J. Derge [TeamB] Guest
|
Posted: Wed Mar 02, 2005 9:49 pm Post subject: Re: Suggestions for designing an subclass of an abstract cla |
|
|
Vladislav Protasov wrote:
| Quote: | JBuilder 2005 has unique designer feature, it could design abstract classes.
|
But in this guy's case it's the base class that's abstract, not the
class being designed.
| Quote: | public abstract class MyPanel extends JPanel {
|
Now try designing this:
public class MyConcretePanel extends MyPanel {
public void a() {}
}
--
Gillmer J. Derge [TeamB]
|
|
| Back to top |
|
 |
Vladislav Protasov Guest
|
Posted: Wed Mar 02, 2005 11:23 pm Post subject: Re: Suggestions for designing an subclass of an abstract cla |
|
|
Works fine for me, do you see any error message?
"Gillmer J. Derge [TeamB]" <spam (AT) gillmerderge (DOT) com> wrote
| Quote: | Vladislav Protasov wrote:
JBuilder 2005 has unique designer feature, it could design abstract
classes.
But in this guy's case it's the base class that's abstract, not the class
being designed.
public abstract class MyPanel extends JPanel {
Now try designing this:
public class MyConcretePanel extends MyPanel {
public void a() {}
}
--
Gillmer J. Derge [TeamB]
|
|
|
| Back to top |
|
 |
Gillmer J. Derge [TeamB] Guest
|
Posted: Thu Mar 03, 2005 12:12 am Post subject: Re: Suggestions for designing an subclass of an abstract cla |
|
|
Vladislav Protasov wrote:
| Quote: | Works fine for me, do you see any error message?
|
Oops! Actually, no. I hadn't tried it before, because I'm still a
little afraid of the designer in JB2005, but you're right. It does seem
to work. Both the abstract base class and the concrete subclass came up
in the designer without errors.
--
Gillmer J. Derge [TeamB]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|