/*
* Gui.java
*
* Created on 2. Oktober 2007, 10:22
*/
package chat;
import javax.swing.JOptionPane;
/**
*
* @author lgwerm
*/
public class Gui extends javax.swing.JFrame {
/** Creates new form Gui */
public Gui() {
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.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
messageText = new javax.swing.JTextArea();
sendedText = new javax.swing.JTextField();
buttonSend = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
menu_file = new javax.swing.JMenu();
menuItem_connect = new javax.swing.JMenuItem();
menuItem_createServer = new javax.swing.JMenuItem();
menuItem_close = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
messageText.setColumns(20);
messageText.setRows(5);
jScrollPane1.setViewportView(messageText);
buttonSend.setText("jButton1");
menuBar.setName("mnubar");
menu_file.setText("file");
menu_file.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menu_fileActionPerformed(evt);
}
});
menuItem_connect.setText("Connect");
menu_file.add(menuItem_connect);
menuItem_createServer.setText("Create Server");
menuItem_createServer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuItem_createServerActionPerformed(evt);
}
});
menu_file.add(menuItem_createServer);
menuItem_close.setText("Close");
menu_file.add(menuItem_close);
menuBar.add(menu_file);
setJMenuBar(menuBar);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(sendedText, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonSend))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(sendedText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonSend))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void menuItem_createServerActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane pane = new JOptionPane();
String name = pane.showInputDialog("Servername");
}
private void menu_fileActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Gui().setVisible(true);
}
});
}
public void startServer()
{
Server server = new Server(this.messageText);
server.start();
}
// Variables declaration - do not modify
private javax.swing.JButton buttonSend;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JMenuBar menuBar;
private javax.swing.JMenuItem menuItem_close;
private javax.swing.JMenuItem menuItem_connect;
private javax.swing.JMenuItem menuItem_createServer;
private javax.swing.JMenu menu_file;
public javax.swing.JTextArea messageText;
private javax.swing.JTextField sendedText;
// End of variables declaration
}