Hello i made a GUI. In that GUI i make a Jtable here the code that i make the Jtable with name table 1
centerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); inCenterPanel = new JPanel(new GridLayout(1, 2)); label4 = new JLabel("A= "); inCenterPanel.add(label4); table1 = new JTable(x, x); table1.setBackground(Color.red); inCenterPanel.add(table1); centerPanel.setBackground(Color.green); inCenterPanel.setBackground(Color.green); centerPanel.add(inCenterPanel); contentPane.add(centerPanel, BorderLayout.NORTH);
I make o method that i want the GUI read from text file and put the int elements into the jtable with name table 1! here is the code which i try to make that and i dont now how
i make this thread also here http://forums.netbeans.org/viewtopic.php?t=44908public void data2() { try { // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("data.txt"); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; //Read File Line By Line while ((strLine = br.readLine()) != null) { for (int i = 0; i < x; i++) { for (int j = 0; j < x; j++) { } } } //Close the input stream in.close(); } catch (Exception e) {//Catch exception if any System.err.println("Error: " + e.getMessage()); } }
Can you help me ?