1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
- package chatprogramm;
-
- import controller.ConnectController;
- import controller.ReceiveAdapter;
- import controller.SendController;
- import javax.swing.JOptionPane;
- import static javax.swing.JOptionPane.CLOSED_OPTION;
- import javax.swing.UIManager;
- import model.Transmitter;
- import view.ChatView;
-
- /**
- *
- * @author Apollo
- */
- public class Start
- {
- public Start()
- {
- //Auswahl für Server oder Client
- String[] options = {"Server","Client"};
- int entscheidung = JOptionPane.showOptionDialog(null, "Server oder Client Modus?","Auswahl des Operationmoduses",JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
- if(entscheidung == CLOSED_OPTION)
- {
- JOptionPane.showMessageDialog(null, "Unbekannter Fehler");
- System.exit(0);
- }
- //
-
- ChatView view = new ChatView();
- if(entscheidung==0) view.setTitle("Server");
- if(entscheidung==1) view.setTitle("Client");
- Transmitter model = new Transmitter(entscheidung);
-
- ConnectController conncontroller = new ConnectController(view,model);
-
- Thread chatter = new Thread(model);
- chatter.start();
-
- SendController sendcontroller = new SendController(view,model);
- sendcontroller.registerEvents();
-
- ReceiveAdapter adapter = new ReceiveAdapter(view,model);
- adapter.registerEvents();
-
- view.setVisible(true);
-
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args)
- {
- try
- {
- for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- UIManager.setLookAndFeel(info.getClassName());
- }
- }
- }
- catch(Exception ex)
- {
- JOptionPane.showMessageDialog(null, "Fehler beim Aufrufen der Syseinstellungen");
- }
- new Start();
- }
- }
|