User Profile

Collapse

Profile Sidebar

Collapse
eddiewould
eddiewould
Last Activity: Oct 19 '08, 10:49 PM
Joined: Jul 17 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • eddiewould
    replied to JComponent - delegating to JPanel
    in Java
    It is my understanding that the code example I posted showed composition, not derivation. It *contained* a reference to a JPanel rather than extending from one.

    Anyway, can you guys can confirm that what I was trying to do (having a class which extends JComponent, contains a JPanel and delegates it's methods to the JPanel) is not possible?

    What I want is something which

    * Looks and acts like any other...
    See more | Go to post

    Leave a comment:


  • eddiewould
    replied to JComponent - delegating to JPanel
    in Java
    Have you read my post? That's exactly what I'm trying to do.
    See more | Go to post

    Leave a comment:


  • eddiewould
    replied to JComponent - delegating to JPanel
    in Java
    It's just not very nice -

    My widget really isn't a panel, it's something in it's own right that just happens to want to take advantage of functionality which exists in JPanel rather than rewriting it from scratch.

    If I extend from JPanel then I expose a whole lot of methods which I don't want to.

    For example:

    public void add(Component c)

    I don't want people adding things...
    See more | Go to post

    Leave a comment:


  • eddiewould
    started a topic JComponent - delegating to JPanel
    in Java

    JComponent - delegating to JPanel

    Hi, I want to write a custom widget which will act similarly to a JPanel (i.e it can contain other Components), but semantically it's not a kind of JPanel so it shouldn't extend from it.

    Here is some sample code showing what I'm trying to achieve:
    Effectively I expect to see a JLabel with the message "This is a test" as well as a JButton "foo".

    What am I doing wrong? Is this possible? Also,...
    See more | Go to post
No activity results to display
Show More
Working...