.............................
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
.............................
Last edited by Yamato; December 8th, 2010 at 05:40 AM.
I have no idea what you mean by: "appear that row on the next run". Can you explain what is happening because I am unclear.While the user checked the checkbox, it will not appear that row on the next Run.
NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:
When asking for help, please follow these guidelines to receive better and more prompt help:
1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
2. Give full details of errors and provide us with as much information about the situation as possible.
3. Give us an example of what the output should look like when done correctly.
Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/
............................
Last edited by Yamato; December 8th, 2010 at 05:41 AM.
class StockEnquiryStaff implements Comparable { public String name; public String telephone; public String callback; public String enquiry; public Boolean check; public StockEnquiryStaff(String n, String t, String c, String e, Boolean ck){ this.name = n; this.telephone = t; this.callback = c; this.enquiry = e; this.check = ck; } public String getName() { return name; } public String getTelephone() { return telephone; } public String getCallback() { return callback; } public String getEnquiry() { return enquiry; } public Boolean getCheck() { return check; } public int compareTo(Object o) { StockEnquiryStaff temp = (StockEnquiryStaff) o; return (callback.compareTo(temp.callback)); } } --------------------------------------------------------------------------------------- //This is how i set the column 5 to become a checkbox class ATableClass extends JTable { public Class getColumnClass(int column) { try { if (column == 4) { return Class.forName("java.lang.Boolean"); } return Class.forName("java.lang.Object"); } catch (ClassNotFoundException ex) { ex.printStackTrace(); return null; } } } ---------------------------------------------------------------------------- //This is the Stock Enquiry class which contain Jtable, button, text field and Jlabel. public class StockEnquiryStaffView extends JFrame { // A container for the Product instances ArrayList StockEnquiriesStaff = new ArrayList(); // StockEnquiryStaffView bits and bobs JPanel panInput = new JPanel(new GridLayout(4,20)), panAdd = new JPanel(), panDelSort = new JPanel(); JTextField txtName = new JTextField(10), txtTelephone = new JTextField(10), txtCallback = new JTextField(5), txtEnquiry = new JTextField(20); JButton btnAdd = new JButton("Add"), btnDelete = new JButton("Delete"), btnSort = new JButton("Sort Callback Time by Ascending"), btnSort1 = new JButton("Sort Callback Time by Descending"), btnSave = new JButton("Save"); ATableClass tableOne = new ATableClass(); DefaultTableModel tabMod = new DefaultTableModel(); //This is the read file method which read from text file and using the loadProductsIntoTable //to load all the data into the JTable. public void readfile() throws IOException { BufferedReader br = new BufferedReader( new FileReader("salesEnquiryLog.txt")); String s; String getName = ""; String getTelephone = ""; String getCallback = ""; String getEnquiry = ""; Boolean getCheck = null; int i = 0; while((s = br.readLine()) != null) { if (s.equals("<sales_enquiry>")) { getName = br.readLine(); getTelephone = br.readLine(); getCallback = br.readLine(); getEnquiry = br.readLine(); StockEnquiryStaff [] StockEnquiries = {new StockEnquiryStaff(getName, getTelephone,getCallback,getEnquiry, getCheck)}; StockEnquiriesStaff.add(StockEnquiries[i]); loadProductsIntoTable(); } } } // This is the method of load all the data in the product array into the JTable (row by row). public void loadProductsIntoTable() { tabMod.setRowCount(0); String [] row = new String [4]; for (Iterator i = StockEnquiriesStaff.iterator(); i.hasNext() { StockEnquiryStaff temp = (StockEnquiryStaff) i.next(); row[0] = temp.getName(); row[1] = temp.getTelephone(); row[2] = temp.getCallback(); row[3] = temp.getEnquiry(); tabMod.addRow(row); } } //Stock Enquiry public StockEnquiryStaffView() throws IOException { super("Stock Enquiry Staff View"); tableOne.setModel(tabMod); tabMod.addColumn("Manager Name"); tabMod.addColumn("Telephone"); tabMod.addColumn("Callback Time"); tabMod.addColumn("Enquiry"); tabMod.addColumn("Check"); // All the btn, txt, jlabel here ------------------------------------------------------------------------------------------
Looks like it's reading a name, a number, and a time.
....................
Last edited by Yamato; December 8th, 2010 at 05:42 AM.