We help IT Professionals succeed at work.
Get Started

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

epifanio67
epifanio67 asked
on
413 Views
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){
    		list.add(matcher.group());
	}

	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);
        table.setFillsViewportHeight(true);
	        
        frame.getContentPane().add(scrollPane,BorderLayout.CENTER);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(550, 200);
        frame.setVisible(true);

 

			
  }

Open in new window


In advance, thank you for your help...

Regards,
Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE