hier mein code:
public void clientFenster(DataOutputStream dos, DataInputStream dis) {
warteFenster.WarteFenster.warten().dispose();
os = dos;
is = dis;
// Hauptfenster
frame = new JFrame("Backup");
Container pane = frame.getContentPane();
// Layout setzen
pane.setLayout(new BorderLayout());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocation(200, 100);
frame.setPreferredSize(new Dimension(850, 500));
// rechts Seite des Fensters
pane.add(rechts(dos));
// linke Seite des Fensters
pane.add(links(), BorderLayout.WEST);
// warteFenster.WarteFenster.warten().
// anzeigen des Fensters
frame.pack();
frame.setVisible(true);
}
und hier der vom fenster was sich schließe soll:
package warteFenster;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import oberflaeche.Oberflaeche;
public class WarteFenster {
private static JFrame warte;
/**
* @param args
*/
public static JFrame warten(){
warte = new JFrame("Bitte haben Sie etwas Geduld!");
warte.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
Container pane = warte.getContentPane();
// Layout setzen
pane.setLayout(new BorderLayout());
JPanel north = new JPanel();
//Icon icon = new ImageIcon("sanduhr.gif");
Icon icon = new ImageIcon("zahnräder2.gif");
JLabel label = new JLabel(icon);
north.add(label);
warte.add(north, BorderLayout.NORTH);
JPanel south = new JPanel();
south.setLayout(new GridLayout(1, 3));
south.add(new JLabel(" "));
JButton abbrechen = new JButton( "Abbrechen" );
abbrechen.addActionListener(abbrechenFenster);
south.add( abbrechen);
south.add(new JLabel(" "));
warte.add(south, BorderLayout.SOUTH);
JLabel bitteWarten = new JLabel();
warte.add(bitteWarten, BorderLayout.CENTER);
warte.setLocation(200, 200);
warte.pack();
warte.setVisible( true );
return warte;
}
static ActionListener abbrechenFenster = new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
System.exit(0);
}
};
public static void main(String[] args) {
warten();
Oberflaeche fenster = new Oberflaeche();
fenster.clientFenster(null, null);
}
}