www.webdeveloper.com
Results 1 to 6 of 6

Thread: Creating a phone program via Netbeans

Hybrid View

  1. #1
    Join Date
    Feb 2014
    Posts
    14

    Creating a phone program via Netbeans

    alright, the reason I put this in PHP is because I typed in "netbeans" in the search bar and PHP popped up the most times
    ---

    for the past couple of hours or so I have been trying to create a semi-simple and intuitive phone program that:

    1. is able to input a number via textbox or keypad
    2. is able to "play call" that number by putting the phone in a "call state"
    3. is able to "play hang up" that number via a "not in call state"
    4. is able to save a number in the textbox and recall/delete that number
    5. is able to "play send" a message with the ability to stop that message "in transit" (see the little progress bar on the bottom)
    6. is password protected.

    http://i60.tinypic.com/1zd7z9x.jpg

    I was able to do step 1, but for the life of me I don't know how to do the rest. If I can find out how to do step 4 I can find a way to use either a popup or a colored button that flashes red or green between the two states.

    step 5 seems to be focused around the progress bar.

    step 6 should be step 1 but I may be wrong, and I kind of need help on that one too.

    I'll have to split the code up into parts because it is long but thanks in advance.


    Code:
    package appPackage;
    
    import javax.script.ScriptEngine;
    import javax.script.ScriptEngineManager;
    import javax.script.ScriptException;
    
    /**
     *
     * @author Nelson
     */
    public class PhoneGUI extends javax.swing.JFrame {
    
        /**
         * Creates new form PhoneGUI
         */
        public PhoneGUI() {
            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() {
    
            jTextField2 = new javax.swing.JTextField();
            phoneNumberDisplay = new javax.swing.JTextField();
            keyPad1 = new javax.swing.JButton();
            keyPad2 = new javax.swing.JButton();
            keyPad3 = new javax.swing.JButton();
            keyPad4 = new javax.swing.JButton();
            keyPad5 = new javax.swing.JButton();
            keyPad6 = new javax.swing.JButton();
            keyPad7 = new javax.swing.JButton();
            keyPad8 = new javax.swing.JButton();
            keyPad9 = new javax.swing.JButton();
            keyPad0 = new javax.swing.JButton();
            keyPadAst = new javax.swing.JButton();
            keyPadPou = new javax.swing.JButton();
            progClose = new javax.swing.JButton();
            buttDial = new javax.swing.JButton();
            buttReDial = new javax.swing.JButton();
            buttStop = new javax.swing.JButton();
            buttSave = new javax.swing.JButton();
            buttDelete = new javax.swing.JButton();
            jScrollPane1 = new javax.swing.JScrollPane();
            jList1 = new javax.swing.JList();
            checkConfirm = new javax.swing.JCheckBox();
            passField = new javax.swing.JPasswordField();
            passConfirm = new javax.swing.JButton();
            warnLabel = new javax.swing.JLabel();
            jToggleButton1 = new javax.swing.JToggleButton();
            messageDisplay = new javax.swing.JTextField();
            sendBar = new javax.swing.JProgressBar();
            phoneLabel = new javax.swing.JLabel();

  2. #2
    Join Date
    Feb 2014
    Posts
    14
    Code:
     jTextField2.setText("jTextField2");
    
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("SLDF KST \"BB-K-0\"");
            setBackground(new java.awt.Color(0, 0, 153));
    
            phoneNumberDisplay.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
            phoneNumberDisplay.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            phoneNumberDisplay.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    phoneNumberDisplayActionPerformed(evt);
                }
            });
    
            keyPad1.setBackground(new java.awt.Color(153, 255, 255));
            keyPad1.setText("1");
            keyPad1.setMaximumSize(new java.awt.Dimension(45, 23));
            keyPad1.setMinimumSize(new java.awt.Dimension(45, 23));
            keyPad1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
                public void mouseMoved(java.awt.event.MouseEvent evt) {
                    keyPad1MouseMoved(evt);
                }
            });
            keyPad1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad1ActionPerformed(evt);
                }
            });
    
            keyPad2.setBackground(new java.awt.Color(153, 255, 255));
            keyPad2.setText("2");
            keyPad2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad2ActionPerformed(evt);
                }
            });
    
            keyPad3.setBackground(new java.awt.Color(153, 255, 255));
            keyPad3.setText("3");
            keyPad3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad3ActionPerformed(evt);
                }
            });
    
            keyPad4.setBackground(new java.awt.Color(153, 255, 255));
            keyPad4.setText("4");
            keyPad4.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad4ActionPerformed(evt);
                }
            });
    
            keyPad5.setBackground(new java.awt.Color(153, 255, 255));
            keyPad5.setText("5");
            keyPad5.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad5ActionPerformed(evt);
                }
            });
    
            keyPad6.setBackground(new java.awt.Color(153, 255, 255));
            keyPad6.setText("6");
            keyPad6.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad6ActionPerformed(evt);
                }
            });
    
            keyPad7.setBackground(new java.awt.Color(153, 255, 255));
            keyPad7.setText("7");
            keyPad7.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad7ActionPerformed(evt);
                }
            });
    
            keyPad8.setBackground(new java.awt.Color(153, 255, 255));
            keyPad8.setText("8");
            keyPad8.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad8ActionPerformed(evt);
                }
            });
    
            keyPad9.setBackground(new java.awt.Color(153, 255, 255));
            keyPad9.setText("9");
            keyPad9.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad9ActionPerformed(evt);
                }
            });
    
            keyPad0.setBackground(new java.awt.Color(153, 255, 255));
            keyPad0.setText("0");
            keyPad0.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseReleased(java.awt.event.MouseEvent evt) {
                    keyPad0MouseReleased(evt);
                }
            });
            keyPad0.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPad0ActionPerformed(evt);
                }
            });
    
            keyPadAst.setBackground(new java.awt.Color(153, 255, 255));
            keyPadAst.setText("*");
            keyPadAst.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPadAstActionPerformed(evt);
                }
            });
    
            keyPadPou.setBackground(new java.awt.Color(153, 255, 255));
            keyPadPou.setText("#");
            keyPadPou.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keyPadPouActionPerformed(evt);
                }
            });

  3. #3
    Join Date
    Feb 2014
    Posts
    14
    [CODE] progClose.setText("x");
    progClose.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    progClose.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseReleased(java.awt.event.MouseEvent evt) {
    progCloseMouseReleased(evt);
    }
    });
    progClose.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    progCloseActionPerformed(evt);
    }
    });

    buttDial.setText("Dial");
    buttDial.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    buttDialActionPerformed(evt);
    }
    });

    buttReDial.setText("ReDial");

    buttStop.setText("Stop");
    buttStop.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    buttStopActionPerformed(evt);
    }
    });

    buttSave.setText("Save");
    buttSave.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    buttSaveActionPerformed(evt);
    }
    });

    buttDelete.setText("Delete");
    buttDelete.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    buttDeleteActionPerformed(evt);
    }
    });

    jList1.setFont(new java.awt.Font("Tahoma", 0, 8)); // NOI18N
    jScrollPane1.setViewportView(jList1);

    checkConfirm.setText("Message confirmation");

    passField.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    passFieldActionPerformed(evt);
    }
    });

    passConfirm.setText("OK");

    warnLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
    warnLabel.setText("Never Share Your Password With Anyone");

    jToggleButton1.setText("Send");

    messageDisplay.setText("Enter Message Here");
    messageDisplay.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    messageDisplayActionPerformed(evt);
    }
    });

    phoneLabel.setText("Enter Phone Number");

    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)
    .addComponent(phoneLabel)
    .addGroup(layout.createSequentialGroup()
    .addComponent(buttDial, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(buttReDial))
    .addGroup(layout.createSequentialGroup()
    .addComponent(keyPad4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(keyPad5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(keyPad6, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addComponent(phoneNumberDisplay, javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
    .addComponent(keyPad1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(keyPad2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(keyPad3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(buttStop)))
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(buttSave, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(buttDelete, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
    .addComponent(keyPadAst, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(keyPad0, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(keyPadPou, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
    .addComponent(keyPad7, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(keyPad8, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(keyPad9, javax.swing.GroupLayout.PREFERRED_SIZE, 50,

    [CODE]

  4. #4
    Join Date
    Feb 2014
    Posts
    14
    Code:
    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(4, 4, 4)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(passField, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(2, 2, 2)
                                    .addComponent(passConfirm, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(progClose))
                                .addComponent(warnLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(messageDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(checkConfirm, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jToggleButton1))
                        .addComponent(sendBar, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(13, 13, 13)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(phoneLabel)
                        .addComponent(warnLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(phoneNumberDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(buttStop))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(keyPad1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(keyPad2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(keyPad3))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(keyPad5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(keyPad6))
                                .addComponent(keyPad4, javax.swing.GroupLayout.Alignment.LEADING))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(keyPad9)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(keyPad7)
                                    .addComponent(keyPad8)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(keyPadAst)
                                .addComponent(keyPad0, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(keyPadPou))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(buttDial)
                                .addComponent(buttReDial))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(buttSave)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(buttDelete))
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(passField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(passConfirm)
                                .addComponent(progClose))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(messageDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jToggleButton1)
                                .addComponent(checkConfirm))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(sendBar, javax.swing.GroupLayout.PREFERRED_SIZE, 8, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );

  5. #5
    Join Date
    Feb 2014
    Posts
    14
    Code:
    setSize(new java.awt.Dimension(435, 306));
            setLocationRelativeTo(null);
        }// </editor-fold>                        
    
        private void phoneNumberDisplayActionPerformed(java.awt.event.ActionEvent evt) {                                                   
            // TODO add your handling code here:
        }                                                  
    
        private void keyPad1MouseMoved(java.awt.event.MouseEvent evt) {                                   
           
        }                                  
    
        private void buttStopActionPerformed(java.awt.event.ActionEvent evt) {                                         
        phoneNumberDisplay.setText("");       // TODO add your handling code here:
        }                                        
    
        private void progCloseMouseReleased(java.awt.event.MouseEvent evt) {                                        
       System.exit(0);
        }                                       
    
        private void buttSaveActionPerformed(java.awt.event.ActionEvent evt) {                                         
            // TODO add your handling code here:
        }                                        
    
        private void passFieldActionPerformed(java.awt.event.ActionEvent evt) {                                          
            // TODO add your handling code here:
        }                                         
    
        private void messageDisplayActionPerformed(java.awt.event.ActionEvent evt) {                                               
            // TODO add your handling code here:
        }                                              
    
        private void buttDeleteActionPerformed(java.awt.event.ActionEvent evt) {                                           
            // TODO add your handling code here:
        }                                          
    
        private void keyPad0ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "0";
            phoneNumberDisplay.setText(PreVal);
        }                                       
    
        private void keyPad0MouseReleased(java.awt.event.MouseEvent evt) {                                      
        }                                     
    
        private void keyPad1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
          String PreVal = phoneNumberDisplay.getText() + "1";
            phoneNumberDisplay.setText(PreVal);  
        }                                       
    
        private void keyPad2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "2";
            phoneNumberDisplay.setText(PreVal);
        }                                       
    
        private void keyPad3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "3";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                       
    
        private void keyPad4ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "4";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                       
    
        private void keyPad5ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "5";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                       
    
        private void keyPad6ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "6";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                       
    
        private void keyPad7ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "7";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                       
    
        private void keyPad8ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "8";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                       
    
        private void keyPad9ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            String PreVal = phoneNumberDisplay.getText() + "9";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                       
    
        private void buttDialActionPerformed(java.awt.event.ActionEvent evt) {                                         
           ScriptEngineManager SEM = new ScriptEngineManager();
           ScriptEngine SE = SEM.getEngineByName("JavaScript");
           
           try
           {
               phoneNumberDisplay.setText(SE.eval(phoneNumberDisplay.getText()).toString()); 
           }
           catch(ScriptException e)
           {
               System.out.println("Error:" + e);    
           }
        }                                        
    
        private void keyPadAstActionPerformed(java.awt.event.ActionEvent evt) {                                          
    String PreVal = phoneNumberDisplay.getText() + "*";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                         
    
        private void keyPadPouActionPerformed(java.awt.event.ActionEvent evt) {                                          
    String PreVal = phoneNumberDisplay.getText() + "#";
            phoneNumberDisplay.setText(PreVal);        // TODO add your handling code here:
        }                                         
    
        private void progCloseActionPerformed(java.awt.event.ActionEvent evt) {                                          
            // TODO add your handling code here:
        }                                         
    
        /**
         * @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 ("Windows".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(PhoneGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(PhoneGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(PhoneGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(PhoneGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new PhoneGUI().setVisible(true);
                }
            });
        }

  6. #6
    Join Date
    Feb 2014
    Posts
    14
    Code:
        // Variables declaration - do not modify                     
        private javax.swing.JButton buttDelete;
        private javax.swing.JButton buttDial;
        private javax.swing.JButton buttReDial;
        private javax.swing.JButton buttSave;
        private javax.swing.JButton buttStop;
        private javax.swing.JCheckBox checkConfirm;
        private javax.swing.JList jList1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextField jTextField2;
        private javax.swing.JToggleButton jToggleButton1;
        private javax.swing.JButton keyPad0;
        private javax.swing.JButton keyPad1;
        private javax.swing.JButton keyPad2;
        private javax.swing.JButton keyPad3;
        private javax.swing.JButton keyPad4;
        private javax.swing.JButton keyPad5;
        private javax.swing.JButton keyPad6;
        private javax.swing.JButton keyPad7;
        private javax.swing.JButton keyPad8;
        private javax.swing.JButton keyPad9;
        private javax.swing.JButton keyPadAst;
        private javax.swing.JButton keyPadPou;
        private javax.swing.JTextField messageDisplay;
        private javax.swing.JButton passConfirm;
        private javax.swing.JPasswordField passField;
        private javax.swing.JLabel phoneLabel;
        private javax.swing.JTextField phoneNumberDisplay;
        private javax.swing.JButton progClose;
        private javax.swing.JProgressBar sendBar;
        private javax.swing.JLabel warnLabel;
        // End of variables declaration
    Sorry for the length

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles