Results 1 to 4 of 4
  1. #1
    silvia is offline Member
    Join Date
    Jul 2007
    Posts
    35
    Rep Power
    0

    Default Error: invalid method declaration; return type required

    I am trying to write one with two buttons on it I want them side by side and I want one to close the application and the other one to execute my ftp code that I will later add once I finish the GUI.

    Here is what I have so far and at the top where i create the buttons it keeps telling me invalid method declaration; return type required. right now I have it set up to beep once click becuase I have no idea how to close the program yet.

    Java Code:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    
     
     public class ExportFrame {
      public class ExportFrame implements ActionListener { 
     	     
        JButton pull;
        JButton close;
    
        public execute() {
            super(new BorderLayout());
            pull = new JButton("Pull");
            pull.setMnemonic('p');
            pull.setPreferredSize(new Dimension(20, 15));
            add(pull, BorderLayout.LEFT);
            pull.addActionListener(this);
            }
            
        public close() {
            super(new BorderLayout());
            close = new JButton("Close");
            close.setMnemonic('c');
            close.setPreferredSize(new Dimension(20, 15));
            add(close, BorderLayout.Right);
            close.addActionListener(this);
            
        }
    
        public void actionPerformed(ActionEvent e) {
            Toolkit.getDefaultToolkit().close();
            Toolkit.getDefaultToolkit().execute();
            }
     	
     	
     	
     	private static void createAndShowGUI(){
     		//Make sure we have nice window decorations.
     		JFrame.setDefaultLookAndFeelDecorated(true);
     		
     		//Create and set up the window.
     		JFrame frame = new JFrame("Stratis Export by Tyler Reid");
     		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
     		
     		//Shows the UI
     		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();
     			}
     		});
     	}
     	
     	
    } }
    Thanks

  2. #2
    sathish_2111 is offline Member
    Join Date
    Jul 2007
    Posts
    17
    Rep Power
    0

    Default

    you should have void return time....

  3. #3
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    what is void return time ?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    EBBOOO, if you have a question, please start a new thread rather than reviving long-dead old threads. Thanks for your cooperation.

    Locking.

Similar Threads

  1. Replies: 3
    Last Post: 08-14-2009, 12:57 PM
  2. Replies: 2
    Last Post: 07-30-2007, 08:55 AM
  3. Error: invalid method declaration
    By silvia in forum New To Java
    Replies: 1
    Last Post: 07-27-2007, 12:10 PM
  4. return type determines override/overload?
    By hedefalk in forum Advanced Java
    Replies: 4
    Last Post: 07-11-2007, 01:48 PM
  5. The return type
    By Marcus in forum New To Java
    Replies: 1
    Last Post: 07-05-2007, 06:28 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
  •