Add a JTable inside another JTable's cell

Posted on 2012-09-21
Last Modified: 2012-09-26
Is there a way to add a jTable complete with headers and data to a cell of a another jTable?
Question by:ScreenFox
    LVL 26

    Expert Comment

    yes, define another table as table cell renderer.
    LVL 26

    Accepted Solution

    see this example,

    instead of extending JLable in the example, you would be extending JTable and handel getTableCellRendererComponent appropriately

    Author Comment

    Thanks, it worked... Is there a way to show the headers too?
    LVL 26

    Expert Comment

    I can't think of why it won't, can you post your code?

    Author Comment

    Nervermind, it does show the header, but they were empty.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Suggested Solutions

    Title # Comments Views Activity
    Connect to IP Camera using Java 4 60
    Fix45 challenge 15 66
    changeXy challenge 13 40
    Running Jira on Raspberry PI 2? 3 44
    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now