Solve the problem that stumped the Java world

A little background: For a couple of weeks I have been posting queries for help
with several problems in my table-based application. Usually I have gotten calls
for more code. I have stripped the app down to the ONE problem that remains. The
code included below is 772 lines long (down from over 2500) for five files.
I post this query for anyone who is still interested in the problem.
I am hoping that the solution is short work for an experienced Java coder, though I can't figure it out.
Table1               145
Table2               152
T1RowDragger     211
T2RowDragger     243
"main" class     21
     total          772
The goal is to copy a row from one JTable (table1) to another (secondTable). To do
that I need to connect "t1DataModel," the DefaultTableModel of table1 to
"T2RowDragger," the Drag and Drop class of secondTable.
This is the method which should handle the copy It is located in "T2RowDragger":      public void interTableCopy( int rowNumber, int position ) {
          DefaultTableModel t1DataModel = (DefaultTableModel)table1.getModel();      -------- the problem
          Object t1SourceRowData = t1DataModel.getDataVector().elementAt(rowNumber);
          DefaultTableModel t2DataModel = (DefaultTableModel)secondTable.getModel();
          Object t2SourceRowData = t2DataModel.getDataVector().elementAt(rowNumber);
          t2DataModel.getDataVector().setElementAt(t1SourceRowData, position);
          t2DataModel.fireTableRowsUpdated(position, position);
          secondTable.repaint();
     }However, it returns a NullPointerException at the first line of the method.
My diagnostic printout to the console reads:
     "t1DataModel = null
     t2DataModel = SecondTable$SecondTableModel@202ac00
     t2SourceRowData = [, , , , , , , ]
     T2RowDragger: Drag Dropped at : Row 12"
When this version is run:
     public void interTableCopy( int rowNumber, int position ) {
     //     DefaultTableModel t1DataModel = (DefaultTableModel)table1.getModel();
               System.out.println( "t1DataModel = " + t1DataModel );
     //     Object t1SourceRowData = t1DataModel.getDataVector().elementAt(rowNumber);
     //          System.out.println( "t1SourceRowData = " + t1SourceRowData );
          DefaultTableModel t2DataModel = (DefaultTableModel)secondTable.getModel();
               System.out.println( "t2DataModel = " + t2DataModel );
          Object t2SourceRowData = t2DataModel.getDataVector().elementAt(rowNumber);
               System.out.println( "t2SourceRowData = " + t2SourceRowData );
     //     t2DataModel.getDataVector().setElementAt(t1SourceRowData, position);
          t2DataModel.fireTableRowsUpdated(position, position);
          secondTable.repaint();
     }Please note that (1) the drag and drop code is written in the Macintosh API. (2) the code is not exactly pretty.
As always many thanks for any assistance.
---------------------------- code Starts here -------------------------------
     Table1.java ------------------------------------------------------------------------------------
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import com.apple.mrj.MRJOSType;
import com.apple.mrj.dnd.*;
import com.apple.mrj.datatransfer.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.text.*;
import java.awt.Toolkit;
class Table1 extends JTable {
     JFrame frame;
     JTable table1;
     JTable secondTable;
     SecondTable table2;
     TableColumnModel t1ColumnModel;
     TableColumnModel t2ColumnModel;
     JPanel topPanel;
     JPanel buttonPanel;
     public static Color rowDark = new Color( 135, 164, 173 );
     public static Color blueGray = new Color( 164, 176, 172 );
     public static Color greenishLight = new Color( 138, 197, 153 );
     public static Color selected = new Color( 255, 196, 140 ); // yellowishLight
     public static Font test_10ptCraw = new Font("CrawModern", Font.PLAIN, 10);
     private int rows = 40, cols = 8;
     private Object[] rowData = new Object[cols];
     Vector t1DataVector;
     Vector t2DataVector;
     DefaultTableModel t1DataModel;
     final SecondTable twotable = new SecondTable(t1DataModel);
// -------------------------------------------------------------------- variables for Drag&Drop
     public static Object sourceTable = "";
     public static Object dropTable = "";
     public static int startRow;
     public static int dropRow;
class T1Model extends DefaultTableModel {
     public boolean isCellEditable(int row, int col) {
     return true;
T1Model t1Model = new T1Model();
     public Table1() {
     for( int c = 0; c < cols; c++ ) {
          t1Model.addColumn( "Column " + Integer.toString(c) );
     for( int r = 0; r < rows; r++ ) {
          for( int c = 0; c < cols; c++) {
          //     rowData[c] = "ONE( " + r + "," + c + ")";
               rowData[c] = "";
          t1Model.addRow( rowData );
// -------------------------------------------------------------------------- set up the components
     topPanel = new JPanel();
          topPanel.setPreferredSize( new Dimension( 618, 40 ) );
          //topPanel.setBackground( Color.white );
     buttonPanel = new JPanel();
          buttonPanel.setPreferredSize( new Dimension( 618, 40 ) );
          //buttonPanel.setBackground( Color.white );
t1DataVector = t1Model.getDataVector();
     table1 = new JTable();
          table1.setModel( t1Model );
          table1.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
          table1.getTableHeader().setReorderingAllowed( false );
          table1.getTableHeader().setResizingAllowed(false);
          table1.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
          table1.setCellSelectionEnabled( false );
          table1.setRowHeight( 20 );
          table1.setGridColor( Color.black );
          table1.addMouseListener( new T1RowDragger( table1, table2, t1DataVector ) ); // ----- addMouseListener
t1DataModel = (DefaultTableModel)table1.getModel();
// --------------------------------------------------------------------------- set the TableCellRenderer
//     TableCellRenderer t1XRenderer = new T1RowAlternatorX();
//     table1.setDefaultRenderer(Object.class, t1XRenderer);
     JTableHeader t1Header = table1.getTableHeader(); // ------------------------------- TableHeader
     Dimension dim = t1Header.getPreferredSize();
     dim.height = 20;
     t1Header.setPreferredSize(dim);
     t1Header.setFont( test_10ptCraw );
// -------------------------------------------------------------------- assemble the frame
     frame = new JFrame( "Table1" );
     JScrollPane scrollPane = new JScrollPane( table1 );
     table1.setPreferredScrollableViewportSize(new Dimension(600, 350));
     JPanel mainPanel = new JPanel();
     mainPanel.setLayout(new BorderLayout());
     mainPanel.add(topPanel, BorderLayout.NORTH);
     mainPanel.add(scrollPane, BorderLayout.CENTER);
     mainPanel.add(buttonPanel, BorderLayout.SOUTH);
     frame.getContentPane().add( mainPanel );
     frame.setSize(618, 430);
     frame.setVisible(true);
     } // ------------------------------------------- close out the constructor "public Table1()"
} // ---------------------------------------------------  close out "class Table1 extends JTable"
SecondTable.java ------------------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.util.*;
class SecondTable extends JTable {
     private int rows = 100, cols = 8;
     private Object[] rowData = new Object[cols];
     JFrame frame;
     JTable table1;
     JTable secondTable;
     TableColumnModel t1ColumnModel;
     TableColumnModel t2ColumnModel;
     JPanel topPanel;
     JPanel buttonPanel;
     public static Color rowDark = new Color( 135, 164, 173 );
     public static Color blueGray = new Color( 164, 176, 172 );
     public static Color greenishLight = new Color( 138, 197, 153 );
     public static Color selected = new Color( 255, 196, 140 ); // yellowishLight
     public static Font test_10ptCraw = new Font("CrawModern", Font.PLAIN, 10);
// -------------------------------------------------------------------- variables for Drag&Drop
     Vector t1DataVector;
     Vector t2DataVector;
     public static Object sourceTable = "";
     public static Object dropTable = "";
     public static int startRow; // change to: sourceRow;
     public static int dropRow;
     class SecondTableModel extends DefaultTableModel {
           public boolean isCellEditable(int row, int col) {
                   return col > 0 && col < 5;
     SecondTableModel t2Model = new SecondTableModel();
// to pass Table1's data model in the SecondTable ctor.
     DefaultTableModel t1DataModel;
     public SecondTable( DefaultTableModel t1DataModel ) { // ------------------------------------------- the constructor "public SecondTable()"
     this.t1DataModel = t1DataModel;
//     t2Model = (DefaultTableModel) getModel();
     for( int c = 0; c < cols; c++ ) {
          t2Model.addColumn( "Column " + Integer.toString(c) );
     for( int r = 0; r < rows; r++ ) {
          for( int c = 0; c < cols; c++) {
          //     rowData[c] = "t2 ( " + r + "," + c + ")";
               rowData[c] = "";
          t2Model.addRow( rowData );
// ------------------------------------------------------------------------ set up the components
     topPanel = new JPanel();
          topPanel.setPreferredSize( new Dimension( 618, 40 ) );
          topPanel.setBackground( Color.white );
     buttonPanel = new JPanel();
          buttonPanel.setPreferredSize( new Dimension( 618, 40 ) );
          buttonPanel.setBackground( Color.white );
t2DataVector = t2Model.getDataVector();
     secondTable = new JTable(); // -------------------------------------------------------------- JTable
          secondTable.setModel( t2Model );
     //     secondTable.setColumnModel( t2ColumnModel );
          secondTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
          secondTable.getTableHeader().setReorderingAllowed( false );
          secondTable.getTableHeader().setResizingAllowed(false);
          secondTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
          secondTable.setCellSelectionEnabled( false );
          secondTable.setRowHeight( 20 );
          secondTable.setGridColor( Color.black );
          secondTable.addMouseListener( new T2RowDragger( table1, secondTable, t1DataVector,
                                                                      t2DataVector, t1DataModel ) ); // - Drag&Drop addMouseListener
// -------------------------------------------------------------------- set the TableCellRenderer
//     TableCellRenderer t2XRenderer = new T2RowAlternatorX();
//     secondTable.setDefaultRenderer(Object.class, t2XRenderer);
     JTableHeader t2Header = secondTable.getTableHeader(); // ------------------------------- TableHeader
     Dimension dim = t2Header.getPreferredSize();
     dim.height = 20;
     t2Header.setPreferredSize(dim);
     t2Header.setFont( test_10ptCraw );
// -------------------------------------------------------------------- assemble the frame
     JScrollPane scrollPane = new JScrollPane( secondTable );
     secondTable.setPreferredScrollableViewportSize(new Dimension(600, 350));
     JPanel mainPanel = new JPanel();
          mainPanel.setLayout(new BorderLayout());
          mainPanel.add(topPanel, BorderLayout.NORTH);
          mainPanel.add(scrollPane, BorderLayout.CENTER);
          mainPanel.add(buttonPanel, BorderLayout.SOUTH);
     frame = new JFrame( "SecondTable" );
          frame.getContentPane().add( mainPanel );
          frame.setSize(618, 430);
          frame.setLocation( 200, 200 );
          frame.setVisible(true);
     } // ------------------------------------------- close out the constructor "public SecondTable()"
} // ---------------------------------------------------  close out "class SecondTable extends JTable"
     T1RowDragger.java ------------------------------------------------------------------------------
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import com.apple.mrj.MRJOSType;
import com.apple.mrj.dnd.*;
import com.apple.mrj.datatransfer.*;
//import com.apple.mrj.dnd.Drag;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
class T1RowDragger extends DragAdapter implements DragInitiatorListener {
static JTable table1;
static JTable secondTable;
static Vector t1DataVector;
//public T1RowDragger( JTable table1, Vector t1DataVector ) {
public T1RowDragger( JTable table1, JTable secondTable, Vector t1DataVector ) {
this.table1 = table1;
this.secondTable = secondTable;
this.t1DataVector = t1DataVector;
Object sourceTable = "";
Object dropTable = "";
     int startRow;
     int dropRow;
     int dragStartRow;
     boolean dragging = false;
     public boolean dragMoved( DragEvent e ) {
     dragEntered( e );
          return true;
     protected void displayDragUnderEffects(Point p) {
          int row = table1.rowAtPoint(p);
          int column = table1.columnAtPoint(p);
          table1.setRowSelectionInterval(row, row);
          table1.setColumnSelectionInterval(column, column);
          //table1.repaint();
     public boolean dragEntered( DragEvent e ) { // ................................. dragEntered
     int dragEnteredRow = table1.rowAtPoint( e.getPoint() );
//     table1.rowAtPoint( e.getPoint() ).setBackground( selected );
//     dragEnteredRow.setForeground( selected );
     displayDragUnderEffects( e.getPoint() );
          if ( dragEnteredRow == -1 ) {;
               System.out.println( "[if] dragEnteredRow = " + dragEnteredRow );
          } else {               
     dragging = true;
               System.out.println( "Drag Entered at : Row " + dragEnteredRow );
               System.out.println( "" );
               return true;
     public boolean dragDropped( DragEvent e ) { // ................................. dragDropped
     dragging = false;
e.getDrag().setDropAccepted( true );
     if( e.getSource() == table1 ) { // -------------- set "dropTable" variable (in "dragDropped")
          Table1.dropTable = "table1";
     else if( e.getSource() == secondTable ) {
          dropTable = "secondTable";
     int theRow = table1.getSelectedRow();
     int nCol = table1.getSelectedColumn();
     int dragDropRow = table1.rowAtPoint( e.getPoint() );
     dropRow = table1.rowAtPoint( e.getPoint() );
     if ( dragDropRow == -1|| nCol == -1 ) {;
          System.out.println( "[if] dragDropRow = " + dragDropRow );
                                                       // do nothing     
     } else {               
          moveRow( startRow, startRow, dropRow ); // ============================== Call the "moveRow" method
          table1.repaint();
          System.out.println( "startRow : " + startRow );
          System.out.println( "dragStartRow : " + dragStartRow );
          System.out.println( "dropRow : " + dropRow );
     System.out.println( "T1RowDragger: e = " + e );
     System.out.println( "sourceTable = " + Table1.sourceTable );
     System.out.println( "dropTable = " + Table1.dropTable );
          System.out.println( "Drag Dropped at : Row " + dragDropRow );
          System.out.println( "" );
          return false;
     private boolean canAcceptDrag( DragEvent e ) {
          return true; // e.getDrag().allItemsContainFlavors(kAcceptableFlavors);
     // OUTGOING DRAGS:
     public void dragGesture( DragInitiatorEvent e ) { // ............................ dragGesture
          Table1.sourceTable = "table1"; // ---------------------- set "Table1.sourceTable" variable
     startRow = table1.getSelectedRow();
     dragStartRow = table1.getSelectedRow();
          Table1.startRow = table1.getSelectedRow(); // ---------- set "Table1.sourceTable" variable
     if( e.getSource() == table1 ) { // ------------ set "sourceTable" variable (in "dragGesture")
          sourceTable = "table1";
/*     else if( e.getSource() == secondTable ) {
          sourceTable = "secondTable";
     int nCol = table1.getSelectedColumn();
     OutgoingDrag drag = e.getDrag();
          if ( dragStartRow == -1 || nCol == -1 ) {return; // do nothing
          } else {               
               Transfer item = new Transfer();
               //item.addFlavor(OSTypeFlavor.kTypeTEXT, ((String)fContent).getBytes());
               drag.addItem(item);
               e.setDragRect( 0, e.getY()+50, 600,20 );// ............... sets drag rectangle graphic
               System.out.println( "Drag Initiated at: Row " + dragStartRow );
               System.out.println( "X: " + e.getX() );
               System.out.println( "Y: " + e.getY() );
     System.out.println( "sourceTable = " + Table1.sourceTable );
     private Object fContent = kTextData;
     private static final String kTextData = "What a drag!";
     public void dragCompleted( DragInitiatorEvent e ) { // .......................... dragCompleted
     public void dragFailed( DragInitiatorEvent e ) { // ............................. dragFailed
     public void moveRow(int startIndex,int endIndex,int toIndex)
        throws IndexOutOfBoundsException {
        int rows = t1DataVector.size();
        if (startIndex >= rows || endIndex >= rows || toIndex >= rows) {
            throw new IndexOutOfBoundsException();
        // Swap if start > end
        if (startIndex > endIndex) {
            startIndex ^= (endIndex ^= (startIndex ^= endIndex));
        // save block to move
        Object[] block = new Object[(endIndex - startIndex) + 1];
        for (int j=0; j < block.length; j++) {
            block[j] = t1DataVector.elementAt(startIndex + j);
          // Copy the stuff to replace the block
          if (startIndex < toIndex) {
             for (int j=startIndex; j < toIndex; j++) {
                t1DataVector.setElementAt(t1DataVector.elementAt(block.length + j), j);
          } else if (startIndex > toIndex) {
             // changed code
             for (int j=startIndex ; j > toIndex; j--) {
                t1DataVector.setElementAt(t1DataVector.elementAt(j-1), j);
        // Copy block to new position
        for (int j=0; j < block.length; j++) {
            t1DataVector.setElementAt(block[j], toIndex + j);
     T2RowDragger.java ------------------------------------------------------------------------------
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import com.apple.mrj.MRJOSType;
import com.apple.mrj.dnd.*;
import com.apple.mrj.datatransfer.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
class T2RowDragger extends DragAdapter implements DragInitiatorListener {
     JTable table1;
     JTable secondTable;
     Vector t1DataVector;
     Vector t2DataVector;
DefaultTableModel t1DataModel;
     public T2RowDragger( JTable table1, JTable secondTable, Vector t1DataVector,
                                   Vector t2DataVector, DefaultTableModel t1DataModel ) {
     this.table1 = table1;
     this.secondTable = secondTable;
     this.t1DataVector = t1DataVector;
     this.t2DataVector = t2DataVector;
     this.t1DataModel = t1DataModel;
     int startRow;
     int dropRow;
Object sourceTable = "";
Object dropTable = "";
     // OUTGOING DRAGS:
     public void dragGesture( DragInitiatorEvent e ) { // ............................ dragGesture
          Table1.sourceTable = "secondTable";
     startRow = secondTable.getSelectedRow();
     int dragStartRow = secondTable.getSelectedRow();
     int nCol = secondTable.getSelectedColumn();
     OutgoingDrag drag = e.getDrag();
          if ( dragStartRow == -1 || nCol == -1 ) {return; // do nothing
          } else {               
               Transfer item = new Transfer();
               item.addFlavor(OSTypeFlavor.kTypeTEXT, ((String)fContent).getBytes());
               drag.addItem(item);
               e.setDragRect( 0, e.getY()+50, 618,20 );
               System.out.println( "T2RowDragger: Drag Initiated at: Row " + dragStartRow );
               System.out.println( "X: " + e.getX() );
               System.out.println( "Y: " + e.getY() );
     System.out.println( "sourceTable = " + Table1.sourceTable );
     public boolean dragMoved( DragEvent e ) {
     dragEntered( e );
          return true;
     protected void displayDragUnderEffects(Point p) {
          int row = secondTable.rowAtPoint(p);
          int column = secondTable.columnAtPoint(p);
          secondTable.setRowSelectionInterval(row, row);
          secondTable.setColumnSelectionInterval(column, column);
          //secondTable.repaint();
     public boolean dragEntered( DragEvent e ) {
     int dragEnteredRow = secondTable.rowAtPoint( e.getPoint() );
     displayDragUnderEffects( e.getPoint() );
          if ( dragEnteredRow == -1 ) {;
               System.out.println( "T2RowDragger: Entered out of bounds !!" );
          } else {               
               System.out.println( "T2RowDragger: Drag Entered at : Row " + dragEnteredRow );
               System.out.println( "T2RowDragger: startRow : Row " + startRow );
               System.out.println( "T2RowDragger: dropRow : Row " + dropRow );
               System.out.println( "" );
               return true;
     public boolean dragDropped( DragEvent e ) { // ................................... dragDropped
          e.getDrag().setDropAccepted( true );
          Table1.dropTable = "secondTable"; // -------------- set "dropTable" variable (in "dragDropped")
          Table1.dropRow = secondTable.rowAtPoint( e.getPoint() ); // -------------- set "dropTable" variable (in "dragDropped")
          int theRow = secondTable.getSelectedRow();  // ------------ superfluous
          int nCol = secondTable.getSelectedColumn();
          Table1.dropRow = secondTable.rowAtPoint( e.getPoint() );
          dropRow = secondTable.rowAtPoint( e.getPoint() );
     if ( Table1.dropRow == -1|| nCol == -1 ) {;
          System.out.println( "T2RowDragger: Dropped out of bounds !!" );
                                                       // do nothing     
     } else {               
// ---------------------------------------------------------------------- new d&d code, 07/27/01
          if( Table1.sourceTable == "table1" ) {
               interTableCopy( Table1.startRow, Table1.dropRow );
               secondTable.repaint();
          else if( Table1.sourceTable == "secondTable" ) {
               moveRow( startRow, startRow, dropRow );
               secondTable.repaint();
          System.out.println( "T2RowDragger: Drag Dropped at : Row " + Table1.dropRow );
          System.out.println( "" );
     System.out.println( "sourceTable = " + Table1.sourceTable );
     System.out.println( "dropTable = " + Table1.dropTable );
          System.out.println( "T2RowDragger: startRow : " + startRow );
          System.out.println( "T2RowDragger: dropRow : " + dropRow );
          System.out.println( "Drag Dropped at : Row " + Table1.dropRow );
          System.out.println( "" );
               return false;
     public void moveRow(int startIndex,int endIndex,int toIndex) throws IndexOutOfBoundsException {
        int rows = t2DataVector.size();
        if (startIndex >= rows || endIndex >= rows || toIndex >= rows) {
            throw new IndexOutOfBoundsException();
        // Swap if start > end
        if (startIndex > endIndex) {
            startIndex ^= (endIndex ^= (startIndex ^= endIndex));
        // save block to move
        Object[] block = new Object[(endIndex - startIndex) + 1];
        for (int j=0; j < block.length; j++) {
            block[j] = t2DataVector.elementAt(startIndex + j);
          // Copy the stuff to replace the block
          if (startIndex < toIndex) {
             for (int j=startIndex; j < toIndex; j++) {
                t2DataVector.setElementAt(t2DataVector.elementAt(block.length + j), j);
          } else if (startIndex > toIndex) {
             // changed code
             for (int j=startIndex ; j > toIndex; j--) {
                t2DataVector.setElementAt(t2DataVector.elementAt(j-1), j);
         // Copy block to new position
        for (int j=0; j < block.length; j++) {
            t2DataVector.setElementAt(block[j], toIndex + j);
     public void dragCompleted( DragInitiatorEvent e ) { // .......................... dragCompleted
     public void dragFailed( DragInitiatorEvent e ) { // ............................. dragFailed
     private boolean canAcceptDrag( DragEvent e ) {
          return true; // e.getDrag().allItemsContainFlavors(kAcceptableFlavors);
     private Object fContent = kTextData;
     private static final String kTextData = "T2RowDragger: What a drag!";
     public void interTableCopy( int rowNumber, int position ) {
//          DefaultTableModel t1DataModel = (DefaultTableModel)table1.getModel();
               System.out.println( "t1DataModel = " + t1DataModel );
//          Object t1SourceRowData = t1DataModel.getDataVector().elementAt(rowNumber);
//               System.out.println( "t1SourceRowData = " + t1SourceRowData );
          DefaultTableModel t2DataModel = (DefaultTableModel)secondTable.getModel();
               System.out.println( "t2DataModel = " + t2DataModel );
          Object t2SourceRowData = t2DataModel.getDataVector().elementAt(rowNumber);
               System.out.println( "t2SourceRowData = " + t2SourceRowData );
//          t2DataModel.getDataVector().setElementAt(t1SourceRowData, position);
          t2DataModel.fireTableRowsUpdated(position, position);
          secondTable.repaint();
     public void selectiveCellCopy() {
          int sR = 1;               
          firstEmptyRow = 11;
          for ( int sC = 1; sC < 4; sC++ ) {                    
               Object value = table1.defaultTableModelX.getValueAt( sR, sC );
               DefaultTableModel t2DataModel = (DefaultTableModel)twotable.secondTable.getModel();
               t2DataModel.setValueAt( value, firstEmptyRow, (sC + 4) );
     //          t2Model.setValueAt( value, firstEmptyRow, (sR + 4) );           
     TableSetGo5.java ------------------------------------------------------------------------------
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class TableSetGo5 {
     public static void main(String args[]) {
          Table1 tableOne = new Table1();
     //     SecondTable tableTwo = new SecondTable();
     } // ------- closes out "public static void main(String args[])"
} // ----------- closes out "public class TableSetGo5"---------------------------- code Ends here -------------------------------

Hi,
Instantiated a variable is like...
JTable table1 = new JTable();
if you do
JTable table1
System.out.println(table1);
JTable table1 = new JTable();
it will print "null", and if you do,
table1.someTableMethod() you will get an error!!!!
Do not take that personnal(;0)))) but I know that you do not have a lot of experiece just by looking at the way you are selecting the name for your variables... like Table1, table1 and secondTable...But believe me, by working here on the forum you will be a pro soon.
Take care,
JRG

Similar Messages

  • Standalone executables and dependencies in the Java World

    I'm a very seasoned C/C++ developer who's just learning Java. I have this gnawing question that's bugging me. It's rather elementary but it requires someone with experience to answer it.
    If I'm delivering a standalone executable (C/C++) to a Windows or Linux customer, it is possible to deliver simply a "*.exe" file (windows) or a Linux Executable file (Linux) which can be installed and run immediately with no dependencies not included in a typical installation. (although, on linux, if there is a gui involved, a typical default Linux install may be missing some dependencies for the gui )
    But in the Java world, since the JRE is not necessarily included in a Standard Windows or Linux default installation, my customer would always have to install the JRE on their machine before they can run any code that I produce in Java ...correct? And there is no way to execute a jarfile as a standalone; it always must be executed by the JRE ("java -jar <jarfilename.jar> ) ...right? And if I were to code a new GUI application in Java on the Linux platform, it would have to be run via "java -jar <gui_jarfilename.jar> ...correct?

    R2me2 wrote:
    "Your questions cause me to suggest that you look into Java Web Start;"
    No, this is exactly what I'm not asking. I mean really standalone ....as in the executable runs by itself without user having to install anything else* (via CD, web or anywhere). So I suppose the answer to my question is that NO, there's no such thing in the Java World and that whenever a java program is installed, it always has the JRE as a dependency and that the installation of a java executable is not complete until the JRE is installed.Not to sound like a noob but what were you expecting. Java runs on the JRE and that is what makes it portable as the JRE can be installed almost anywhere o.O
    This is not the inconvenience that you are making it out to be. No user is gonna beef with you if they came to you asking for a java application to be installed and I most certainly have played the client role, having to download the latest JRE to run my bank applets. No so long as you provide the user with all the info they need like a link to JRE download etc you will be fine.. :)

  • Any suggestions on solving the "java.lang.OutOfMemory" error message?

    Hi, our application is running on WLS61 and calls Tuxedo services (on Tuxedo 71)
    through WTC.
    What the problem we got is: about every 6-7 days, our application becomes out
    of functioning and the WTC call returns the "TPEINVAL - invalid arguments given".
    But in the "weblogic.log" file it logs the error message as
    "####<Sep 7, 2002 1:31:19 AM CDT> <Error> <Management> <awhq6394.whq.ual.com>
    <ECSserver> <Application Manager Thread> <> <> <000000> <Throwable while poller
    running>
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    Please help us on the following questions:
    (1) From your experiences, is it really a Memory-Leak kind of problem or WTC-related
    problem, and if you have such experience, how did you solve the problem?
    (2)We use the DEFAULT value of "max-beans-in-cache" (to be 1000) for stateful
    and entity beans, and "max-beans-in-free-pool" (unlimited, depends on memory)
    for stateless beans. Does this might cause the POSSIBLE memory-leak problem? By
    the way, there are about 3000 transactions per day for our application.
    Also, please give us any suggestions you think is necessary.
    Thanks a lot!
    Bill

    - Do you get the error messages in jserv.log?
    - Have you read Note:119163.1 (How to set the heap size for the iAS/Jserv JVM) which ought to be avaliable on metalink?

  • What's going on in the java world?

    Hi guys,
    I haven't used Java since 2002. What's going on here. Would u tell me? Will be a great help.
    Thanx.
    shoovo

    Hi guys,
    I haven't used Java since 2002. What's going on here.
    Would u tell me? Will be a great help. A lot actually. Java has come of age. It's fast, stable and the Swing emulations really passable.
    The abandoned Java3D has made a come back as open source (kind of).
    A new major Java version called Tiger has been released with lots of language changes that elevates the Java abstraction level a notch. This includes generics, autoboxing and highlevel concurrency.
    Eclipse is better than ever.

  • Any body please can solve my problem that iam facing with JTable

    Dear sir,
    Iam doing an educational product using Swing as front end in that
    iam using JTables. And back end iam using sqlserver. With jtable iam
    facing very serious problem the problem is actually iam entering the values
    in all the columns after that iam pressing the save button its not
    saving but if i click on any of the columns and try to save its saving.
    please anybody can solve my problem.Please if a piece of code is there ill
    be very thankful to you. my mailid is [email protected]
    regards
    surya

    The problem is, the cellEditor does not know that editing has stopped and therefore has not updated the model (where the data actually resides). When you click off the cell to another cell, the first cell knows it must be done editing because you are leaving it. If you click a button (or anything other than another cell), the cell being edited has no knowledge of this. You need to call stopCellEditing() on the cell editor and your problem will be solved. To do this, put the following method into your code and call it when you click the button to clear, save or whatever you need to do.
    public void ceaseEditing() {    int row = this.getEditingRow();
      int col = this.getEditingColumn();
      if (row != -1 && col != -1)
        this.getCellEditor(row,col).stopCellEditing(); 
      }Hope this helped...

  • How to solve this problem that the error message is "kPDFMErrorLaunchingAssociatedApp"?

    HI,There is a ASP.NET program that use to convent the Word to PDF. I used PDFMAKERAPI.DLL in this program.this is the code
    using System;
    using PDFMAKERAPILib;
    namespace test1
        public partial class index : System.Web.UI.Page
            protected void Page_Load(object sender, EventArgs e)
                string wordPath = "C://123.doc";/ source word file
                string pdfPath = "C://123.pdf";// saved pdf file
                PDFMakerApp app = new PDFMAKERAPILib.PDFMakerApp();
                int iReslut = app.CreatePDF(wordPath, pdfPath, PDFMakerSettings.kConvertAllPages, false, false, false, System.Type.Missing);
                if (iReslut == 0)
                    a.Text = "Success!";
                else
                    //false!
                    a.Text = Enum.GetName(typeof(PDFMakerRetVals), iReslut);
    I run this program in a computer with win7,office2007 and adobe acrobat 9 pro.However, it couldn't convent Word to PDF.The wrong messege is "kPDFMErrorLaunchingAssociatedApp".Does anyone have a suggestion?  Thanks for any help you can provide.
    David

    The PDFMakers are not documented as part of the SDK as they are not supported for use by 3rd parties.
    If you wish to convert Word files to PDF, there are supported methods in the SDK.
    Also, be aware that Acrobat CANNOT LEGALLY be installed on a server, so hopefully that is not the case here.

  • Rookie to the Java World!!!

    Hello everyone, I need to develop an application using Java. I've never had experience w/Java before. I've done some searching on Sun here as well as other sites. But so far I'm very confused. Can someone tell me where is a good place to start as far as what I need to learn and develop a GUI application in Java? I've downloaded J2SE and IDE from Sun. But I have no clue on how to use or what they're good for.
    Any help would be greatly appreciated!
    Thank you in advance =)

    Crawl through some tutorials, that's always a good way to start:
    General Java:
    http://java.sun.com/docs/books/tutorial/
    Swing (for GUIs):
    http://java.sun.com/docs/books/tutorial/uiswing/

  • Hello Sorry for the inconvenience, but I have a problem in Java I can not open files, audio chat, which type of jnlp after the last update of the Java 2012-004 Please help me in solving this problem.

    Hello Sorry for the inconvenience, but I have a problem in Java I can not open files, audio chat, which type of jnlp after the last update of the Java 2012-004
    Please help me in solving this problem. 

    Make sure Java is enable in your browser's security settings.
    Open Java Preferences (in Utilities folder)
    Make sure Web-start applications are enabled.
    Drag Java 32-bit to the top of the list.
    jnlp isn't an audio file format. It's just a java web-start program (Java Network Launching Protocol).

  • Java ... and the real world

    Good Day,
    I'm new at JAVA language, I'm basicly a C++ programmer, but I wanted to get inside the java world and know what is it all about, I have the motivation to make it my 1st lang.
    But, there is a question, is it used widely like the other old and new languages, what makes it a better choice to develope with, what is the advantages I mean ??!!
    is it ready for a real huge application from the real world??
    give me an example
    thanks in advance

    Don't hold your breath ...by that I mean it will be
    better in some ways and the same in most ways.
    My point is that the future of computing, its
    application and its growth lies in network and
    inter-network applications, not in desktop and PC
    stand-alone applications.I don't know if i agree (that desktop apps aren't going to be 'the area' in the future)... just about everybody uses computers nowadays, with the vast majority being home desktop users. The desktop app market is set up in such a way that it cannot reach saturation, as 'everyone' (i.e. the majority of users) always want the upgrades... Norton Antivirus 2004 anyone?
    Basically, I agree with you that Java is not a player in this market, and systems integration is (and will continue to be) a huge growth area. Java should play a central role in this, due in part to its platform independence. Only problem is, in the future if the only programming jobs are bolting together components and existing systems, there will be even less coder jobs than today. So you could say, whilst the future of computing is network and inter-network apps, therein lies our doom...

  • The app store gives me the error 13. how do you solve this problem?

    the app stocome solve this problem that prevents me from downloadingapplications?

    Post to the App Store forum.
    https://discussions.apple.com/community/mac_app_store

  • Why would the Java Plugin not work in Firefox 5 on Mac SnowLeopard? I have the most recent version but am unable to use any Java features on Firefox 5. Firefox 3.6 works with the same Java but 5 will not.

    Most recent version of Java and firefox. Java Applications will start to load but end up in an infinite loading loop.

    Well, it's what I did to get my Java working in Firefox 4. I installed both binaries into my Library/Internet Plug-ins folder. The version was newer that what was previously installed (newer version is 0.9.7.5). It solved the Java problems I was having. My inital problem was that Java would not initiate and no applets would run in Firefox version 4 which I just installed a few days ago.
    I know the readme.txt. says it is not compatible with version 4, but the release date on 0.9.7.5 is after the release date of Firefox 4 and so that was I tried it. I figure there was nothing to lose as at worst it woud update my two plug-in files. Nothing was going to be changed otherwise. If you try it, it might work.

  • Using the JAVA ImportXmlTemplate function, should I always use XSL directory?

    Using the JAVA ImportXmlTemplate function requires XSL directory, I do not need XSL for my updates, how can I workaround this requirement?

    Ok, thanks for your quick answer. I saw you last blog posting regarding simple bar codes, I hope your next one turns up soon (read: today ;-) ).
    I did take a swing at writing my own class according to the user guide, using JDeveloper. One of my problems is that I am not that familiar with the whole java world, my experience lies almost entirely within .NET development. So when I read stuff like "make sure the class is available in the classpath for the JVM" and things like that, it is not a detailed enough description for me in order to make anything out of it. Do you think you can clarify that for me?
    I also wonder if you have any tips and tricks on how to trace/log information from the class when it executes? Because I think that I can actually get it to be called, it's just that something goes wrong and the generated PDF becomes badly formatted and has no content. I can see that some calls are made to a Logger class inside the example class. I guess that I need to set up some runtime configuration for that information to turn up in a file, but again me lacking experience from the java world prevents me from accomplishing that :-)
    Regarding tracing and logging from the java classes for the BI Publisher, can I get them to trace or log debug information in some clever way?
    The app I am developing is a .NET app that calls these classes using a product called juggerNET. I am developing a print direct application for JDEdwards EnterpriseOne since BI Publisher is not entirely integrated into it yet.
    I would greatly appreciate a quick reply this time as well if you can find the time!
    Best regards, Jörgen

  • Test Driven Development (TDD) in the ABAP world

    Hi All,
    It's been a long time since I've had any spare time to be active on the SCN forums so firstly hello to everyone.
    I've worked on a number of different SAP technologies over the years, starting with ABAP and moving into BSP, Portal API, Web Dynpro, Visual Composer, etc...  I'm currently working on a 7.01 Portal sat on top of an Oracle database and an old R/3 4.5b system.
    I'm also currently working on methodologies (trying to give something back to my colleagues here at AO) and have hit a bit of a blank around Test Driven Development when working in the ABAP stack.  I use JUnit to help me design, build and test Java based web services, ultimately used in WD, VC and via standalone Java applications.  I'm keen on increasing the adoption of TDD and other XP based practices but it needs to be viable in the ABAP world as well as the Java world.
    Here's my question - does anyone have any suggestions/experiences/guides or even just thoughts around using TDD with ABAP?
    I try to make all code I create service based so I rely on heavy use of componentisation, regardless of the language I am working with.  Obviously this is great with Java and ABAP Objects is also quite good, but sometimes we have to work with good old fashioned ABAP in the shape of programs, function groups and function modules.  I tend to treat a function group as a class and the function modules as the methods when designing and componentising.
    Applying the Java TDD approach, my rough idea is to use class/function groups to package my logic and then extend the class or group with an extra method/module that acts as the unit test routine.  I wonder if there is a better way though?
    It would be good to have a decent discussion in this area and capture everyone's thoughts as I'm sure I'm not the only person thinking along these lines.
    Thanks,
    Gareth.

    Hi Sandra,
    Thanks for that.  I wasn't sure if there'd be a proper SAP solution or not.
    Gareth.

  • I just updated my latest java but the update is causing problems with some externale devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device

    i just updated my latest java but the update is causing problems with some external devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device.
    Is this possible and how do i do that?
    Anyone who responds thanks for that!
    Juko
    I am running
    Hardware Overview:
      Model Name:          Mac Pro
      Model Identifier:          MacPro1,1
      Processor Name:          Dual-Core Intel Xeon
      Processor Speed:          2,66 GHz
      Number of Processors:          2
      Total Number of Cores:          4
      L2 Cache (per Processor):          4 MB
      Memory:          6 GB
      Bus Speed:          1,33 GHz
      Boot ROM Version:          MP11.005D.B00
      SMC Version (system):          1.7f10
      Serial Number (system):          CK7XXXXXXGP
      Hardware UUID:          00000000-0000-1000-8000-0017F20F82F0
    System Software Overview:
      System Version:          Mac OS X 10.7.5 (11G63)
      Kernel Version:          Darwin 11.4.2
      Boot Volume:          Macintosh HD(2)
      Boot Mode:          Normal
      Computer Name:          Mac Pro van Juko de Vries
      User Name:          Juko de Vries (jukodevries)
      Secure Virtual Memory:          Enabled
      64-bit Kernel and Extensions:          No
      Time since boot:          11 days 20:39
    Message was edited by Host

    Java 6 you can't as Apple maintains it, and Java 7 you could if you uninstall it and Oracle provides the earlier version which they likely won't his last update fixed 37 remote exploits.
    Java broken some software here and there, all you'll have to do is wait for a update from the other parties.

  • Hello all .. i have a big problem in my ipad version 5.1.1 that is when i connect the ipad with my computer the i tunes give me this message ( itunes couldnt connect to this ipad .an unknown error occurred (0xE8000012).) how i can solve this problem pleas

    hello all .. i have a big problem in my ipad version 5.1.1 that is when i connect the ipad with my computer the i tunes give me this message ( itunes couldnt connect to this ipad .an unknown error occurred (0xE8000012).) how i can solve this problem please
    and this is an pic for the problem

    There is some troubleshooting for 0xE8 error codes on this page : http://support.apple.com/kb/TS3221 - you could see if anything on that page fixes it

Maybe you are looking for

  • .war file vs properties files in weblogic 5.1

              I work with WebLogic 5.1 and I'm trying to deploy a web application which gets           a properties file. If I deploy it as an expanded directory hierarchy (with the           properties files into WEB-INF/classes) I have no problems. Whi

  • Oracle Databases and Storage Systems like HP EVA

    Hi everybody, are there generel advantages or disadvantages using such storage systems? I would be happy if somebody could talk about his experience using such systems. Is there better/less performance with Oracle Databases? Better/less Security for

  • Does SIRI need location service switched on

    Hi, I am trying to sort my location services out... Does SIRI need this to be switched on ? Thanks

  • Import EJB to Java Studio Creator 2?

    Hey all, I'm not quite sure if this is where I want to ask this question or not. I could not find another place to so I hope here will be fine. I've been working with EJB's and deploying them to JBoss for some time now, however I'm not to great on th

  • Eclipse & Running my RMI Server

    I have everything set up nicely to run my RMI Sever from eclipse and I keep getting this error message. Any help would be greatly appreciated: Exception in MAIN java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: