Hallo,
ich habe ein großes Problem:
Wenn ich in meiner Applikation einen Thread starte, dann hängt das Programm und nichts geht mehr (nur noch killen).
Ich hoffe Ihr könnt mir helfen!
das geht:
da hängt das Programm dann:
LG Purzel
ich habe ein großes Problem:
Wenn ich in meiner Applikation einen Thread starte, dann hängt das Programm und nichts geht mehr (nur noch killen).
Ich hoffe Ihr könnt mir helfen!
das geht:
Java:
connect = new JButton("Connect");
connect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
connect.setEnabled(false);
disconnect.setEnabled(true);
status.setText("Connected");
try {
server = new ServerSocket(PORT);
} catch (IOException se) {
se.printStackTrace();
}
}
});
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 1;
f.add(connect, c);
da hängt das Programm dann:
Java:
connect = new JButton("Connect");
connect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
connect.setEnabled(false);
disconnect.setEnabled(true);
status.setText("Connected");
try {
server = new ServerSocket(PORT);
Socket s;
while(true) {
s = server.accept();
ServerThread t = new ServerThread(s);
t.start();
}
} catch (IOException se) {
se.printStackTrace();
}
}
});
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 1;
f.add(connect, c);
LG Purzel