CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: JTable troubles

  1. #1
    Join Date
    Jan 1999
    Posts
    2

    JTable troubles



    I've got some code which attemps to display a JPanel within a JTable cell, but instead the output from a JPanel.toString() appears there instead. Any ideas as to what could be wrong?


    Thanks,

    Chris.

  2. #2
    Join Date
    Jan 1999
    Posts
    2

    Re: JTable troubles



    Forget it.

    I was trying to follow Java 2 examples using Java 1.1.6.

    It didn't quite work.


    Chris

  3. #3
    Join Date
    Jun 1999
    Posts
    7

    Re: JTable troubles

    The default JTable renderer (Class based rendering) handles String, boolean and numbers.

    Typically one needs to do the following
    1) Create your class implementing TableCellRenderer interface and extending from any JComponent subclass (In your case extends JPanel)
    2) Set the instance of the this class to the appropiate column.

    e.g., <table_name>.getColumnModel().getColumn(0).setCellRenderer(<your_class>

    This should do the job.

    Thanks


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured