Components

C

Crono

I am trying to create a popup window that will contain text, and also
contain a button. I have already created two seperate custom components
for this purpose, but I can't seem to be able to join them together. I
get the error "add(java.awt.PopupMenu) in java.awt.Component cannot be
applied to (java.awt.popupButton)". I'm not understanding why I can
only add a PopupMenu to a component. Is there any way of adding a
component to another component?
 
H

hiwa

Crono ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
I am trying to create a popup window that will contain text, and also
contain a button. I have already created two seperate custom components
for this purpose, but I can't seem to be able to join them together. I
get the error "add(java.awt.PopupMenu) in java.awt.Component cannot be
applied to (java.awt.popupButton)". I'm not understanding why I can
only add a PopupMenu to a component. Is there any way of adding a
component to another component?
If your popupButton extends java.awt.PopupMenu, you would get no error.
See API documentation for java.awt.Component class, especially for its
methods.
 
C

Crono

hiwa said:
Crono ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:

If your popupButton extends java.awt.PopupMenu, you would get no error.
See API documentation for java.awt.Component class, especially for its
methods.

I've already checked all the Component methods, and it seems that add()
only allows adding PopupMenu. If I extend PopupMenu, then I get no
customization (since right now I'm extending Canvas).
 
H

hiwa

I've already checked all the Component methods
If it is true, you wouldn't have added a Canvas onto a Component.
Because Component does not have that kind of add() method.
 
C

Crono

hiwa said:
If it is true, you wouldn't have added a Canvas onto a Component.
Because Component does not have that kind of add() method.

Right now I have a "public class popupWindow extends Canvas" being
added to my main application frame, and I would like to add a "public
class popupButton extends Canvas" to the popupWindow component, is this
possible.
 
H

hiwa

public class popupWindow extends Canvas
Canvas is also a Component and doesn't have its own new add() method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top