Results 1 to 12 of 12
Like Tree3Likes
  • 1 Post By Tolls
  • 1 Post By SurfMan
  • 1 Post By Ronin

Thread: erreure

  1. #1
    abby is offline Member
    Join Date
    Apr 2013
    Posts
    10
    Rep Power
    0

    Default erreure

    hello i m new and i m only new to java so i m counting on your help
    so here is the error message that keep dusterbing
    " at javax.swing.JFrame.addImpl(Unknown Source)"
    i m not sur what to do and because of it i cant do my connection to my data base !

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,044
    Rep Power
    20

    Default Re: erreure

    There will be an exception before that that says what has gone wrong, eg:
    NullPointerException
    at javax.swing.JFrame.addImpl(Unknown Source)
    etc etc.

    Also post the full stack trace (that is all the 'at ...' bits).
    abby likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    abby is offline Member
    Join Date
    Apr 2013
    Posts
    10
    Rep Power
    0

    Default Re: erreure

    i found the problem !
    it loks that it has somthing to do with the layout ..
    but i m at another one !!!!
    for some reason i can't link my button to another window !
    here the code i m using :
    " b1.addActionListener ( new ActionListener()
    { public void actionPerformed(ActionEvent e)
    {
    //fenetre.add(panel1, FlowLayout.CENTER);
    //quand on a cliqué sur le bouton ici
    F21 f =new F21();
    f.setVisible(true);

    }

    } ) ;}"
    and here the replay eclips is geving me :
    " Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
    The method setVisible(boolean) is undefined for the type F21

    at p1.F11$2.actionPerformed(F11.java:74)
    at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source) "

    i m sorry for not undrestanding but please help !!!

  4. #4
    abby is offline Member
    Join Date
    Apr 2013
    Posts
    10
    Rep Power
    0

    Default Re: erreure

    i dont get it it worked with another one !!

  5. #5
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: erreure

    What class does F21 extend from? Apparently that class(hierarchy) doesn't have a setVisible() method. In addition to that, F21 doesn't really show the purpose of the class. Try renaming it to something sensible, so I know what you're dealing with.
    abby likes this.

  6. #6
    abby is offline Member
    Join Date
    Apr 2013
    Posts
    10
    Rep Power
    0

    Default Re: erreure

    well that is true !
    it dosent have one ; java is accualy asking to create one ; i did made one ahere what eclipce says :
    " at p1.F21.setVisible(F21.java:160)"
    here is the methode i made :
    "
    public static void setVisible(boolean b) {
    // TODO Auto-generated method stub
    F21.setVisible(true);
    }

  7. #7
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    351
    Rep Power
    4

    Default Re: erreure

    Hi abby,

    Can you please post your code as all we are seeing at the moment are small snippets which mean nothing without knowing how exactly they are being used.

    Regards.
    abby likes this.

  8. #8
    abby is offline Member
    Join Date
    Apr 2013
    Posts
    10
    Rep Power
    0

    Default Re: erreure

    sur this is the class F11 :

    Java Code:
    package p1;
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    import javax.swing.JButton;
    
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    
    
    
    public class F11  extends JFrame implements ActionListener {
    
    	/**
    	 * 
    	 */
    	private static final long serialVersionUID = -1795554022873353381L;
    	/**
    	 * @param args
    	 */
    	/** public F11()
    	    {  super("Test");
    	    JButton b1 =new JButton("Ajouter");
    		
    	    
    	    b1.addActionListener ( new ActionListener()
            { public  void   actionPerformed11(ActionEvent e)
            public void actionPerformed1(ActionEvent arg0) {
    			new F21();
    			F21 f =new F21();
                f.setVisible(true);
    			
    		
            }
            {}*/
    	
    	static JPanel panel1 = new JPanel();
    	
    	
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		
    		F1 fenetre = new F1();
    		fenetre.setTitle("welcome");
    		fenetre.setSize(500,300);
    		fenetre.setLocation ( 400,  200);
    		fenetre.setVisible(true);
    		
    		
    		fenetre.setContentPane(buildContentPane());
    		
    		
    		
    		
    		
    		JButton b1 =new JButton("Ajouter");
    		b1.addActionListener( new ActionListener() {
    			
    		
    			//@SuppressWarnings("static-access")
    			public void actionPerformed(ActionEvent arg0) {
    				new F21();
    				//F2 f =new F2();
    	            //f.setVisible(true);
    	            F21 fenetre = new F21();
    	            fenetre.setVisible(true);
    
    				
    			}
    		}) ;
    		
    			 
    		
    
    	
                             
    		JButton b2  =new JButton("Modfier");
    		JButton b3 =new JButton("Supprimer");
    		JButton b4  =new JButton("Quitter");
    		panel1.add(b1);
    		panel1.add(b2);
    		panel1.add(b3);
    		panel1.add(b4);
    		  //ajoute un listener : ici le listener est cette classe
            b1.addActionListener ( new ActionListener()
            { public  void   actionPerformed(ActionEvent e)
            {
    		//fenetre.add(panel1, FlowLayout.CENTER);
            	  //quand on a cliqué sur le bouton ici
               // F2 f =new F2();
                           //f.setVisible(true);
                
             }
             
             } ) ;}
    		
    		
            public F11()
            
            {
            	/** b1.addActionListener ( new ActionListener()
                 { public  void   actionPerformed(ActionEvent e)
                 {
         		//fenetre.add(panel1, FlowLayout.CENTER);
                 	  //quand on a cliqué sur le bouton ici
                     F21 f =new F21();
                     f.setVisible(true);
                     
                  }*/
    	
    		
    		}
    	
    	
    		
    			
    		
    		
    	
    	private static JPanel buildContentPane(){
    		panel1.setLayout(new FlowLayout());
    		JLabel label = new JLabel("Choisssez une action !");
    		panel1.add(label, BorderLayout.NORTH);
    		return panel1;
    	}
    
    
    
    
    
    
    
    	@Override
    	public void actionPerformed(ActionEvent arg0) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	
    	
    
    }
    Java Code:
    //and this is the class i want to open :
     package p1;
    
    import java.awt.FlowLayout;
    
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class F21 {
    
    	/**
    	 * @param args
    	 */
    	 static JPanel panel1 = new JPanel();
    	private static Object GridLayout;
    	
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		F2 fenetre = new F2();
    		fenetre.setTitle("Add");
    		fenetre.setSize(500,300);
    		fenetre.setLocation ( 400,  200);
    		//fenetre.setVisible(true);
    		
    		
    		
    		
    		
    		
    
    		
    		fenetre.setContentPane( buildContentPane1());
    		fenetre.setContentPane(buildContentPane33());
    		
    		fenetre.setContentPane( buildContentPane2());
    		fenetre.setContentPane(buildContentPane33());
    
    		fenetre.setContentPane( buildContentPane3());
    		fenetre.setContentPane(buildContentPane33());
    
    		fenetre.setContentPane( buildContentPane4());
    		fenetre.setContentPane(buildContentPane33());
    
    
    		
    		JButton b5 =new JButton("Ajouter");
    		JButton b6  =new JButton("Modfier");
    		JPanel panel2 = new JPanel();
    		panel2.add(b5);
    		panel2.add(b6);
    		//fenetre.add(panel1,BorderLayout.SOUTH);
    		
    		fenetre.setVisible(true);
    		
    		
    	}
    	public void setVisible(boolean b) {
    		// TODO Auto-generated method stub
    		 //F21.setVisible(true);
    }
    		
    		
    		
    
    		
    	
    	
    	
    	
    	
    	
    	private static JPanel buildContentPane1(){
    		
    		panel1.setLayout(new FlowLayout());
    		JLabel label = new JLabel("saisir le la derection du voyage !");
    		panel1.add(label, GridLayout);
    		return panel1;
    	}
    	private static JPanel buildContentPane2(){
    		// JPanel panel2 = new JPanel();
    	panel1.setLayout(new FlowLayout());
    		JLabel label = new JLabel("saisir la date de depart  !");
    			panel1.add(label, GridLayout);
    		return panel1;
    	}
    	
    	private static JPanel buildContentPane4(){
    		// JPanel panel2 = new JPanel();
    	panel1.setLayout(new FlowLayout());
    		JLabel label = new JLabel("saisir la date d'arriver  !");
    			panel1.add(label, GridLayout);
    		return panel1;
    	}
    	
    	
    	
    	private static JPanel buildContentPane3(){
    		//JPanel panel3 = new JPanel();
    		panel1.setLayout(new FlowLayout());
    		JLabel label = new JLabel("saisir le nombre de voyageures !");
    		panel1.add(label, GridLayout);
    		return panel1;
    	}
    	
    
    	/**private static JPanel buildContentPane4(){
    		 JPanel panel4 = new JPanel();
    		panel1.setLayout(new FlowLayout());
    		JLabel label = new JLabel("Choisssez une action !");
    		panel1.add(label, GridLayout(3));
    		return panel1;
    	}
    	*/
    	
    	
    	
    	
    	
    	/**private static Object GridLayout(int i) {
    		// TODO Auto-generated method stub
    		return null;
    	}*/
    
    
    
    	/**private static JPanel buildContentPane11(){
    		//JPanel panel2 = new JPanel();
    		panel1.setLayout(new FlowLayout());
    		JTextField textField = new JTextField();
    		textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
    		panel1.add(textField, GridLayout);
    		return panel1;
    	
    	
    	private static JPanel buildContentPane22(){
    		//JPanel panel2 = new JPanel();
    		panel1.setLayout(new FlowLayout());
    		JTextField textField = new JTextField();
    		textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
    		panel1.add(textField, GridLayout);
    		return panel1;
    	}
    	
    	
    	private static JPanel buildContentPane44(){
    		//JPanel panel2 = new JPanel();
    		panel1.setLayout(new FlowLayout());
    		JTextField textField = new JTextField();
    		textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
    		panel1.add(textField, GridLayout);
    		return panel1;
    	}*/
    	
    	private static JPanel buildContentPane33(){
    		//JPanel panel2 = new JPanel();
    		panel1.setLayout(new FlowLayout());
    		JTextField textField = new JTextField();
    		textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
    		panel1.add(textField, GridLayout);
    		return panel1;
    	}
    
    
    
    
    
    
    	/**public static void setVisible(boolean b) {
    		// TODO Auto-generated method stub
    		 F21.setVisible(true);
    	}*/
    
    }
    // i the thing is i have 2 class the first has a button that i want it to open the 2 ; i m not sure but i think i didnt know how to manipulate the code !
    Last edited by pbrockway2; 04-13-2013 at 12:08 AM. Reason: code tags added

  9. #9
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    351
    Rep Power
    4

    Default Re: erreure

    Please use [code] tags as it makes it easier to read.

    The reason you are seeing the error message is F21 does not extend anything so is nothing more than a simple object. As such it doesn't inherit the method setVisible().

    Regards.

  10. #10
    abby is offline Member
    Join Date
    Apr 2013
    Posts
    10
    Rep Power
    0

    Default Re: erreure

    i see how can fix it ?

  11. #11
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: erreure

    The code tags work like this: you put [code] at the start of the code and [/code] at the end.

  12. #12
    abby is offline Member
    Join Date
    Apr 2013
    Posts
    10
    Rep Power
    0

    Default Re: erreure

    Java Code:
    package p1;
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
     
    import javax.swing.JButton;
     
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
     
     
     
    public class F11  extends JFrame implements ActionListener {
     
        /**
         * 
         */
        private static final long serialVersionUID = -1795554022873353381L;
        /**
         * @param args
         */
        /** public F11()
            {  super("Test");
            JButton b1 =new JButton("Ajouter");
             
             
            b1.addActionListener ( new ActionListener()
            { public  void   actionPerformed11(ActionEvent e)
            public void actionPerformed1(ActionEvent arg0) {
                new F21();
                F21 f =new F21();
                f.setVisible(true);
                 
             
            }
            {}*/
         
        static JPanel panel1 = new JPanel();
         
         
        public static void main(String[] args) {
            // TODO Auto-generated method stub
             
            F1 fenetre = new F1();
            fenetre.setTitle("welcome");
            fenetre.setSize(500,300);
            fenetre.setLocation ( 400,  200);
            fenetre.setVisible(true);
             
             
            fenetre.setContentPane(buildContentPane());
             
             
             
             
             
            JButton b1 =new JButton("Ajouter");
            b1.addActionListener( new ActionListener() {
                 
             
                //@SuppressWarnings("static-access")
                public void actionPerformed(ActionEvent arg0) {
                    new F21();
                    //F2 f =new F2();
                    //f.setVisible(true);
                    F21 fenetre = new F21();
                    fenetre.setVisible(true);
     
                     
                }
            }) ;
             
                  
             
     
         
                              
            JButton b2  =new JButton("Modfier");
            JButton b3 =new JButton("Supprimer");
            JButton b4  =new JButton("Quitter");
            panel1.add(b1);
            panel1.add(b2);
            panel1.add(b3);
            panel1.add(b4);
              //ajoute un listener : ici le listener est cette classe
            b1.addActionListener ( new ActionListener()
            { public  void   actionPerformed(ActionEvent e)
            {
            //fenetre.add(panel1, FlowLayout.CENTER);
                  //quand on a cliqué sur le bouton ici
               // F2 f =new F2();
                           //f.setVisible(true);
                 
             }
              
             } ) ;}
             
             
            public F11()
             
            {
                /** b1.addActionListener ( new ActionListener()
                 { public  void   actionPerformed(ActionEvent e)
                 {
                //fenetre.add(panel1, FlowLayout.CENTER);
                      //quand on a cliqué sur le bouton ici
                     F21 f =new F21();
                     f.setVisible(true);
                      
                  }*/
         
             
            }
         
         
             
                 
             
             
         
        private static JPanel buildContentPane(){
            panel1.setLayout(new FlowLayout());
            JLabel label = new JLabel("Choisssez une action !");
            panel1.add(label, BorderLayout.NORTH);
            return panel1;
        }
     
     
     
     
     
     
     
        @Override
        public void actionPerformed(ActionEvent arg0) {
            // TODO Auto-generated method stub
             
        }
     
         
         
     
    }
    thank u :)

    here my 2 one

    Java Code:
     package p1;
     
    import java.awt.FlowLayout;
     
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class F21 {
     
        /**
         * @param args
         */
         static JPanel panel1 = new JPanel();
        private static Object GridLayout;
         
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            F2 fenetre = new F2();
            fenetre.setTitle("Add");
            fenetre.setSize(500,300);
            fenetre.setLocation ( 400,  200);
            //fenetre.setVisible(true);
             
             
             
             
             
             
     
             
            fenetre.setContentPane( buildContentPane1());
            fenetre.setContentPane(buildContentPane33());
             
            fenetre.setContentPane( buildContentPane2());
            fenetre.setContentPane(buildContentPane33());
     
            fenetre.setContentPane( buildContentPane3());
            fenetre.setContentPane(buildContentPane33());
     
            fenetre.setContentPane( buildContentPane4());
            fenetre.setContentPane(buildContentPane33());
     
     
             
            JButton b5 =new JButton("Ajouter");
            JButton b6  =new JButton("Modfier");
            JPanel panel2 = new JPanel();
            panel2.add(b5);
            panel2.add(b6);
            //fenetre.add(panel1,BorderLayout.SOUTH);
             
            fenetre.setVisible(true);
             
             
        }
        public void setVisible(boolean b) {
            // TODO Auto-generated method stub
             //F21.setVisible(true);
    }
             
             
             
     
             
         
         
         
         
         
         
        private static JPanel buildContentPane1(){
             
            panel1.setLayout(new FlowLayout());
            JLabel label = new JLabel("saisir le la derection du voyage !");
            panel1.add(label, GridLayout);
            return panel1;
        }
        private static JPanel buildContentPane2(){
            // JPanel panel2 = new JPanel();
        panel1.setLayout(new FlowLayout());
            JLabel label = new JLabel("saisir la date de depart  !");
                panel1.add(label, GridLayout);
            return panel1;
        }
         
        private static JPanel buildContentPane4(){
            // JPanel panel2 = new JPanel();
        panel1.setLayout(new FlowLayout());
            JLabel label = new JLabel("saisir la date d'arriver  !");
                panel1.add(label, GridLayout);
            return panel1;
        }
         
         
         
        private static JPanel buildContentPane3(){
            //JPanel panel3 = new JPanel();
            panel1.setLayout(new FlowLayout());
            JLabel label = new JLabel("saisir le nombre de voyageures !");
            panel1.add(label, GridLayout);
            return panel1;
        }
         
     
        /**private static JPanel buildContentPane4(){
             JPanel panel4 = new JPanel();
            panel1.setLayout(new FlowLayout());
            JLabel label = new JLabel("Choisssez une action !");
            panel1.add(label, GridLayout(3));
            return panel1;
        }
        */
         
         
         
         
         
        /**private static Object GridLayout(int i) {
            // TODO Auto-generated method stub
            return null;
        }*/
     
     
     
        /**private static JPanel buildContentPane11(){
            //JPanel panel2 = new JPanel();
            panel1.setLayout(new FlowLayout());
            JTextField textField = new JTextField();
            textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
            panel1.add(textField, GridLayout);
            return panel1;
         
         
        private static JPanel buildContentPane22(){
            //JPanel panel2 = new JPanel();
            panel1.setLayout(new FlowLayout());
            JTextField textField = new JTextField();
            textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
            panel1.add(textField, GridLayout);
            return panel1;
        }
         
         
        private static JPanel buildContentPane44(){
            //JPanel panel2 = new JPanel();
            panel1.setLayout(new FlowLayout());
            JTextField textField = new JTextField();
            textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
            panel1.add(textField, GridLayout);
            return panel1;
        }*/
         
        private static JPanel buildContentPane33(){
            //JPanel panel2 = new JPanel();
            panel1.setLayout(new FlowLayout());
            JTextField textField = new JTextField();
            textField.setColumns(10); //On lui donne un nombre de colonnes à afficher
            panel1.add(textField, GridLayout);
            return panel1;
        }
     
     
     
     
     
     
        /**public static void setVisible(boolean b) {
            // TODO Auto-generated method stub
             F21.setVisible(true);
        }*/
     
    }
    Last edited by pbrockway2; 04-13-2013 at 10:41 PM.

Tags for this Thread

Posting Permissions

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