1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| import java.net.*;
import javax.swing.*;
public class Appli {
public static void main(String[] args) {
try {
new ServerSocket(PORT);
}
catch(Exception e) {
System.exit(0);
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setLocationRelativeTo(null);
}
});
}
private static int PORT = 1234 ;
private static final long serialVersionUID=42L;
} |