summaryrefslogtreecommitdiff
path: root/src/javaChat/UserInterface.java
diff options
context:
space:
mode:
authorO'Shea <osheas1@wit.edu>2020-12-10 14:03:54 -0500
committerO'Shea <osheas1@wit.edu>2020-12-10 14:03:54 -0500
commitcca61c9f562d2c9e2be13ec16abe134d209b54e3 (patch)
tree3f957b579c45d0536e7e1740acdb0cdbc773f9f4 /src/javaChat/UserInterface.java
parent690bbba9550e2644e48db44fb94d4df86494a34e (diff)
Final implementation, ready for presentation!
Diffstat (limited to 'src/javaChat/UserInterface.java')
-rw-r--r--src/javaChat/UserInterface.java288
1 files changed, 0 insertions, 288 deletions
diff --git a/src/javaChat/UserInterface.java b/src/javaChat/UserInterface.java
deleted file mode 100644
index 1d8f906..0000000
--- a/src/javaChat/UserInterface.java
+++ /dev/null
@@ -1,288 +0,0 @@
-package javaChat;
-
-import java.awt.* ;
-import java.util.* ;
-import javax.swing.* ;
-
-public class UserInterface extends javax.swing.JFrame {
-
-
- String ip ;
- String username ;
- boolean done ;
-
-/**
- * Creates new form loginFrame
- */
-public UserInterface() {
- 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">
-private void initComponents()
- {
-
- jTextField1 = new javax.swing.JTextField();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jTextField2 = new javax.swing.JTextField();
- jButton1 = new javax.swing.JButton();
- jSlider1 = new javax.swing.JSlider();
- jSlider2 = new javax.swing.JSlider();
- jSlider3 = new javax.swing.JSlider();
- jSlider4 = new javax.swing.JSlider();
-
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- setTitle("Java Chat");
- setAlwaysOnTop(true);
- setBackground(new java.awt.Color(255, 255, 255));
- setForeground(java.awt.Color.white);
- setResizable(false);
-
- jTextField1.setEditable(false);
- jTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
- jTextField1.setText("0.0.0.0");
-
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel1.setText("Enter Server's I.P. Address:");
-
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setText("Enter your desired username:");
-
- jTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
- jTextField2.setActionCommand("<Not Set>");
-
- jButton1.setText("Connect");
- jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
- jButton1.setOpaque(false);
- jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- jButton1MouseClicked(evt);
- }
- });
-
- jSlider1.setMaximum(999);
- jSlider1.setOrientation(javax.swing.JSlider.VERTICAL);
- jSlider1.setValue(0);
- jSlider1.addChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent evt) {
- jSlider1StateChanged(evt);
- }
- });
-
- jSlider2.setMaximum(999);
- jSlider2.setOrientation(javax.swing.JSlider.VERTICAL);
- jSlider2.setValue(0);
- jSlider2.addChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent evt) {
- jSlider2StateChanged(evt);
- }
- });
-
- jSlider3.setMaximum(999);
- jSlider3.setOrientation(javax.swing.JSlider.VERTICAL);
- jSlider3.setValue(0);
- jSlider3.addChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent evt) {
- jSlider3StateChanged(evt);
- }
- });
-
- jSlider4.setMaximum(999);
- jSlider4.setOrientation(javax.swing.JSlider.VERTICAL);
- jSlider4.setValue(0);
- jSlider4.addChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent evt) {
- jSlider4StateChanged(evt);
- }
- });
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(60, 60, 60)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE))))
- .addGroup(layout.createSequentialGroup()
- .addGap(162, 162, 162)
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE)
- .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jSlider2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jSlider3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jSlider4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(56, 56, 56))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(24, 24, 24)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(jSlider3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
- .addComponent(jSlider2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
- .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(jSlider4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(40, Short.MAX_VALUE))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel1))
- .addGap(36, 36, 36)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel2))
- .addGap(28, 28, 28)
- .addComponent(jButton1)
- .addGap(30, 30, 30))))
- );
-
- pack();
- }// </editor-fold>
-
-private void jButton1MouseClicked(java.awt.event.MouseEvent evt)
- {
- ip = jTextField1.getText() ;
- username = jTextField2.getText() ;
- //System.out.printf( "IP: %s \nUsername: %s\n", ip, username ) ;
-
-
- done = true ;
- setVisible( false ) ;
- dispose() ;
-
- }
-
-private void jSlider1StateChanged(javax.swing.event.ChangeEvent evt)
- {
- Integer a = jSlider1.getValue() ;
- Integer b = jSlider2.getValue() ;
- Integer c = jSlider3.getValue() ;
- Integer d = jSlider4.getValue() ;
-
- String ip = String.format("%s.%s.%s.%s", a, b, c, d) ;
-
- jTextField1.setText( ip.toString() ) ;
- }
-
-private void jSlider2StateChanged(javax.swing.event.ChangeEvent evt)
- {
- Integer a = jSlider1.getValue() ;
- Integer b = jSlider2.getValue() ;
- Integer c = jSlider3.getValue() ;
- Integer d = jSlider4.getValue() ;
-
- String ip = String.format("%s.%s.%s.%s", a, b, c, d) ;
-
- jTextField1.setText( ip.toString() ) ;
- }
-
-private void jSlider3StateChanged(javax.swing.event.ChangeEvent evt)
- {
- Integer a = jSlider1.getValue() ;
- Integer b = jSlider2.getValue() ;
- Integer c = jSlider3.getValue() ;
- Integer d = jSlider4.getValue() ;
-
- String ip = String.format("%s.%s.%s.%s", a, b, c, d) ;
-
- jTextField1.setText( ip.toString() ) ;
- }
-
-private void jSlider4StateChanged(javax.swing.event.ChangeEvent evt)
- {
- Integer a = jSlider1.getValue() ;
- Integer b = jSlider2.getValue() ;
- Integer c = jSlider3.getValue() ;
- Integer d = jSlider4.getValue() ;
-
- String ip = String.format("%s.%s.%s.%s", a, b, c, d) ;
-
- jTextField1.setText( ip.toString() ) ;
- }
-
-/**
- * @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(UserInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(UserInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(UserInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(UserInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
-
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new UserInterface().setVisible(true);
- }
- });
-}
-
-
-public String getIP()
- {
- return ip ;
- }
-
-public String getUsername()
- {
- return username ;
- }
-
-public boolean isDone()
- {
- return done ;
- }
-
-// Variables declaration - do not modify
-private javax.swing.JButton jButton1;
-private javax.swing.JLabel jLabel1;
-private javax.swing.JLabel jLabel2;
-private javax.swing.JSlider jSlider1;
-private javax.swing.JSlider jSlider2;
-private javax.swing.JSlider jSlider3;
-private javax.swing.JSlider jSlider4;
-private javax.swing.JTextField jTextField1;
-private javax.swing.JTextField jTextField2;
-// End of variables declaration
-}