Results 1 to 9 of 9
  1. #1
    elad_bj is offline Member
    Join Date
    Jan 2009
    Posts
    8
    Rep Power
    0

    Default Problem With AI and JTable

    1) Why the function SetValueAt Doesn't Working ???
    2) Why i cant active my AI?

    codes:

    1)MF = where the table is defined
    g= AI type

    int Row1 = MF.table.getRowCount();
    int Col1 = MF.table.getColumnCount();

    Object data1 [][]=g.Dtable;

    for(int i=1;i<Row1;i++){
    for(int j=1;j<Col1;j++){
    MF.table.setValueAt(data1,i,j);
    }
    }
    }

    2)
    DD.g = new Bina(DD);
    dd=my main class with all the info
    g= Bina Type
    Bina = AI

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Don't repeatedly post the same thing.

    This question makes no sense. Whatsoever. What is setValueAt() supposed to do? What does it actually do? Where is the code for it? What is AI? What does it mean to active AI? Where is the code for AI? Likewise for Bina and DD.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #3
    elad_bj is offline Member
    Join Date
    Jan 2009
    Posts
    8
    Rep Power
    0

    Default

    SetValueAt need to put data1 in the JTable

    AI is the Artificial intelligence which i wrote in the code it called Bina.

    when i run the program i want that the computer get all the info fom class Define and start to prosees it in Bina class and then the put that info in data1.

    Here the codes:

    Java Code:
    package components;
    
    public class Bina {
    	  Define dh;
          int n;
    	  int d;
    	  int q;
    	  int b;
    	  String [][] Dtable = new String [7][11];
        public Bina(Define h) {
        	this.dh=h;
        }
        public void  ChoosePro (int row, int col)
        {
        	String Mik;
        	for(row=0;row<6;row++){
        		for(col=0;col<4;col++)
        		{
        			Mik=dh.selectPro[row][col];
        			hour_And_Day(Mik);
        		}
        	}
        }
        public void  hour_And_Day (String w){
    
        	int j;
        	int f=0;
        	int d=0;
        	String dd;
        	int i;
        	while (f<11)
        	{
        		if (dh.hoursPro[d][f]==w)
        		{
        			i=d;
        			for (j=0;j<7;j++)
        			{
        				if (dh.hoursPro[i][j]!=null)
        				{
        				if ((dh.hoursPro[i][j]!="Monday")&&(dh.hoursPro[i][j]!="Sunday"))
        				{
        					if((dh.hoursPro[i][j]!="Wensday")&&(dh.hoursPro[i][j]!="Tusday"))
        					{
        					if((dh.hoursPro[i][j]!="Thrusday")&&(dh.hoursPro[i][j]!="Friday"))
        					{
        						if((dh.hoursPro[i][j]!="Thrusday Friday")&&(dh.hoursPro[i][j]!="Thrusday Sunday")
        						&& (dh.hoursPro[i][j]!="Thrusday Monday") && (dh.hoursPro[i][j]!="Thrusday Tusday")
        						&& (dh.hoursPro[i][j]!="Thrusday Wensday"))
        						{
        				    	if((dh.hoursPro[i][j]!="Friday Thrusday")&&(dh.hoursPro[i][j]!="Friday Sunday")
        						&& (dh.hoursPro[i][j]!="Friday Monday") && (dh.hoursPro[i][j]!="Friday Tusday")
        						&& (dh.hoursPro[i][j]!="Friday Wensday"))
        						{
              			     			if((dh.hoursPro[i][j]!="Sunday Thrusday")&&(dh.hoursPro[i][j]!="Sunday Friday")
      									&& (dh.hoursPro[i][j]!="Sunday Monday") && (dh.hoursPro[i][j]!="Sunday Tusday")
       									&& (dh.hoursPro[i][j]!="Sunday Wensday"))
       									{
       									if((dh.hoursPro[i][j]!="Monday Thrusday")&&(dh.hoursPro[i][j]!="Monday Sunday")
       									&& (dh.hoursPro[i][j]!="Monday Friday") && (dh.hoursPro[i][j]!="Monday Tusday")
       									&& (dh.hoursPro[i][j]!="Monday Wensday"))
       									{
        									if((dh.hoursPro[i][j]!="Tuesday Thrusday")&&(dh.hoursPro[i][j]!="Tuesday Friday")
        									&& (dh.hoursPro[i][j]!="Tuesday Monday") && (dh.hoursPro[i][j]!="Tuesday Sunday")
        								    && (dh.hoursPro[i][j]!="Tuesday Wensday"))
        								    {
        									if((dh.hoursPro[i][j]!="Wensday Thrusday")&&(dh.hoursPro[i][j]!="Wensday Sunday")
        								    && (dh.hoursPro[i][j]!="Wensday Monday") && (dh.hoursPro[i][j]!="Wensday Tusday")
        							    	&& (dh.hoursPro[i][j]!="Wensday Friday"))
        							    	{
        								    	 Dtable[i][j]= " ";
        									}
        									if(dh.hoursPro[i][j]!="Wensday Thrusday")
        									{
        										dd="Wensday Thrusday";
        										Dtable[i][j] = Put_Day(dd,i);
        									}
        									else
        									{
        										if(dh.hoursPro[i][j]!="Wensday Sunday")
        										{
        										dd="Wensday Sunday";
        										Dtable[i][j] = Put_Day(dd,i);
        										}
        										else
        										{
        											if(dh.hoursPro[i][j]!="Wensday Monday")
        											{
        											dd="Wensday Monday";
        											Dtable[i][j] = Put_Day(dd,i);
        											}	
        										else
        										{
        											if(dh.hoursPro[i][j]!="Wensday Tusday")
        											{
        												dd="Wensday Tusday";
        												Dtable[i][j] = Put_Day(dd,i);
        											}
        											else
        											{
        												if(dh.hoursPro[i][j]!="Wensday Friday")
        												{
        													dd="Wensday Friday";
        													Dtable[i][j] = Put_Day(dd,i);
        												}	
        											}
        									   }	
        									}
        									}
        								}
        								else
        								{
        										if(dh.hoursPro[i][j]!="Tuesday Thrusday")
        									{
        										dd="Tuesday Thursday";
        										Dtable[i][j] = Put_Day(dd,i);
        									}
        									else
        									{
        										if(dh.hoursPro[i][j]!="Tuesday Sunday")
        										{
        										dd="Tuesday Sunday";
        										Dtable[i][j] = Put_Day(dd,i);
        										}
        										else
        										{
        											if(dh.hoursPro[i][j]!="Tuesday Monday")
        											{
        												dd="Tuesday Monday";
        												Dtable[i][j] = Put_Day(dd,i);
        											}	
        											else
        											{
        												if(dh.hoursPro[i][j]!="Tuesday Wensday")
        												{
        													dd="Tuesday Wensday";
        													Dtable[i][j] = Put_Day(dd,i);
        												}
        												else
        												{
        													if(dh.hoursPro[i][j]!="Tuesday Friday")
        													{
        														dd="Tuesday Friday";
        														Dtable[i][j] = Put_Day(dd,i);
        													}	
        												}
        									   		}	
        										}
        									}
        								}
        								}
        								else	
        								{
        									if(dh.hoursPro[i][j]!="Monday Thrusday")
        									{
        										dd="Monday Thursday";
        										Dtable[i][j] = Put_Day(dd,i);
        									}
        									else
        									{
        										if(dh.hoursPro[i][j]!="Monday Sunday")
        										{
        										dd="Monday Sunday";
        										Dtable[i][j] = Put_Day(dd,i);
        										}
        										else
        										{
        											if(dh.hoursPro[i][j]!="Monday Tuesday")
        											{
        											dd="Monday Tuesday";
        											Dtable[i][j] = Put_Day(dd,i);
        											}	
        											else
        											{
        												if(dh.hoursPro[i][j]!="Monday Wensday")
        												{
        												dd="Monday Wensday";
        												Dtable[i][j] = Put_Day(dd,i);
        												}
        												else
        												{
        													if(dh.hoursPro[i][j]!="Monday Friday")
        													{
        													dd="Monday Friday";
        													Dtable[i][j] = Put_Day(dd,i);
        													}	
        												}
        									   		}	
        										}
        									}
        								}	
        						}
        						else
        						{
        							if(dh.hoursPro[i][j]!="Su        ")
        							{
        								dd="Monday Thursday";
        								Dtable[i][j] = Put_Day(dd,i);
        							}
        							else
        							{
        								if(dh.hoursPro[i][j]!="Monday Sunday")
        								{
        									dd="Monday Sunday";
        									Dtable[i][j] = Put_Day(dd,i);
        								}
        								else
        								{
        									if(dh.hoursPro[i][j]!="Monday Tuesday")
        									{
        										dd="Monday Tuesday";
        										Dtable[i][j] = Put_Day(dd,i);
        									}	
        									else
        									{
        										if(dh.hoursPro[i][j]!="Monday Wensday")
        										{
        											dd="Monday Wensday";
        											Dtable[i][j] = Put_Day(dd,i);
        										}
        										else
        										{
        											if(dh.hoursPro[i][j]!="Monday Friday")
        											{
        												dd="Monday Friday";
        												Dtable[i][j] = Put_Day(dd,i);
        											}	
        										}
        									 }	
        								}
        							}
        						}	
        						}
        						}
        					}
        					else
        					{
        						if(dh.hoursPro[i][j]=="Thrusday")
        						{
        							dd="Thrusday";
        							Dtable[i][5]=Put_Day(dd,i);
        						}
        						else
        						{
        							if(dh.hoursPro[i][j]=="Friday")
        							{
        								dd="Friday";
        								Dtable[i][6]=Put_Day(dd,i);
        							}	
        						}
        					}
        					}
        					else
        					{
        						if(dh.hoursPro[i][j]=="Wensday")
        						{
        							dd="Wensday";
        							Dtable[i][4]=Put_Day(dd,i);
        						}
        						else
        						{
        							if(dh.hoursPro[i][j]=="Tuesday")
        							{
        								dd="Tuesday";
        								Dtable[i][3]=Put_Day(dd,i);
        							}	
        						}
        					}
        				}
        				else
        				{
        					if(dh.hoursPro[i][j]=="Sunday")
        					{
        						dd="Sunday";
        						Dtable[i][1]=Put_Day(dd,i);
        					}
        					else
        					{
        						if(dh.hoursPro[i][j]=="Monday")
        						{
        							dd="Monday";
        							Dtable[i][2]=Put_Day(dd,i);
        						}	
        					}	
        			 	}
        			
        			}
        			}
        		}
        		else
        		{
        			d++;
        		}
        	}
        }
        
        public String Put_Day (String d, int f)
        {
        	int j;
        	int numPro;
        	int numPro2;
        	int z;
        	String np;
        	String np1;
        	String npp=null;
        		for(j=0;j<7;j++)
        		{
        				z=j++;
        				if((dh.hoursPro[f][j]==d)&&(dh.hoursPro[f][z]==d))
        				{
        					np=dh.hoursPro[0][j];
        					np1=dh.hoursPro[0][z];
        					numPro=Pro_High_Search(np,f);
        					numPro2=Pro_High_Search(np1,f);
        					if(numPro>numPro2)
        					{
        						npp=np;
        					}
        					else 
        					{
        						npp=np1;
        					}	
        				}
        		}
        	return npp;
        }
        
        public int Pro_High_Search(String look,int k)
        {
        	int v=0;
        	while (dh.selectPro[k][v]!=look)
        	{
        		k++;
        		v++;
        	}
        	return v;
        }
    }



    Java Code:
    package components;
    
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    
    
    public class Define extends JPanel implements ActionListener {
        JLabel ProName; 
        protected JButton b2,b1,b4;
    	protected boolean noDecorations = false;
    	private Point lastLocation = null;
        private int maxX = 500;
        private int maxY = 500;
         String [][] selectPro = new String [7][7];
    	 String [][] hoursPro = new String [11][7];
    	 Bina g;
    	 myForm MF;
        
        public Define() {
         super(new BorderLayout());
    
            String[] ProfessionalStrings = { "English", "Math", "Computer Siecnce", "Literature", "Bio-Technology", "Bible", "History", "Citizenship", "Physics"};
    
            //Create the combo box, select the item at index 8.
            JComboBox ProList = new JComboBox(ProfessionalStrings);
            ProList.setSelectedIndex(8);
            ProList.setFont(new Font("David", Font.BOLD, 24));
            
            b2 = new JButton("Show Time Table");
            b2.setVerticalTextPosition(AbstractButton.CENTER);
            b2.setBackground(Color.white);
            b2.setFont(new Font("David", Font.BOLD, 24));
            b2.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            b2.setMnemonic(KeyEvent.VK_D);
            b2.setActionCommand("enable");
            b2.setToolTipText("Click this button to open the table.");
            
           	b1 = new JButton("Active The AI");
            b1.setVerticalTextPosition(AbstractButton.CENTER);
            b1.setBackground(Color.white);
            b1.setFont(new Font("David", Font.BOLD, 24));
            b1.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            b1.setToolTipText("Click this button to active the bina.");
            b1.addActionListener(this);
           
    		b4 = new JButton("Add New Data");
            b4.setVerticalTextPosition(AbstractButton.CENTER);
            b4.setBackground(Color.white);
            b4.setFont(new Font("David", Font.BOLD, 24));
            b4.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            b4.setToolTipText("Click this button to add new data.");
    		       
            //Listen for actions on buttons 1,2 and 4
           	OpenAction OP = new OpenAction ();   
            b2.addActionListener(OP);
            UpDate UP = new UpDate();
            ProList.addActionListener(UP);
            AddData AD = new AddData ();
            b4.addActionListener(AD);
           
            
            //Set up the label.
            ProName = new JLabel();
            ProName.setFont(new Font("David", Font.BOLD, 18));
            ProName.setHorizontalAlignment(JLabel.CENTER);
            UP.updateLabel(ProfessionalStrings[ProList.getSelectedIndex()]);
            ProName.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
    
            //The preferred size is hard-coded to be the width of the
            //widest image and the height of the tallest image + the border.
            //A real program would compute this.
            ProName.setPreferredSize(new Dimension(177, 122+10));
    
            //Lay out the demo.
            add(ProList, BorderLayout.PAGE_START);
            add(ProName, BorderLayout.PAGE_END);
            add(b2, BorderLayout.WEST);
            add(b1, BorderLayout.EAST);
            add(b4, BorderLayout.AFTER_LAST_LINE);
            setBorder(BorderFactory.createEmptyBorder(100,100,100,100));
        }
    
        /** Listens to the combo box. */
        public void actionPerformed(ActionEvent e) {
           JFrame CK = new ButtonClick ();
        }
    
       private class OpenAction implements ActionListener
       { 	
      	  public void actionPerformed(ActionEvent e){
        		if ("enable".equals(e.getActionCommand())) {
           				 showNewWindow();
        					}
            }
       }
        public void showNewWindow() {
            JFrame You = new myForm();
            
    
            //Take care of the no window decorations case.
            //NOTE: Unless you really need the functionality
            //provided by JFrame, you would usually use a
            //Window or JWindow instead of an undecorated JFrame.
            if (noDecorations) {
                You.setUndecorated(true);
            }
    
            //Set window location.
            if (lastLocation != null) {
                //Move the window over and down 40 pixels.
                lastLocation.translate(40, 40);
                if ((lastLocation.x > maxX) || (lastLocation.y > maxY)) {
                    lastLocation.setLocation(0, 0);
                }
                You.setLocation(lastLocation);
            } else {
                lastLocation = You.getLocation();
            }
            You.setSize(600,300);
            You.setVisible(true);
        }
        
        private class UpDate implements ActionListener
       { 	
      	  public void actionPerformed(ActionEvent e){
        	 JComboBox cb = (JComboBox)e.getSource();
            String Namee = (String)cb.getSelectedItem();
            updateLabel(Namee);
            updateVec(Namee);}
            
        protected void updateLabel(String name) {
          ProName.setText(name);
        }
        
        protected void updateVec(String name){
        	Scanner s = new Scanner(System.in);
    		Scanner h = new Scanner(System.in);
    		Scanner z = new Scanner(System.in);
    		int i=0;
    		int j;
    		int x=0;
    		int y=0;
    		int a=0;
    		String t;
    		for(int v=0;v<11;v++){
    			for(int n=0;n<7;n++){
    				hoursPro[v][n]=null;
    			}
    		}
    		for(int r=0;r<7;r++){
    			for(int m=0;m<7;m++)
    			{
    				selectPro[r][m]=null;
    			}
    		}
    		System.out.println("Insert Max Hours For The Subject");
    		j=s.nextInt();
    		if(selectPro[i][j]!=null)
    		{
    			i=reco_i(selectPro,i,j);
    			selectPro[i][j]=name;
    		}
    		else{
    			selectPro[i][j]=name;
    		}
    		
    		do
    		{
    			System.out.println("Insert Free Hour... End Of Input 0");
    			x=h.nextInt();
    			System.out.println("Insert Day That Subject Can Be Taught... End Of Input null");
    			t=z.next();
    			hoursPro[x][a]=t;
    		}	while ((x!=0) && (t!=null));
    		a++;
    
        }
        
        protected int reco_i(String [][] arry,int k, int f){
        	if (arry[k][f]!=null){
        		return reco_i(arry,k++,f);
        	}
        	else{
        		return k;
        	}
        } 
       
       }
        private class AddData implements ActionListener
       { 	
      	  public void actionPerformed(ActionEvent e){
        		int Row1 = MF.table.getRowCount();
        		int Col1 = MF.table.getColumnCount();
        		
        		Object data1 [][]=g.Dtable;
        		
        		for(int i=1;i<Row1;i++){
        			for(int j=1;j<Col1;j++){
        					MF.table.setValueAt(data1,i,j);
        						}
            }
       }
       }
    
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path) {
            java.net.URL imgURL = Define.class.getResource(path);
            if (imgURL != null) {
                return new ImageIcon(imgURL);
            } else {
                System.err.println("Couldn't find file: " + path);
                return null;
            }
        }
    }

    Java Code:
    /**
     * @(#)myForm.java
     *
     *
     * @author 
     * @version 1.00 2009/4/5
     */
    
    package components;
    
    import javax.swing.AbstractButton;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.ImageIcon;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    
    public class myForm extends JFrame {
    
                  private boolean DEBUG = false;
                  private Define D;
                  JTable table;
                  
            public myForm() { 
    
            String[] columnNames = {"Hours/Days",
            						"Sunday",
                                    "Monday",
                                    "Tuesday",
                                    "Wensday",
                                    "Thursday",
                                    "Firday"};
    
            Object[][] data = {
                {new Integer(1)," "," ", " ",
                 " ", " ", " "},
                {new Integer(2)," "," ", " ",
                 " ", " ", " "},
                {new Integer(3)," "," ", " ",
                 " ", " ", " "},
                {new Integer(4)," "," ", " ",
                 " ", " ", " "},
                {new Integer(5)," "," ", " ",
                 " ", " ", " "},
                 {new Integer(6)," "," ", " ",
                 " ", " ", " "},
                 {new Integer(7)," "," ", " ",
                 " ", " ", " "},
                 {new Integer(8)," "," ", " ",
                 " ", " ", " "},
                 {new Integer(9)," "," ", " ",
                 " ", " ", " "},
                 {new Integer(10)," "," ", " ",
                 " ", " ", " "}        
            };
    
            table = new JTable(data, columnNames);
            table.setPreferredScrollableViewportSize(new Dimension(500, 200));
            table.setFillsViewportHeight(true);
            
            
            if (DEBUG) {
                table.addMouseListener(new MouseAdapter() {
                    public void mouseClicked(MouseEvent e) {
                        printDebugData(table);
                    }
                });
            }
            
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
    
            //Add the scroll pane to this panel.
            add(scrollPane);
               
            }
       private void printDebugData(JTable table) {
            int numRows = table.getRowCount();
            int numCols = table.getColumnCount();
            javax.swing.table.TableModel model = table.getModel();
    
            System.out.println("Value of data: ");
            for (int i=0; i < numRows; i++) {
                System.out.print("    row " + i + ":");
                for (int j=0; j < numCols; j++) {
                    System.out.print("  " + model.getValueAt(i, j));
                }
                System.out.println();
            }
            System.out.println("--------------------------");
        }
    }

    Java Code:
    /**
     * @(#)ButtonClick.java
     *
     *
     * @author 
     * @version 1.00 2009/4/18
     */
    
    package components;
    
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    
    public class ButtonClick extends JFrame {
    	Define DD;
        public ButtonClick() {
    			if(JOptionPane.showConfirmDialog(null, "Active The AI?", "Roseindia.net", JOptionPane.YES_NO_OPTION) == 0)
    			{
    				 DD.g = new Bina(DD);
    				 JOptionPane.showMessageDialog(null, "You Active The AI", "Roseindia.net", 1);
    			}
    			else
    			{
    				JOptionPane.showMessageDialog(null, "You clicked on \"Cancel\" button", "Roseindia.net", 1);
    			}
    }  
        
        }

    Java Code:
    /**
     * @(#)gf.java
     *
     *
     * @author 
     * @version 1.00 2009/3/27
     */
    
    
    package components;
    
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    
    /* FrameDemo.java requires no other files. */
    public class Panel {
        /**
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
         */
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("FrameDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
            JComponent newContentPane = new Define();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        }
    
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
                }
            });
        }
    }

  4. #4
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    So what exactly is it that isn't working? What is the problem? I can't see where g or MF are initialised.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  5. #5
    elad_bj is offline Member
    Join Date
    Jan 2009
    Posts
    8
    Rep Power
    0

    Default

    When i run the Program it's show me that all right
    but when i click the buttons "Active the AI" and "Add New Data"
    it's show me errors and i don't understand why
    that's the problem
    i will really apreshate if you help me

  6. #6
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    What errors? We're not psychic here.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  7. #7
    elad_bj is offline Member
    Join Date
    Jan 2009
    Posts
    8
    Rep Power
    0

    Default

    these erroes:

    for "active ai"

    --------------------Configuration: My_New_Project - JDK version 1.6.0 <Default> - <Default>--------------------
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at components.ButtonClick.<init>(ButtonClick.java:21)
    at components.Define.actionPerformed(Define.java:88)
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:236)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEven tMulticaster.java:272)
    at java.awt.Component.processMouseEvent(Component.jav a:6038)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3260)
    at java.awt.Component.processEvent(Component.java:580 3)
    at java.awt.Container.processEvent(Container.java:205 8)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4410)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2116)
    at java.awt.Component.dispatchEvent(Component.java:42 40)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4322)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3986)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3916)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2102)
    at java.awt.Window.dispatchEventImpl(Window.java:2429 )
    at java.awt.Component.dispatchEvent(Component.java:42 40)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 599)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)




    for "add new data"

    --------------------Configuration: My_New_Project - JDK version 1.6.0 <Default> - <Default>--------------------
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at components.Define$AddData.actionPerformed(Define.j ava:195)
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:236)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEven tMulticaster.java:272)
    at java.awt.Component.processMouseEvent(Component.jav a:6038)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3260)
    at java.awt.Component.processEvent(Component.java:580 3)
    at java.awt.Container.processEvent(Container.java:205 8)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4410)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2116)
    at java.awt.Component.dispatchEvent(Component.java:42 40)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4322)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3986)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3916)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2102)
    at java.awt.Window.dispatchEventImpl(Window.java:2429 )
    at java.awt.Component.dispatchEvent(Component.java:42 40)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 599)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)

  8. #8
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    mistakes here
    Java Code:
    int Row1 = MF.table.getRowCount();
    and
    Java Code:
    DD.g = new Bina(DD);
    (exactly where the error messages tell you)

    Either MF and DD are both null. As I said before, this is because you have not initialised them anywhere.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  9. #9
    elad_bj is offline Member
    Join Date
    Jan 2009
    Posts
    8
    Rep Power
    0

    Default

    OK i wrote

    DD = new Define() and it doen't show me any errors

    and i also wrote MF = new myForm() but it still doen't work

Similar Threads

  1. JTABLE problem
    By MaximInf in forum AWT / Swing
    Replies: 4
    Last Post: 06-21-2008, 10:45 AM
  2. JTable problem
    By robbertds1 in forum AWT / Swing
    Replies: 1
    Last Post: 05-20-2008, 06:34 PM
  3. Replies: 2
    Last Post: 05-15-2008, 10:15 AM
  4. Problem with JTable
    By Felissa in forum AWT / Swing
    Replies: 2
    Last Post: 07-04-2007, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •