/* | |||||
* 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 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 > 1) | |||||
{ | |||||
JOptionPane.showMessageDialog(null, "Unbekannter Fehler"); | |||||
System.exit(0); | |||||
} | |||||
// | |||||
ChatView view = new ChatView(); | |||||
Transmitter model = new Transmitter(entscheidung); | |||||
ConnectController conncontroller = new ConnectController(); | |||||
SendController sendcontroller = new SendController(view); | |||||
sendcontroller.registerEvents(); | |||||
ReceiveAdapter adapter = new ReceiveAdapter(model); | |||||
view.setVisible(true); | |||||
model.run(); | |||||
} | |||||
/** | |||||
* @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(); | |||||
} | |||||
} |
/* | |||||
* 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 controller; | |||||
/** | |||||
* | |||||
* @author Apollo | |||||
*/ | |||||
public class ConnectController | |||||
{ | |||||
public ConnectController() | |||||
{ | |||||
} | |||||
} |
/* | |||||
* 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 controller; | |||||
import java.util.Observable; | |||||
import java.util.Observer; | |||||
import model.Transmitter; | |||||
/** | |||||
* | |||||
* @author Apollo | |||||
*/ | |||||
public class ReceiveAdapter implements Observer | |||||
{ | |||||
public ReceiveAdapter(Transmitter model) | |||||
{ | |||||
} | |||||
@Override | |||||
public void update(Observable arg0, Object arg1) | |||||
{ | |||||
} | |||||
} |
/* | |||||
* 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 controller; | |||||
import java.awt.event.ActionEvent; | |||||
import java.awt.event.ActionListener; | |||||
import view.ChatView; | |||||
/** | |||||
* | |||||
* @author Apollo | |||||
*/ | |||||
public class SendController implements ActionListener | |||||
{ | |||||
ChatView view; | |||||
String input; | |||||
public SendController(ChatView view) | |||||
{ | |||||
this.view = view; | |||||
} | |||||
public void registerEvents() | |||||
{ | |||||
view.getInputField().addActionListener(this); | |||||
} | |||||
@Override | |||||
public void actionPerformed(ActionEvent arg0) | |||||
{ | |||||
input = view.getInputField().getText(); | |||||
view.getChatanzeige().setText(input.toString()); | |||||
} | |||||
} |
/* | |||||
* 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 logger; | |||||
import java.io.File; | |||||
import java.io.IOException; | |||||
import java.util.logging.ConsoleHandler; | |||||
import java.util.logging.FileHandler; | |||||
import java.util.logging.Level; | |||||
import java.util.logging.Logger; | |||||
import logger.myformatter.MyFormatter; | |||||
/** | |||||
* | |||||
* @author nobody | |||||
*/ | |||||
public class OhmLogger | |||||
{ | |||||
private static Logger lg = null; | |||||
public static Logger getLogger() | |||||
{ | |||||
if (lg == null) | |||||
{ | |||||
lg = Logger.getLogger("OhmLogger"); | |||||
initLogger(); | |||||
} | |||||
return lg; | |||||
} | |||||
private static void initLogger() | |||||
{ | |||||
try | |||||
{ | |||||
String datei = System.getProperty("java.io.tmpdir") + File.separator + "log.txt"; | |||||
FileHandler fh = new FileHandler(datei); | |||||
ConsoleHandler ch = new ConsoleHandler(); | |||||
lg.setUseParentHandlers(false); | |||||
lg.addHandler(fh); | |||||
ch.setFormatter(new MyFormatter()); | |||||
lg.addHandler(ch); | |||||
lg.setLevel(Level.ALL); | |||||
} | |||||
catch (IOException ioex) | |||||
{ | |||||
System.err.println(ioex); | |||||
} | |||||
} | |||||
public OhmLogger() | |||||
{ | |||||
} | |||||
} |
/* | |||||
* 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 logger.myformatter; | |||||
import java.util.Date; | |||||
import java.util.logging.LogRecord; | |||||
import java.util.logging.SimpleFormatter; | |||||
/** | |||||
* | |||||
* @author nobody | |||||
*/ | |||||
public class MyFormatter extends SimpleFormatter | |||||
{ | |||||
private String message; | |||||
private final Date dat = new Date(); | |||||
@Override | |||||
public String format(LogRecord record) | |||||
{ | |||||
dat.setTime(record.getMillis()); | |||||
message = "| " + dat + " | " + record.getLevel() + " | " | |||||
+ record.getSourceClassName() + " | " + record.getMessage() + " |\n"; | |||||
return message; | |||||
} | |||||
public MyFormatter() | |||||
{ | |||||
} | |||||
} |
/* | |||||
* 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 model; | |||||
import java.io.BufferedReader; | |||||
import java.io.IOException; | |||||
import java.io.InputStream; | |||||
import java.io.InputStreamReader; | |||||
import java.io.OutputStream; | |||||
import java.io.OutputStreamWriter; | |||||
import java.io.PrintWriter; | |||||
import java.net.ServerSocket; | |||||
import java.net.Socket; | |||||
import java.util.Observable; | |||||
import java.util.logging.Level; | |||||
import java.util.logging.Logger; | |||||
import logger.OhmLogger; | |||||
/** | |||||
* | |||||
* @author Apollo | |||||
*/ | |||||
public class Transmitter extends Observable implements Runnable | |||||
{ | |||||
private static final Logger lg = OhmLogger.getLogger(); | |||||
private static final int PORT = 35000; | |||||
private static final String IP_ADRESSE = "127.0.0.1"; | |||||
int modus; | |||||
public Transmitter(int modus) | |||||
{ | |||||
} | |||||
@Override | |||||
public void run() | |||||
{ | |||||
if(modus == 0) | |||||
{ | |||||
try | |||||
{ | |||||
server(); | |||||
} | |||||
catch (IOException ex) | |||||
{ | |||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex); | |||||
} | |||||
} | |||||
else if(modus == 1) | |||||
{ | |||||
try | |||||
{ | |||||
client(); | |||||
} | |||||
catch (IOException ex) | |||||
{ | |||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex); | |||||
} | |||||
} | |||||
} | |||||
public void client() throws IOException | |||||
{ | |||||
lg.info("Client: verbinde ..."); | |||||
Socket s = new Socket(IP_ADRESSE, PORT); // Achtung: blockiert! | |||||
lg.info("Client: Verbindung hergestellt"); | |||||
InputStream iStream = s.getInputStream(); | |||||
OutputStream oStream = s.getOutputStream(); | |||||
InputStreamReader isr = new InputStreamReader(iStream, "UTF-8"); | |||||
OutputStreamWriter osr = new OutputStreamWriter(oStream, "UTF-8"); | |||||
BufferedReader in = new BufferedReader(isr); | |||||
//BufferedWriter out = new BufferedWriter(osr); | |||||
PrintWriter out = new PrintWriter(osr); | |||||
lg.info("Client: Stream initialisiert"); | |||||
out.println("Hallo Du Server Du - ich bin der client"); | |||||
out.flush(); // wirklich absenden!! | |||||
lg.info("Client: Nachricht versendet"); | |||||
String quittung = in.readLine(); // Achtung blockiert | |||||
lg.info("Client: Quittung empfangen"); | |||||
System.out.println("Client: Quittung EMPFANGEN - " + quittung); | |||||
out.close(); | |||||
in.close(); | |||||
} | |||||
public void server() throws IOException | |||||
{ | |||||
ServerSocket sSocket = new ServerSocket(PORT); | |||||
lg.info("Server: Warte auf Verbindung ..."); | |||||
Socket s = sSocket.accept(); // Achtung: blockiert! | |||||
lg.info("Server: Verbindung akzeptiert"); | |||||
InputStream iStream = s.getInputStream(); | |||||
OutputStream oStream = s.getOutputStream(); | |||||
InputStreamReader isr = new InputStreamReader(iStream, "UTF-8"); | |||||
OutputStreamWriter osr = new OutputStreamWriter(oStream, "UTF-8"); | |||||
BufferedReader in = new BufferedReader(isr); | |||||
//BufferedWriter out = new BufferedWriter(osr); | |||||
PrintWriter out = new PrintWriter(osr); | |||||
lg.info("Server: Stream initialisiert"); | |||||
lg.info("Server: warte auf Nachricht ..."); | |||||
String nachricht = in.readLine(); // Achtung blockiert | |||||
lg.info("Server: Nachricht empfangen"); | |||||
System.out.println("Server: NACHRICHT EMPFANGEN - " + nachricht); | |||||
out.println("Server -> ich habe die Nachricht erhalten"); | |||||
lg.info("Server: Quittung versendet"); | |||||
out.flush(); // wirklich absenden!! | |||||
out.close(); | |||||
in.close(); | |||||
} | |||||
} |
/* | |||||
* 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 netz; | |||||
import java.io.BufferedReader; | |||||
import java.io.IOException; | |||||
import java.io.InputStream; | |||||
import java.io.InputStreamReader; | |||||
import java.io.OutputStream; | |||||
import java.io.OutputStreamWriter; | |||||
import java.io.PrintWriter; | |||||
import java.net.Socket; | |||||
import java.util.logging.Logger; | |||||
/** | |||||
* Builder Class | |||||
* @author le | |||||
*/ | |||||
public class Client | |||||
{ | |||||
private static final Logger lg = Logger.getLogger("netz"); | |||||
private static final int PORT = 35000; | |||||
private static final String IP_ADRESSE = "127.0.0.1"; | |||||
public Client() throws IOException | |||||
{ | |||||
lg.info("Client: verbinde ..."); | |||||
Socket s = new Socket(IP_ADRESSE, PORT); // Achtung: blockiert! | |||||
lg.info("Client: Verbindung hergestellt"); | |||||
InputStream iStream = s.getInputStream(); | |||||
OutputStream oStream = s.getOutputStream(); | |||||
InputStreamReader isr = new InputStreamReader(iStream, "UTF-8"); | |||||
OutputStreamWriter osr = new OutputStreamWriter(oStream, "UTF-8"); | |||||
BufferedReader in = new BufferedReader(isr); | |||||
//BufferedWriter out = new BufferedWriter(osr); | |||||
PrintWriter out = new PrintWriter(osr); | |||||
lg.info("Client: Stream initialisiert"); | |||||
out.println("Hallo Du Server Du - ich bin der client"); | |||||
out.flush(); // wirklich absenden!! | |||||
lg.info("Client: Nachricht versendet"); | |||||
String quittung = in.readLine(); // Achtung blockiert | |||||
lg.info("Client: Quittung empfangen"); | |||||
System.out.println("Client: Quittung EMPFANGEN - " + quittung); | |||||
out.close(); | |||||
in.close(); | |||||
} | |||||
/** | |||||
* @param args the command line arguments | |||||
*/ | |||||
public static void main(String[] args) | |||||
{ | |||||
try | |||||
{ | |||||
new Client(); | |||||
} | |||||
catch (IOException ex) | |||||
{ | |||||
lg.severe(ex.toString()); | |||||
} | |||||
} | |||||
} |
/* | |||||
* 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 netz; | |||||
import java.io.BufferedReader; | |||||
import java.io.IOException; | |||||
import java.io.InputStream; | |||||
import java.io.InputStreamReader; | |||||
import java.io.OutputStream; | |||||
import java.io.OutputStreamWriter; | |||||
import java.io.PrintWriter; | |||||
import java.net.ServerSocket; | |||||
import java.net.Socket; | |||||
import java.util.logging.Logger; | |||||
/** | |||||
* Builder Class | |||||
* @author le | |||||
*/ | |||||
public class Server | |||||
{ | |||||
private static final Logger lg = Logger.getLogger("netz"); | |||||
private static final int PORT = 35000; | |||||
public Server() throws IOException | |||||
{ | |||||
ServerSocket sSocket = new ServerSocket(PORT); | |||||
lg.info("Server: Warte auf Verbindung ..."); | |||||
Socket s = sSocket.accept(); // Achtung: blockiert! | |||||
lg.info("Server: Verbindung akzeptiert"); | |||||
InputStream iStream = s.getInputStream(); | |||||
OutputStream oStream = s.getOutputStream(); | |||||
InputStreamReader isr = new InputStreamReader(iStream, "UTF-8"); | |||||
OutputStreamWriter osr = new OutputStreamWriter(oStream, "UTF-8"); | |||||
BufferedReader in = new BufferedReader(isr); | |||||
//BufferedWriter out = new BufferedWriter(osr); | |||||
PrintWriter out = new PrintWriter(osr); | |||||
lg.info("Server: Stream initialisiert"); | |||||
lg.info("Server: warte auf Nachricht ..."); | |||||
String nachricht = in.readLine(); // Achtung blockiert | |||||
lg.info("Server: Nachricht empfangen"); | |||||
System.out.println("Server: NACHRICHT EMPFANGEN - " + nachricht); | |||||
out.println("Server -> ich habe die Nachricht erhalten"); | |||||
lg.info("Server: Quittung versendet"); | |||||
out.flush(); // wirklich absenden!! | |||||
out.close(); | |||||
in.close(); | |||||
} | |||||
/** | |||||
* @param args the command line arguments | |||||
*/ | |||||
public static void main(String[] args) | |||||
{ | |||||
try | |||||
{ | |||||
new Server(); | |||||
} | |||||
catch (IOException ex) | |||||
{ | |||||
lg.severe(ex.toString()); | |||||
} | |||||
} | |||||
} |
/* | |||||
* 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 netz; | |||||
import java.io.BufferedInputStream; | |||||
import java.io.BufferedOutputStream; | |||||
import java.io.File; | |||||
import java.io.FileOutputStream; | |||||
import java.io.IOException; | |||||
import java.io.InputStream; | |||||
import java.net.MalformedURLException; | |||||
import java.net.URL; | |||||
/** | |||||
* Builder Class | |||||
* @author le | |||||
*/ | |||||
public class Start | |||||
{ | |||||
public Start(String urlString, String dateiname) throws MalformedURLException, IOException | |||||
{ | |||||
URL oUrl = new URL(urlString + "/" + dateiname); | |||||
InputStream iStream = oUrl.openStream(); | |||||
BufferedInputStream in = new BufferedInputStream(iStream); | |||||
String tmpVerzeichnis = System.getProperty("java.io.tmpdir"); | |||||
String ausgabeDateiname = tmpVerzeichnis + File.separator + dateiname; | |||||
FileOutputStream fos = new FileOutputStream(ausgabeDateiname); | |||||
BufferedOutputStream out = new BufferedOutputStream(fos); | |||||
int wert = 0; | |||||
while ( (wert = in.read()) >= 0) | |||||
{ | |||||
out.write(wert); | |||||
} | |||||
in.close(); | |||||
out.close(); // flush! | |||||
System.out.println("Datei " + ausgabeDateiname + " erfolgreich erstellt"); | |||||
} | |||||
/** | |||||
* @param args the command line arguments | |||||
*/ | |||||
public static void main(String[] args) | |||||
{ | |||||
if (args.length == 2) | |||||
{ | |||||
System.err.println("2 Aufrufparameter nötig: URL-String Dateiname"); | |||||
} | |||||
else | |||||
{ | |||||
try | |||||
{ | |||||
new Start(args[0], args[1]); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
System.err.println(ex); | |||||
ex.printStackTrace(); | |||||
} | |||||
} | |||||
} | |||||
} |
<?xml version="1.0" encoding="UTF-8" ?> | |||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | |||||
<NonVisualComponents> | |||||
<Menu class="javax.swing.JMenuBar" name="jMenuBar1"> | |||||
<SubComponents> | |||||
<Menu class="javax.swing.JMenu" name="jMenu1"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="File"/> | |||||
</Properties> | |||||
</Menu> | |||||
<Menu class="javax.swing.JMenu" name="jMenu2"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Edit"/> | |||||
</Properties> | |||||
</Menu> | |||||
</SubComponents> | |||||
</Menu> | |||||
</NonVisualComponents> | |||||
<Properties> | |||||
<Property name="defaultCloseOperation" type="int" value="3"/> | |||||
</Properties> | |||||
<SyntheticProperties> | |||||
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/> | |||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/> | |||||
</SyntheticProperties> | |||||
<AuxValues> | |||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> | |||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> | |||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> | |||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> | |||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-84"/> | |||||
</AuxValues> | |||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |||||
<SubComponents> | |||||
<Container class="javax.swing.JPanel" name="jPanel1"> | |||||
<Constraints> | |||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |||||
<BorderConstraints direction="Center"/> | |||||
</Constraint> | |||||
</Constraints> | |||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |||||
<SubComponents> | |||||
<Container class="javax.swing.JScrollPane" name="jScrollPane3"> | |||||
<AuxValues> | |||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |||||
</AuxValues> | |||||
<Constraints> | |||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |||||
<BorderConstraints direction="Center"/> | |||||
</Constraint> | |||||
</Constraints> | |||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |||||
<SubComponents> | |||||
<Component class="javax.swing.JTextArea" name="chatanzeige"> | |||||
<Properties> | |||||
<Property name="editable" type="boolean" value="false"/> | |||||
<Property name="columns" type="int" value="20"/> | |||||
<Property name="rows" type="int" value="5"/> | |||||
</Properties> | |||||
</Component> | |||||
</SubComponents> | |||||
</Container> | |||||
<Component class="javax.swing.JTextField" name="inputField"> | |||||
<Constraints> | |||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |||||
<BorderConstraints direction="Last"/> | |||||
</Constraint> | |||||
</Constraints> | |||||
</Component> | |||||
</SubComponents> | |||||
</Container> | |||||
</SubComponents> | |||||
</Form> |
/* | |||||
* 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 view; | |||||
/** | |||||
* | |||||
* @author Apollo | |||||
*/ | |||||
public class ChatView extends javax.swing.JFrame | |||||
{ | |||||
/** | |||||
* @param chatanzeige the chatanzeige to set | |||||
*/ | |||||
public void setChatanzeige(javax.swing.JTextArea chatanzeige) | |||||
{ | |||||
this.chatanzeige = chatanzeige; | |||||
} | |||||
/** | |||||
* @return the chatanzeige | |||||
*/ | |||||
public javax.swing.JTextArea getChatanzeige() | |||||
{ | |||||
return chatanzeige; | |||||
} | |||||
/** | |||||
* @return the inputField | |||||
*/ | |||||
public javax.swing.JTextField getInputField() | |||||
{ | |||||
return inputField; | |||||
} | |||||
/** | |||||
* Creates new form clientview | |||||
*/ | |||||
public ChatView() | |||||
{ | |||||
initComponents(); | |||||
} | |||||
/** | |||||
* This method is called from within the constructor to initialize the form. | |||||
* WARNING: Do NOT modify this code. The content of this method is always | |||||
* regenerated by the Form Editor. | |||||
*/ | |||||
@SuppressWarnings("unchecked") | |||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |||||
private void initComponents() | |||||
{ | |||||
jPanel1 = new javax.swing.JPanel(); | |||||
jScrollPane3 = new javax.swing.JScrollPane(); | |||||
chatanzeige = new javax.swing.JTextArea(); | |||||
inputField = new javax.swing.JTextField(); | |||||
jMenuBar1 = new javax.swing.JMenuBar(); | |||||
jMenu1 = new javax.swing.JMenu(); | |||||
jMenu2 = new javax.swing.JMenu(); | |||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |||||
jPanel1.setLayout(new java.awt.BorderLayout()); | |||||
chatanzeige.setEditable(false); | |||||
chatanzeige.setColumns(20); | |||||
chatanzeige.setRows(5); | |||||
jScrollPane3.setViewportView(chatanzeige); | |||||
jPanel1.add(jScrollPane3, java.awt.BorderLayout.CENTER); | |||||
jPanel1.add(inputField, java.awt.BorderLayout.PAGE_END); | |||||
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); | |||||
jMenu1.setText("File"); | |||||
jMenuBar1.add(jMenu1); | |||||
jMenu2.setText("Edit"); | |||||
jMenuBar1.add(jMenu2); | |||||
setJMenuBar(jMenuBar1); | |||||
pack(); | |||||
}// </editor-fold>//GEN-END:initComponents | |||||
/** | |||||
* @param args the command line arguments | |||||
*/ | |||||
public static void main(String args[]) | |||||
{ | |||||
/* Set the Nimbus look and feel */ | |||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> | |||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. | |||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html | |||||
*/ | |||||
try | |||||
{ | |||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) | |||||
{ | |||||
if ("Nimbus".equals(info.getName())) | |||||
{ | |||||
javax.swing.UIManager.setLookAndFeel(info.getClassName()); | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
catch (ClassNotFoundException ex) | |||||
{ | |||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} | |||||
catch (InstantiationException ex) | |||||
{ | |||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} | |||||
catch (IllegalAccessException ex) | |||||
{ | |||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} | |||||
catch (javax.swing.UnsupportedLookAndFeelException ex) | |||||
{ | |||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} | |||||
//</editor-fold> | |||||
//</editor-fold> | |||||
//</editor-fold> | |||||
//</editor-fold> | |||||
/* Create and display the form */ | |||||
java.awt.EventQueue.invokeLater(new Runnable() | |||||
{ | |||||
public void run() | |||||
{ | |||||
new ChatView().setVisible(true); | |||||
} | |||||
}); | |||||
} | |||||
// Variables declaration - do not modify//GEN-BEGIN:variables | |||||
private javax.swing.JTextArea chatanzeige; | |||||
private javax.swing.JTextField inputField; | |||||
private javax.swing.JMenu jMenu1; | |||||
private javax.swing.JMenu jMenu2; | |||||
private javax.swing.JMenuBar jMenuBar1; | |||||
private javax.swing.JPanel jPanel1; | |||||
private javax.swing.JScrollPane jScrollPane3; | |||||
// End of variables declaration//GEN-END:variables | |||||
} |