/* * 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,entscheidung); conncontroller.registerEvents(); SendController sendcontroller = new SendController(view,model); sendcontroller.registerEvents(); ReceiveAdapter adapter = new ReceiveAdapter(view,model); adapter.registerEvents(); view.setSize(800,600); view.setLocationRelativeTo(null); 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(); } }