java - i am trying to take all the value from jtable and add it to ArrayList -
Hello, I have a method that takes value from jettbables and add it to Arrowify, I'm going to use the method in buffer Write the text to srt afterwards but now I am saving information inside the array
public static ArrayList & lt; String & gt; GetTableStymeData () {ArrayList & lt; String & gt; Data = new arreelist & lt; String & gt; (); {Data.addAll (getValueAt (i, 2)) for (int i = 0; i <5; i ++); I ++; } Return data; }
error message is:
Error: Symbol data can not be found. All (getValueAt (i, 2)); Symbol: Method getValueAt (int, int) Location: Class GUIInterface 1 error netBeans suggest suggestions to create getValueAt () but what is the content of this method is declared some side information table Public class GuiInterface JFrame {String [] columnNames = {"#", "Start" , "End", "translation column"}; Public finals jettison table; DefaultTableModelSmodel; Public GUIInterface (string title) {cModel = new DefaultTableModel (column name, 0); Table = new jetball (CMDell); Table.setFillsViewportHeight (true); Table.setAutoResizeMode (JTable.AUTO_RESIZE_ALL_COLUMNS); Tableclass column A = table.getColumn ("#"); ColumnA.setMinWidth (10); ColumnA.setMaxWidth (40); Table column column B = table.gate column ("Start"); ColumnB.setMinWidth (80); ColumnB.setMaxWidth (90); Table column column c = table.gate column ("end"); ColumnC.setMinWidth (80); ColumnC.setMaxWidth (90); } // extends the end of the Constructor class / worker swingworker & lt; DefaultTableModel, Zero & gt; {Private last string srtPath; Private finals jibble table; DefaultTel Model Model; Public Worker (String srtPath, JTable Table) {this.srtPath = srtPath; This.table = table; } @ Override protected default tablemodelDownbackground () {models = new default table model (column name, 0); ArrayList & LT; String & gt; Ends = ReadingFile.getFileEndingTime (srtPath); ArrayList & LT; String & gt; Starts = ReadingFile.getFileStartingTime (srtPath); ArrayList & LT; String & gt; Subs = Reading File Reedbital (srtPath); ArrayList & LT; String & gt; Lins = ReadingFile.ArraylineLengths (srtPath); For (Int i = 0; I & lt; ReadingFile.maxLine (srtPath); i ++) {model.addRow (new object [] {lins.get (i) starts, ends (I), ends Is subs.get (i)}); } Return Model; } @ Override secured zero () {table.setModel (model); Table.setFillsViewportHeight (true); Table.setAutoResizeMode (JTable.AUTO_RESIZE_ALL_COLUMNS); Tableclass column A = table.getColumn ("#"); ColumnA.setMinWidth (10); ColumnA.setMaxWidth (40); Table column column B = table.gate column ("Start"); ColumnB.setMinWidth (80); ColumnB.setMaxWidth (90); Table column column c = table.gate column ("end"); ColumnC.setMinWidth (80); ColumnC.setMaxWidth (90); }} / * Public object getValueAt (int row, int column) {return tap; } * / Public Stable Arrestist & lt; String & gt; GetTableStymeData () {ArrayList & lt; String & gt; Data = new arreelist & lt; String & gt; (); // (for int i = 0; i
change it to jtable.getValueAt () jtable JTable . Sample code:
Public stable array list & lt; String & gt; GetTableStymeData () {ArrayList & lt; String & gt; Data = new arreelist & lt; String & gt; (); For (int i = 0; i & lt; jtable.getRowCount (); i ++) {object val = jtable.getValueAt (i, 2); // value ith line and 3 columns data.add (string)); } Return data; } Please note and.
Please note that according to your code, you are assuming everything from the third column of each row.
Why are you increasing the i twice in the loop?
Comments
Post a Comment