Java: why my table rows not getting all array values?

Posted on 2012-08-21
Last Modified: 2012-08-21
Hello Experts,

Why not all my array values populating my table's rows?

public static void main(String args[]) {

	Pattern p = Pattern.compile("Sip\\w*");

	String file = "message SipRoute test in SipUser " + "\n"
		+ "receipt SipCall at time SipUpdate " + "\n"
		+ "message SipReg during SipDiv " + "\n";

	ArrayList<String> list = new ArrayList<String>();
	Object obj[] = null;

    	Matcher matcher = p.matcher(file);
    	while(matcher.find() == true){

	Object[]lArray = list.toArray(); //SipRoute, SipUser, SipCall, SipUpdate, SipReg, SipDiv
	Object[][] data = new Object[][]{ lArray };
	String[] headers = { "myColTitle" };
	JFrame frame = new JFrame("test");
	JTable table = new JTable(data, headers);
        JScrollPane scrollPane = new JScrollPane(table);

        frame.setSize(550, 200);



Open in new window

In advance, thank you for your help...

Question by:epifanio67
    LVL 86

    Accepted Solution

    Because you only have one table header. You need as many as you have columns

    Author Comment

    Thank you...

    But, the data are the rows: one header, many rows, correct?

    Thanks in advanced....

    Author Closing Comment

    I see it now...

    thanks for your help...

    LVL 86

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Title # Comments Views Activity
    what is spring 3 35
    how to extract window origin in spring 2 55
    endX challenge 2 31
    wordmultiple challenge 12 62
    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…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    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.

    760 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

    10 Experts available now in Live!

    Get 1:1 Help Now