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.
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