| | |
JTable
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 16
Reputation:
Solved Threads: 0
Java Syntax (Toggle Plain Text)
package org.project; import java.util.*; import java.io.*; import javax.swing.*; public class openResults { public static void readMatch() throws FileNotFoundException { JFrame frame = new JFrame ("Match Results"); JTable table = new JTable(); List<String> columnData = new ArrayList<String>(); JFileChooser chooser = new JFileChooser(); //Creating the File Chooser int status = chooser.showOpenDialog (null); //setting blank File Chooser if(status != JFileChooser.APPROVE_OPTION) ((DefaultTableModel) table.getModel()).addColumn("No File Chosen", (Object[])null); } else { File file = chooser.getSelectedFile(); //Selecting File Scanner scan = new Scanner(file); //Scanning the file from file chooser while(scan.hasNext(",")) { columnData.add(scan.nextLine()); } ((DefaultTableModel) table.getModel()).addColumn("DATA", columnData.toArray()); } JScrollPane jsp = newJScrollPane (table); frame.getContentPane().add(jsp); frame.pack(); frame.setVisible(true); }
•
•
Join Date: Nov 2008
Posts: 332
Reputation:
Solved Threads: 54
Step1.
We focus on one theme. You have Read all about java.util.StringTokenizer.java class and complete for me the code.
quuba
We focus on one theme. You have
String scanLine="westham,0,0,Queens Park Rangers"; java.util.StringTokenizer st = new java.util.StringTokenizer(scanLine,","); ...
quuba
![]() |
Similar Threads
- Problem changing contents of JTable when button is pressed... (Java)
- deleting rows from a JTable (Java)
- How to make JTable cell not Editable (Java)
- JTable Reloading/Refreshing/Updating/Whatever. (Java)
- Adding and deleting a column in JTable (Java)
- JTable problem (Java)
- Getting horizontal scrollbars in a JTable (Java)
- JTable not calling getValueAt - any ideas? (Java)
- Saving and opeing a JTable (Java)
Other Threads in the Java Forum
- Previous Thread: how to make attempts in pin numbers
- Next Thread: Problem reading data from file
Views: 1795 | Replies: 12
| Thread Tools | Search this Thread |
Tag cloud for Java
actuate android api apple applet application arguments array arrays automation balls binary bluetooth business c++ chat class classes client code codesnippet collections component database defaultmethod doctype dragging draw ebook eclipse error event exception file fractal froglogic game givemetehcodez graphics gui helpwithhomework hql html ide image input integer intersect invokingapacheantprogrammatically j2me java javaprojects jmf jni jpanel julia linux list loop looping map method methods mobile mysql netbeans newbie number numbers object oracle parameter php print problem program programming project recursion scanner screen server set size sms socket sort sql string sun swing swt tcp test threads time transfer tree udp windows





