/* * 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 kommunikation; import javax.swing.JOptionPane; import kommunikation.controller.ConnectController; import kommunikation.controller.GrafikController; import kommunikation.controller.ReceiveAdapter; import kommunikation.controller.SendController; import kommunikation.transmitter.BilderKom; import kommunikation.view.ViewChat; /** * Builder Class * @author Alexander_Christoph */ public class Start { public Start() { Object[] options = {"Client","Server"}; int selected = JOptionPane.showOptionDialog(null,"Wollen Sie Client oder Server sein","Konfiguration",JOptionPane.DEFAULT_OPTION,JOptionPane.QUESTION_MESSAGE,null, options, options[0]); if(selected < 0) { JOptionPane.showMessageDialog(null, "Sie müssen entweder Client oder Server sein. Bitte starten Sie das Programm erneut und wählen eine Option","Fehler", JOptionPane.ERROR_MESSAGE); } else { ViewChat view = new ViewChat(); BilderKom model = new BilderKom(selected); model.registerEvents(); if(selected == 1) { view.setTitle("Server"); } view.getGrafikViewChat().setModel(model.getModel()); GrafikController gcontrol= new GrafikController(view.getGrafikViewChat(),model); gcontrol.registerEvents(); ConnectController control = new ConnectController(view,model); control.registerEvents(); SendController send = new SendController(view,model); send.registerEvents(); ReceiveAdapter adapter = new ReceiveAdapter(view,model); adapter.registerEvents(); view.setVisible(true); } } /** * @param args the command line arguments */ public static void main(String[] args) { new Start(); } }