Your nested-classes are private
that means that are only visible in ServerSocket
class. So you can provide a helper method with more visibility or change class declaration signature with more visibility.
Example with helper method:
public class SocketServer {
.
.
//nested classes declaration
public static void startServer(){
//code to start threads new SomeThread().start();
}
}
And in your action
public class ServerAction extends AbstractAction{
@Override
public void actionPerformed(ActionEvent e){
SocketServer.startServer();
JOptionPane.showMessageDialog(null, "Test");
}
}
It would be great if you can notify when a client is connected and so on, I'd recommend you to take a look to SwingWorker
that provide helpful tool to handle notification between a background thread and the gui thread.
Read more: Worker threads and SwingWorker
Note : Would be great if you implements Runnable
rather to extend Thread, you are not adding any special functionality to thread there is no reason, more details here --> "implements Runnable" vs. "extends Thread".