Why can I only add up to 7 rows in a table???

I have written the following programme
but can only allow 6 addButton clicks....(I want to allow adding unlimited number of rows)
can anyone run the code and help me out please???
import javax.swing.border.* ;
import javax.swing.* ;
import java.awt.Dimension;
import java.awt.event.* ;
import java.util.*;
import java.awt.*;
import javax.swing.table.TableColumn;
import javax.swing.JTable;
import javax.swing.DefaultCellEditor;
import javax.swing.table.*;
public class ReadingListDialog extends javax.swing.JDialog{
ReadingListDialog me;
String[] type = {"Text Book", "Online Material","Other"};
String[] columns;
JComboBox typeComboBox;
JButton editButton;
JButton cancelButton;
JButton saveButton;
JButton addButton;
JButton deleteButton;
JTable bookTable;
JTable onlineTable;
JTable otherTable;
JTabbedPane tabbedPane;
Box outerBox;
Box buttonBox;
JScrollPane bookScrollPane ;
JScrollPane onlineScrollPane ;
JScrollPane otherScrollPane ;
Vector row;     
DefaultTableModel bookModel;
DefaultTableModel onlineModel;
DefaultTableModel otherModel;
private boolean DEBUG = true;
/** Creates a new instance of ReadingListDialog */
public ReadingListDialog(java.awt.Frame parent, boolean modal, boolean edit) {
initComponents();
public void initComponents(){
me = this ;
ImageIcon icon = new ImageIcon("middle.gif");
Object[][] bookData = {
// {"Altemate Java", "Robert Sedgewick", "Library", "June 30", "p.130-150","No notes","Read"},
//{"Elementary Algebra","Ian Horthorn","Desk Copy","sep 28","p.111, p.112","important topic!!!True......hello everyone","Not Read"},
String[] bookColumn = {"Text Title",
"Author",
"Location",
"Read By Date",
"Page/Chapter",
"Note",
"Status"
DefaultTableModel bookModel = new DefaultTableModel(bookData, bookColumn);          
bookTable = new JTable(bookModel);
setUpReadingStatusColumn(bookTable.getColumnModel().getColumn(6));
bookTable.setPreferredScrollableViewportSize(new Dimension(500, 35));
Object[][] onlineData = {
// {"Google", "www.google.com", "June 30", "a search engine","Don't understand"},
// {"Waikato Uni","www.waikato.ac.nz","Sep 29","important topic!!!True......hello everyone","Half way"},
String[] onlineColumn = {"Website Name",
"URL",
"Read By Date",
"Note",
"Status"
DefaultTableModel onlineModel = new DefaultTableModel(onlineData, onlineColumn);     
onlineTable = new JTable(onlineModel);
setUpReadingStatusColumn(onlineTable.getColumnModel().getColumn(4));
onlineTable.setPreferredScrollableViewportSize(new Dimension(500, 35));
Object[][] otherData = {
//{"Lecture slide", "N/A", "June 30", "useful for assignment 2","Read"},
//{"Notes on Linear Algebra","DeskCopy","Sep 29","important topic!!!True......hello everyone","Not Read"},
String[] otherColumn = {"Material",
"Location",
"Read By Date",
"Note",
"Status"
DefaultTableModel otherModel = new DefaultTableModel(otherData, otherColumn);     
otherTable = new JTable(otherModel);
setUpReadingStatusColumn(otherTable.getColumnModel().getColumn(4));
otherTable.setPreferredScrollableViewportSize(new Dimension(500, 35));
tabbedPane = new JTabbedPane();
//create the buttons
cancelButton = new JButton("Cancel");
saveButton = new JButton("Save");
addButton = new JButton( "Add Row" );
deleteButton = new JButton("Delete Row");
//add buttons to buttonBox
buttonBox = new Box(BoxLayout.X_AXIS);
buttonBox.add(saveButton);
buttonBox.add(addButton);
buttonBox.add(deleteButton);
buttonBox.add(cancelButton);
addButton.addActionListener( new ActionListener()          {
public void actionPerformed(ActionEvent e)               {
DefaultTableModel bookModel = (DefaultTableModel)bookTable.getModel();
Object[] newRow = new Object[7];
int row = bookTable.getRowCount() + 1;
for(int k = 0; k<row; k++)
newRow[k] = "";
bookModel.addRow( newRow );
//Create the scroll pane and add the table to it.
bookScrollPane= new JScrollPane(bookTable);
onlineScrollPane = new JScrollPane(onlineTable);
otherScrollPane = new JScrollPane(otherTable);
//add the scroll panes to each tab
tabbedPane.addTab("Text Book Readings", icon, bookScrollPane, "Edit your reading list");
tabbedPane.setSelectedIndex(0);
tabbedPane.addTab("Online Readings", icon, onlineScrollPane, "Still does nothing");
tabbedPane.addTab("Other Materials", icon, otherScrollPane, "Still does nothing");
//add the tabbedPane to outerBox
outerBox = new Box(BoxLayout.Y_AXIS);
//outerBox.setBorder(new EmptyBorder(0,0,20,15));
outerBox.add(tabbedPane);
outerBox.add(buttonBox);
//add the outerBox to the pane
getContentPane().add(outerBox);
if (DEBUG) {
bookTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
//printDebugData(bookTable);
cancelButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
me.dispose();
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
public void setUpReadingStatusColumn(TableColumn statusColumn) {
//Set up the editor for the status cells.
JComboBox comboBox = new JComboBox();
comboBox.addItem("");
comboBox.addItem("Read");
comboBox.addItem("Just Started");
comboBox.addItem("Half way");
comboBox.addItem("Not Read");
comboBox.addItem("Don't understand");
statusColumn.setCellEditor(new DefaultCellEditor(comboBox));
//Set up tool tips for the status cells.
DefaultTableCellRenderer renderer =
new DefaultTableCellRenderer();
renderer.setToolTipText("Click for selecting a status");
statusColumn.setCellRenderer(renderer);
//Set up tool tip for the status column header.
TableCellRenderer headerRenderer = statusColumn.getHeaderRenderer();
if (headerRenderer instanceof DefaultTableCellRenderer) {
((DefaultTableCellRenderer)headerRenderer).setToolTipText(
"Click the satus to see a list of choices");
public static void main(String args[]) {
ReadingListDialog r = new ReadingListDialog(new javax.swing.JFrame(), true, true);
r.setSize(new Dimension(600,500));
r.show();

Try this
public void actionPerformed(ActionEvent e) {
DefaultTableModel bookModel = (DefaultTableModel)bookTable.getModel();
Object[] newRow = new Object[] {};
//int row = bookTable.getRowCount() + 1;
//for(int k = 0; k<row; k++)
//newRow[k] = "";
bookModel.addRow( newRow );

Similar Messages

  • Why can I only add one app in passbook?

    Why can I only add one app (Starbucks) in Passbook? 

    You can add many passes to Passbook, what makes you think you can only add one?
    Check out http://support.apple.com/kb/HT5483.

  • Why can't I add text in the signature panel in firefox?

    why can't I add text in the signature panel in firefox?  I have adobe acrobat pro XI.  I can open a pdf in acrobat pro and am able to add text to a pdf, but when I open a pdf in firefox, the "add text" option is not available.

    When you install Acrobat XI you are also installing Reader for use in the browser. Reader is "sandboxed", or as it says in the Preferences, it is in "Protected Mode". Acrobat does not understand the concept of running in sandboxed memory (sandbox is a security feature to prevent the bad guy from exploiting a memory error and getting into a memory address where they can do damage to your computer) so to help protect Acrobat users the same way Reader users are protected we just install Reader along with Acrobat, but it is only used in the browser (part of this is because the bad guys use web sites as their primary method of distributing corrupted PDF files that can cause problems).
    That said, because you are in Reader the file needs to be Reader Enabled prior to being posted to the web site (or opened in the browser). Once the file is Reader Enabled you should be able to add the text annotations.
    Steve

  • Why can't I add playlist on my old iPhone iTunes on my computer? Can add it on my phone manually but I need to do it on the computer..

    Why can't I add playlist on my old iPhone iTunes on my computer? Can add it on my phone manually but I need to do it on the computer.
    This is an old iPhone that I am only using as an Ipod. It is an Iphone 3GS and I now have an iPhone 4S.
    Any help would be much appreciated!

    I assume that you mean that you do have an iPhone because messages will not work with any other type of cell phone. You should be able to add your phone number in Settings>Messages>Send & Receive at>You can be reached by iMessages at, if your phone number is lited in there, select it and then uncheck your email address and then the iPad will be using the phone number just like the iPhone.
    If you phone number is not listed in there, you probably have to sign out/turn off Messages on the phone and the iPad and then start over again on the phone - and then your phone number should be accessible to use on the iPad.
    Read this support article and pay attention to the information at the very end.
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538

  • Why can I only order 1 EDGE device when browsing online?

    Several EDGE plan / share MORE plan questions from potential customer:
    1. Why can I only order 1 EDGE device online when browsing options?
    2. I have a large family, especially now that my mother is suddenly unable to live alone. How many total lines and how many EDGE phones are allowed on one plan?
    3. Since my mother already has a VZW iphone4, can I add her to the plan at $15 for her line if I buy 10G or more data?
    My family has a hodgepodge of plans, since VZW was too expensive compared to other options in the past and some of the older ones have had smart phones longer than others, etc. Ultimately I am trying to find out if I can add 5 EDGE devices, plus one already owned device at the $15 rate for that line, as long as I have 10+ GB of data (probably looking at 12 to be safe).
    Is this possible? And can I order online? It's really difficult to make it to a store during hours right now.
    Thanks in advance for any assistance!
    Message was edited by: Colin Blaber

    Thank you both for your help. I have a few follow-up questions for the best path forward if I switch to Verizon for all of our lines--quite a few phones to order and numbers to port form various carriers (StraightTalk, T-mobile prepaid, ATT).
    -Can I order the first EDGE phone online, creating my account and porting my number, then wait two days (so that I have received and activated my new phone), then add the next line / EDGE phone / port number, and continue in that fashion?
    If not, can I go in person and order multiple phone lines / ports to the EDGE program on the share more everything plan at the same time?
    Or,
    Can I do a combination--go in person to add my first four lines, then add the others individually online? Is there a time requirement between changes?
    Thank you again.

  • HT201386 Why can't I add a title to a photo anymore?

    Why can't I add a title to a photo anymore in Iphoto editing?
    Thanks,
    Lpkaufman

    For a transition to work, you need handles... basically, enough footage to overlap each other so that the transition can grab from both sides... your clip is merely 7 frames, way too short to be able to add a transition...
    I've used the "joining two pieces of fabric" analogy before, but I think it was too girly.. Perhaps another way to think about it, is to think of a "dovetail joint" used in wood working... the two pieces of wood need to grab onto each other in order to hold together...
    Anyhow, doing a quick search to perhaps better explain, I found this:
    http://multimedia.journalism.berkeley.edu/tutorials/finalcut/transitions-handles /

  • Using QuickTime Pro with an .mpg movie, why can I only get it to play from the beginning, but not from any other point in the video?

    Using QuickTime Pro with an .mpg movie, why can I only get it to play from the beginning, but not from any other point in the video? How can I fix this?
    Baffled in SB

    What format of MPG is this?  Is this an MPEG1 or MPEG2 video?  How was the video created?

  • Why can't I add HD videos to my iPod touch?

    So I recently bought an iPod touch, and I haven't had trouble with it until now. I downloaded a free TV show extra thing and it's in HD & SD, and it downloaded fine and everything. But when I tried to add it to my iPod, a popup comes up with the message: "Blah blah blah" was not copied to the iPod "Michaela's iPod" because it cannot be played on this iPod.
    Why? I tried to do the "Advanced Settings" and convert it, but the convert option is grayed out and I can't choose it. I thought the iPod touch could play HD (and I do have another HD video on it currently), so why can't I add this new HD/SD video to my iPod? And I know there's enough space because I have 24.6 GB free space.

    It's the screen format see below.
    The iPad and iPhone 4 can play High Definition (HD) content and Standard Definition (SD) content. iPods and the original iPhone, iPhone 3G, and iPhone 3GS can play Standard Definition (SD) content. To find what video formats are supported, see the Tech Specs page, click your device's product family, and then your specific model. All HD purchases from the iTunes Store also include an iPod/iPhone-compatible Standard Definition version to accompany the HD version. When syncing an HD purchase from the iTunes Store, iTunes will automatically sync the SD video for devices that require SD content.

  • Why can i only print 1 copy in print in CS5 even when I type more than 1?

    Why can i only print 1 copy in print in CS5 even when I type more than 1?

    Sophie Hubble which Adobe software or service is your inquiry in reference too?

  • Why can't I add any more photos to my nearly completed movie?

    Why can't I add any more photos to my nearly completed movie?

    Assuming you are using iMovie, please post your question in the following section...
    https://discussions.apple.com/community/ilife/imovie

  • Why can't I add or edit an entry on myiPhone Cal?

    Why Can't I add ,or edit an entry on my iPhone Cal?

    Wienderful,
    Make sure your email address on the iPhone and the Exchange server are the same. This article explains more:
    http://support.apple.com/kb/TS1865
    Hope this helps,
    Nathan C.

  • Why can't I add narration now ?

    I have added narration in the past on previous versions of Premiere elements and on Pre 10 but in the last 2 weeks I get an error when I click on the red record button I get a error message that my audio hardware selection does not have any input channels and I should go to Preferences, Audio Hardware to correct this.
    I go to Preferences Audio hardware and and it shows Premiere elements WDM Sound and next box has ASIO setting. I click on these and I see no other possibilities or choices.
    I still have Pre 8  loaded and the narration will not work now on it with the same error.
    What could cause this after narration has always worked in the past?

    Bill I believe I have answered your questions If not get
    back to me and I will try. I am a Snowbird in a motorhome traveling in AZ. And
    the internet comes and goes from time to time. And being a senior my computer
    skills leave me at a disadvantage. I really appreciate you trying to help me.
    Thank You
    Ralph
    Computer Lenova Ideapad Y-530 Windows 7 64 bit
    Processors: Intel ® Core 2 DUO CPU T5900@ 2.20 GHz
    Intel® Core 2 DUO CPU T5900@ 2.20 GHz
    Chip set Mobile Intel 4 series chipset Processor To Dram
    controller 2A40
    All drivers have been updated and rechecked for updates
    today all were current.
    When in project and I click (Edit, Preferences, Audio
    Hardware) The box opens with Default device shown as Premiere Elements WDM
    sound. Then when I click ASIO settings a new window opens showing Logitech H
    150 as default device.( Left Panel 3.5 MM External Jack)  I also use this in Skype for phone calls and
    also tried it in Windows Movie Maker and it works OK.
    In the ASIO box there is 3 other choices:
    Speakers (High definition Audio Device)
    Digital Audio (S/PDIF) (High definition Audio Device)
    Laptop internal (High definition Audio Device)
    I Have tried all 4 devices with the same results
    When in project and clicking on Audio, Add narration, the (Record
    voice narration) window pops up and when I clink the microphone box to choose
    mic the box lights up but no choices show.
    In Control Panel, device mgr I do not see the Logitech  h 150 listed
    Narration was working till about 2 weeks ago. I do not
    believe I have changed anything.
    A bout 3 days ago I uninstalled Premiere el 10 and Photoshop El 10 and reinstalled both, I thought that may help but no change
    Date: Fri, 10 Feb 2012 10:37:01 -0700
    From: [email protected]
    To: [email protected]
    Subject: Why can't I add narration now ?
        Re: Why can't I add narration now ?
        created by Bill Hunt in Premiere Elements - View the full discussion
    Welcome to the forum. What is the make/model of your mic.? What is the connection type? What is the make/model of your sound card/chip? Do you have the latest driver for that sound card/chip installed? In a program, like Windows Recorder, does the mic. work fine? In Control Panel>System>Hardware>Device Manager, does your mic. show up with no errors, or warnings? What is the ASIO setting now? Good luck, and please let us know a bit more. Hunt
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4198766#4198766
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4198766#4198766. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Premiere Elements by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • TS1368 Why can I only download from the apps store and not itunes

    Why can I only download from apps store and not iTunes.

    Try logging out of your account on the iPad by tapping on your id in Settings > Store and then log back in and see if it then works.

  • Why can I only create 4 forms when I have purchased the entire package at 100+ dollars?

    Why can I only create 4 forms when I have purchased the entire package at 100+ dollars?

    FormsCentral can be used from anywhere, but to purchase a subscription you need a credit card with the mailing address in one of the countries supported for purcahse:
    http://forums.adobe.com/docs/DOC-1375
    The partner can purchase if they have access to a card in one of those countries.  Alternatively they do not need to purchase a subscription to edit forms that you've created, they do in order to create multiple forms of their own, but by your sharing forms with them at the "Co-author" level they have access to the editing.  Here are the instructions to share a form:
    http://forums.adobe.com/docs/DOC-2462
    Thanks,
    Josh

  • Why can I only download 1.7 meg from sites

    why can I only download 1.7 meg from sites

    Are you trying to download YouTube videos with a Firefox extension?
    YouTube (Google) seems to have made changes to their servers and that prevents the extensions from working for now.<br />
    You will have to wait until the extension developer has released an update to fix this or check for a possible beta version.
    *http://www.downloadhelper.net/install-beta.php?version=4.9.10b2

Maybe you are looking for