Help!JOptionPane

Hello,
I'm currenntly facing some problems with my application.
I have developed a passwordframe for an application and what i like to do is after the user keys in 3 trys of the password the frame would actaully dispose.
But currently i'm having a probelm displaying the error message.
I relly hope that you guys can help me cause my project is due really soon!
my codes for the above as as below.
     b1.addActionListener (
     new ActionListener() {
          public void actionPerformed(ActionEvent e)
          String str1 = new String(tf1.getText());
               String str2 = new String(password.getText());
               do
               if (str1.equals("staff") && str2.equals("abc123"))               
          theFrame something = new theFrame();
               something.show();
               else{
               JOptionPane.showMessageDialog(
               null,"Wrong PASSWORD! You only have 3 tries",
               JOptionPane.ERROR_MESSAGE);
               while (tries <= 3);
i have an error and a warning the error is wrong number of arguments in a method related to the JOptionPane and the warning is password frame overrides a depreaciated API. I really hope that u guys can help me with this erroe
Thanks!
-palv-

Hello,
Thanks for your help thus far you help is GREATLY appreaciated but i'm having warning msg for example
PasswordFrame.java uses or overrites the depreacated API. I'm having a probelm where by after the Password screen when i go to the next screen the itemlistener does not work..
has that msg go to do anything with the item listener because when i complie it as a frame alone without going through the passwordframe it works....
Once again
thanks
pal

Similar Messages

  • HELP --JOPtionPane.showInputDialog

    I was developing a employee information system in swing.
    On the way of development,the major problem the is occuring
    is that two JOPtionPane.showInput Dialog boxes are appearing
    at a time.When I fetching the data to the JOPtionPane.showInput Dialog box and then clicking the "ok" option button,another JOPtionPane.showInput Dialog box appears making the program difficult to
    bug.
    Please suggest ways to solve this bug.

    It is more likely that your program has logical errors, just search for all JOptionPane.showInputDialog(...) statements and insert a println statement before it to trace the source of the problem.
    Visual Paradigm - http://visual-paradigm.com/

  • I am really sorry but I am still stuck. Please help.

    Please can someone help me with the following code. I have a number of questions. So far all buttons that I have coded actions for work fine. When The program saves it does it correctly as I have seen the text file. However I have some problems.
    1) How can I declare the arrays in another way without setting them to "" when the program starts. I need the program to start and show the previous saved arrays instead. I dont know if my method used for retrieving data from the file is correct either?.
    2) When retrieving the values from a file that has example (all are string values). ADAM SANDLER 111 222 333 MICKY MOUSE 222 444 666
    Where I want them to be in the follwing arrays as an example.
    String name[1] = ADAM
    String surname[1] = SANDLER
    String home[1] = 111
    String work[1] = 222
    String cell[1] = 333
    String name[2] = MICKY
    String surname[2] = MOUSE
    String home[2] = 222
    String work[2] = 444
    String cell[2] = 666
    Here is my code.
         Filename:     ContactsListInterface.java
         Date:           16 March 2008
         Programmer:     Yucca Nel
         Purpose:     Provides a GUI for entering names and contact numbers into a telephone directory.
                        Also allows options for searching for a specific name and deleting of data from the record
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    public class ContactsListInterface extends JFrame implements ActionListener
    { //start of class
         // Declare outputstream and inputStream
         DataOutputStream output;
         DataInputStream input;
         String filename = "phonebook";
         // construct fields, buttons, labels and text boxes
         JTextPane displayPane = new JTextPane();
         JLabel listOfContacts = new JLabel("List Of Contacts");               // creates a label for the scrollpane
         JButton createButton = new JButton("Create");
         JButton searchButton = new JButton("Search");
         JButton modifyButton = new JButton("Modify");
         JButton deleteButton = new JButton("Delete");
         // declare data arrays for name, surname, work number, home number and cell number
         private String name[] = {""};
         private String surname[] = {""};
         private String home[] = {""};
         private String work[] = {""};
         private String cell[] = {""};
         // create an instance of the ContactsListInterface
         public ContactsListInterface()
         { // start of cli()
              super("Phonebook Interface");
         } // end of cli()
         public JMenuBar createMenuBar()
         { // start of the createMenuBar()
              // construct and populate a menu bar
              JMenuBar mnuBar = new JMenuBar();                    // creates a menu bar
              setJMenuBar(mnuBar);
              JMenu mnuFile = new JMenu("File",true);               // creates a file menu in the menu bar which is visible
                   mnuFile.setMnemonic(KeyEvent.VK_F);
                   mnuFile.setDisplayedMnemonicIndex(0);
                   mnuFile.setToolTipText("File Options");
                   mnuBar.add(mnuFile);
              JMenuItem mnuFileExit = new JMenuItem("Exit");     // creates an exit option in the file menu
                   mnuFileExit.setMnemonic(KeyEvent.VK_X);
                   mnuFileExit.setDisplayedMnemonicIndex(1);
                   mnuFileExit.setToolTipText("Close Application");
                   mnuFile.add(mnuFileExit);
                   mnuFileExit.setActionCommand("Exit");
                   mnuFileExit.addActionListener(this);
              JMenu mnuEdit = new JMenu("Edit",true);               // creates a menu for editing options
                   mnuEdit.setMnemonic(KeyEvent.VK_E);
                   mnuEdit.setDisplayedMnemonicIndex(0);
                   mnuEdit.setToolTipText("Edit Options");
                   mnuBar.add(mnuEdit);
              JMenu mnuEditSort = new JMenu("Sort",true);          // creates an option for sorting entries
                   mnuEditSort.setMnemonic(KeyEvent.VK_S);
                   mnuEditSort.setDisplayedMnemonicIndex(0);
                   mnuEdit.add(mnuEditSort);
              JMenuItem mnuEditSortByName = new JMenuItem("Sort By Name");          // to sort entries by name
                   mnuEditSortByName.setMnemonic(KeyEvent.VK_N);
                   mnuEditSortByName.setDisplayedMnemonicIndex(8);
                   mnuEditSortByName.setToolTipText("Sort entries by first name");
                   mnuEditSortByName.setActionCommand("Name");
                   mnuEditSortByName.addActionListener(this);
                   mnuEditSort.add(mnuEditSortByName);
              JMenuItem mnuEditSortBySurname = new JMenuItem("Sort By Surname");     // to sort entries by surname
                   mnuEditSortBySurname.setMnemonic(KeyEvent.VK_R);
                   mnuEditSortBySurname.setDisplayedMnemonicIndex(10);
                   mnuEditSortBySurname.setToolTipText("Sort entries by surname");
                   mnuEditSortBySurname.setActionCommand("Surname");
                   mnuEditSortBySurname.addActionListener(this);
                   mnuEditSort.add(mnuEditSortBySurname);
              JMenu mnuHelp = new JMenu("Help",true);                    // creates a menu for help options
                   mnuHelp.setMnemonic(KeyEvent.VK_H);
                   mnuHelp.setDisplayedMnemonicIndex(0);
                   mnuHelp.setToolTipText("Help options");
                   mnuBar.add(mnuHelp);
              JMenuItem mnuHelpHelp = new JMenuItem("Help");          // creates a help option for help topic
                   mnuHelpHelp.setMnemonic(KeyEvent.VK_P);
                   mnuHelpHelp.setDisplayedMnemonicIndex(3);
                   mnuHelpHelp.setToolTipText("Help Topic");
                   mnuHelpHelp.setActionCommand("Help");
                   mnuHelpHelp.addActionListener(this);
                   mnuHelp.add(mnuHelpHelp);
              JMenuItem mnuHelpAbout = new JMenuItem("About");     // creates a about option for info about api
                   mnuHelpAbout.setMnemonic(KeyEvent.VK_T);
                   mnuHelpAbout.setDisplayedMnemonicIndex(4);
                   mnuHelpAbout.setToolTipText("About this program");
                   mnuHelpAbout.setActionCommand("About");
                   mnuHelpAbout.addActionListener(this);
                   mnuHelp.add(mnuHelpAbout);
              return mnuBar;
         } // end of the createMenuBar()
         // create the content pane
         public Container createContentPane()
         { // start of createContentPane()
              // try blocks for the input and output
              try
                   output = new DataOutputStream(new FileOutputStream(filename));
              catch(IOException io)
                   JOptionPane.showMessageDialog(null,"This program could not create a storage location. Please check the disk drive and the tun the program again.","Error",JOptionPane.ERROR_MESSAGE);
                   System.exit(1);
              //construct and populate panels and content pane
              JPanel labelPanel = new JPanel(); // panel is only used to put the label for the textpane in
                   labelPanel.setLayout(new FlowLayout());
                   labelPanel.add(listOfContacts);
              JPanel displayPanel = new JPanel();// panel is used to display all the contacts and thier numbers
                   setTabsAndStyles(displayPane);
                   displayPane = addTextToTextPane();
                   displayPane.setEditable(false);
              JScrollPane scrollPane = new JScrollPane(displayPane);
                   scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); // pane is scrollable vertically
                   scrollPane.setWheelScrollingEnabled(true);// pane is scrollable by use of the mouse wheel
                   scrollPane.setPreferredSize(new Dimension(400,320));
              displayPanel.add(scrollPane);
              JPanel workPanel = new JPanel();// panel is used to enter, edit and delete data
                   workPanel.setLayout(new FlowLayout());
                   workPanel.add(createButton);
                        createButton.setToolTipText("Create a new entry");
                        createButton.addActionListener(this);
                   workPanel.add(searchButton);
                        searchButton.setToolTipText("Search for an entry by name number or surname");
                        searchButton.addActionListener(this);
                   workPanel.add(modifyButton);
                        modifyButton.setToolTipText("Modify an existing entry");
                        modifyButton.addActionListener(this);
                   workPanel.add(deleteButton);
                        deleteButton.setToolTipText("Delete an existing entry");
                        deleteButton.addActionListener(this);
              labelPanel.setBackground(Color.red);
              displayPanel.setBackground(Color.red);
              workPanel.setBackground(Color.red);
              // create container and set attributes
              Container c = getContentPane();
                   c.setLayout(new BorderLayout(30,30));
                   c.add(labelPanel,BorderLayout.NORTH);
                   c.add(displayPanel,BorderLayout.CENTER);
                   c.add(workPanel,BorderLayout.SOUTH);
                   c.setBackground(Color.red);
              // add a listener for the window closing and save
              addWindowListener(
                   new WindowAdapter()
                        public void windowClosing(WindowEvent e)
                             int answer = JOptionPane.showConfirmDialog(null,"Are you sure you would like to save all changes and exit?","File submission",JOptionPane.YES_NO_OPTION);
                             if(answer == JOptionPane.YES_OPTION)
                                  save();
                                  System.exit(0);
              return c;
         } // end of createContentPane()
         protected void setTabsAndStyles(JTextPane displayPane)
         { // Start of setTabsAndStyles()
              // set Font style
              Style fontStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
              Style regular = displayPane.addStyle("regular", fontStyle);
              StyleConstants.setFontFamily(fontStyle, "SansSerif");
              Style s = displayPane.addStyle("bold", regular);
              StyleConstants.setBold(s,true);
         } // End of setTabsAndStyles()
         public JTextPane addTextToTextPane()
         { // start of addTextToTextPane()
              try
                   input = new DataInputStream(new FileInputStream(filename));
                   for(int i=0; i<name.length;i++)
                        name[i] = input.readUTF();
                        surname[i] = input.readUTF();
                        home[i] = input.readUTF();
                        work[i] = input.readUTF();
                        cell[i] = input.readUTF();
              catch(IOException io)
              Document doc = displayPane.getDocument();
              try
              { // start of tryblock
                   // clear previous text
                   doc.remove(0,doc.getLength());
                   // insert titles of columns
                   doc.insertString(0,"NAME\tSURNAME\tHOME NO\tWORK NO\tCELL NO\n",displayPane.getStyle("bold"));
                   // insert data
                   for(int i=0; i<name.length; i++)
                        doc.insertString(doc.getLength(), name[i] +"\t",displayPane.getStyle("regular"));
                        doc.insertString(doc.getLength(), surname[i] +"\t",displayPane.getStyle("regular"));
                        doc.insertString(doc.getLength(), home[i]+"\t",displayPane.getStyle("regular"));
                        doc.insertString(doc.getLength(), work[i]+"\t",displayPane.getStyle("regular"));
                        doc.insertString(doc.getLength(), cell[i]+"\t",displayPane.getStyle("regular"));
              } // end of try block
              catch(BadLocationException ble)
              { // start of ble exception handler
                   System.err.println("Could not insert text.");
              } // end of ble exception handler
              return displayPane;
         } // end of addTextToTextPane()
         // code to process user clicks
         public void actionPerformed(ActionEvent e)
         { // start of actionPerformed()
              String arg = e.getActionCommand();
              // user clicks exit option
              if(arg.equals("Exit"))
                   int answer = JOptionPane.showConfirmDialog(null,"Exiting will save all changes to file. \nAre you sure you would like to save and exit now?","File submission",JOptionPane.YES_NO_OPTION);
                   if(answer == JOptionPane.YES_OPTION)
                        save();
                        System.exit(1);
              // user clicks help option
              if(arg.equals("Help"))
                   JOptionPane.showMessageDialog(null, "Welcome to the phone book application. To add a new entry press the \"Create\" button.\n To search for an entry press the \"Search\" button.\n To modify an existing entry press the \"Modify\" button. \n To delete an entry press the \"Delete\" button.","Help Topic",JOptionPane.INFORMATION_MESSAGE);
              // user clicks about option
              if(arg.equals("About"))
                   JOptionPane.showMessageDialog(null,"Phonebook v 1.01 created by Yucca Nel.\nNo copyright exists.\nThis program is freeware and should not be sold.\nEnjoy :-)","About phonebook",JOptionPane.INFORMATION_MESSAGE);
              // user clicks create button
              if(arg.equals("Create"))
                   createNew();
              // user clicks search button
              if(arg.equals("Search"))
                   searchForName(arg, name);                    // Only possible to search by name as all contacts Must have a name
              if(arg.equals("Modify"))
                   modifyContact(arg,name);
                   save();
              // user clicks the sort by name option
              if(arg.equals("Name"))
                   sort(name);
              if(arg.equals("Surname"))
                   sort(surname);
         } // end of actionPerformed()
         // Method to ceate a new entry
         public void createNew()
         { // start of createNew()
              int newHome, newWork, newCell = 0;
              String newContactName = JOptionPane.showInputDialog(null,"Please enter the new contacts first name or press cancel to exit.");
              if(newContactName == null)     finish();                         // if user clicks cancel
              if(newContactName.length() <=0)
                   JOptionPane.showMessageDialog(null,"You did not enter a valid name.\nPlease make sure you enter data correctly.","Error",JOptionPane.ERROR_MESSAGE);
                   createNew();                                                  // To return to the create method
              String newContactSurname = JOptionPane.showInputDialog(null,"Please enter the new contacts surname or press cancel to exit.");
              if(newContactSurname == null)     finish();                    // if user clicks cancel
              if(newContactSurname.equals(""))
                   int answer = JOptionPane.showConfirmDialog(null,"You did not enter a surname.\nAre you sure you wish to leave the surname empty?","No data entered",JOptionPane.YES_NO_OPTION);   // Asks if data was valid
                   if(answer == JOptionPane.NO_OPTION)
                        newContactSurname = JOptionPane.showInputDialog(null,"Please enter the new contacts surname.");
              String newContactWorkNum = JOptionPane.showInputDialog(null,"Please enter the new contacts work number or press cancel to exit.");
              if(newContactWorkNum == null)   finish();                    // if user clicks cancel
              String newContactHomeNum = JOptionPane.showInputDialog(null,"Please enter the new contacts home number or press cancel to exit.");
              if(newContactHomeNum == null)     finish();                    // if user clicks cancel
              String newContactCellNum = JOptionPane.showInputDialog(null,"Please enter the new contacts cell number or press cancel to exit.");
              if(newContactCellNum == null)     finish();                    // if user clicks cancel
              // enlarge the arrays so they can accept data
              name = enlargeArray(name);
              surname = enlargeArray(surname);
              work = enlargeArray(work);
              home = enlargeArray(home);
              cell = enlargeArray(cell);
              // add the new data into the arrays
              name[name.length-1] = newContactName;
              surname[surname.length-1] = newContactSurname;
              home[home.length-1] = newContactHomeNum;
              work[work.length-1] = newContactWorkNum;
              cell[cell.length-1] = newContactCellNum;
              // sort the names so they appear in alphebetical order
              sort(name);
         } // end of createNew()
         // The enlarge array method
         //method to enlarge an array by 1
         public String[] enlargeArray(String[] currentArray)
              String[] newArray = new String[currentArray.length + 1];
              for (int i = 0; i < currentArray.length; i++)
              newArray[i] = currentArray;
              return newArray;
         }// End of enlargeArray()
         // The Sort Method
         public void sort(String tempArray[])
         { // start of sort()
              // for loop
              for(int pass = 1; pass < tempArray.length; pass++)
                   for(int element = 0; element < tempArray.length -1; element++)
                   if(tempArray[element].compareTo(tempArray[element+1])>0)
                        swap(name, element, element+1);
                        swap(surname, element, element+1);
                        swap(home, element, element+1);
                        swap(work, element, element+1);
                        swap(cell, element, element+1);
              addTextToTextPane();
         } // end of sort()
         // The swap method
         public void swap(String swapArray[], int first, int second)
         { // start of swap()
              String hold;
              hold = swapArray[first];
              swapArray[first] = swapArray[second];
              swapArray[second] = hold;
         } // end of swap()
         // method to search for a name
         public void searchForName(String searchField, String searchArray[])
         { // start of searchForName()
              try
                   Document doc = displayPane.getDocument();                         // assign text to an object
                   doc.remove(0,doc.getLength());                                        // clear the screen
                   doc.insertString(0,"NAME\tSURNAME\tHOME NO\tWORK NO\tCELL NO\n",displayPane.getStyle("bold"));
                   String searchValue = JOptionPane.showInputDialog(null,"Please enter the 1st name of the person you would like to see phone numbers for or press cancel to exit.");
                   boolean found = false;
                   if(searchValue == null) finish();                                   // if user clicks cancel
                   //search the array
                   for(int i=0; i < name.length; i++)
                        if(searchValue.compareTo(searchArray[i])==0)
                             doc.insertString(doc.getLength(), name[i] +"\t",displayPane.getStyle("regular"));
                             doc.insertString(doc.getLength(), surname[i] +"\t",displayPane.getStyle("regular"));
                             doc.insertString(doc.getLength(), home[i]+"\t",displayPane.getStyle("regular"));
                             doc.insertString(doc.getLength(), work[i]+"\t",displayPane.getStyle("regular"));
                             doc.insertString(doc.getLength(), cell[i]+"\t",displayPane.getStyle("regular"));
                             found = true;
                   if(found == false)
                        JOptionPane.showMessageDialog(null,"No contact with that name found.","No result found",JOptionPane.INFORMATION_MESSAGE);
                        sort(name);
              catch(BadLocationException ble)
                   System.err.println("Could not insert text.");
         } // end of searchForName()
         // Method to modify contact
         public void modifyContact(String searchField, String searchArray[])
         { // start of modifyContact()
              try
                   Document doc = displayPane.getDocument();                         // assign text to an object
                   doc.remove(0,doc.getLength());                                        // clear the screen
                   doc.insertString(0,"NAME\tSURNAME\tHOME NO\tWORK NO\tCELL NO\n",displayPane.getStyle("bold"));
                   String modifyValue = JOptionPane.showInputDialog(null,"Please enter the 1st name of the person you would like to change details for. Or press cancel to exit");
                   boolean found = false;
                   if(modifyValue == null)      finish();                              // if user clicks cancel
                   //search the array
                   for(int i=0; i < name.length; i++)
                        if(modifyValue.compareTo(searchArray[i])==0)
                             // To change the name
                             String oldName = name[i];
                             String newName = JOptionPane.showInputDialog(null,"Please enter a new name if you would like to change the name for "+name[i]+". Or press cancel to exit");
                             if(newName == null)
                                  name[i] = oldName;                                        // if user clicks cancel keep old entry
                                  finish();
                             if(newName.equals(""))                                        // if no data entered then name will stay same
                                  JOptionPane.showMessageDialog(null,"You did not enter a name in the name field.\nOld name will be kept.","Information Message",JOptionPane.INFORMATION_MESSAGE);
                                  name[i] = oldName;
                                  addTextToTextPane();
                             else
                                  name[i] = newName;                                        // new name is saved into array
                                  addTextToTextPane();
                             //To change the surname
                             String oldSurname = surname[i];
                             String newSurname = JOptionPane.showInputDialog(null,"Please enter a new surname if you would like to change the surname for "+name[i]+". Or press cancel to exit");
                             if(newSurname == null)
                                  surname[i] = oldSurname;                              // if user clicks cancel keep old entry
                                  finish();
                             if((oldSurname.length()>0) && newSurname.length()<=0)          // if surname existed but no new surname was entered
                                  int answer = JOptionPane.showConfirmDialog(null,"You are about to remove the surname for "+name[i]+".\nAre you sure you would like to remove the surname for this contact?","Please confirm the following",JOptionPane.YES_NO_OPTION);
                                  if(answer == JOptionPane.YES_OPTION)               // user wishes to remove old surname and leave no surname in place
                                       surname[i] = newSurname;                         // new surname is saved into the array
                                  else                                                       // user does not wish to remove surname
                                       surname[i] = oldSurname;                         // keep the old surname
                             else                                                            // just replace the surname with new one as everything seems fine
                                  surname[i] = newSurname;
                             //To change the work number of contact
                             String oldWork = work[i];
                             String newWork = JOptionPane.showInputDialog(null,"Please enter a new work number if you would like to change the work number for "+name[i]+". Or press cancel to exit");
                             if(newWork == null)
                                  work[i] = oldWork;                                        // user clicks cancel keep old entry
                                  finish();
                             if((oldWork.length()>0) && newWork.length()<=0)          // if number existed but no new number was entered
                                  int answer = JOptionPane.showConfirmDialog(null,"You are about to remove the work number for "+name[i]+".\nAre you sure you would like to remove the work number for this contact?","Please confirm the following",JOptionPane.YES_NO_OPTION);
                                  if(answer == JOptionPane.YES_OPTION)               // user wishes to remove old number and leave no number in place
                                       work[i] = newWork;                                   // new number is saved into the array
                                  else                                                       // user does not wish to remove number
                                       work[i] = oldWork;                                   // keep the old number
                             else                                                            // just replace the number with new one as everything seems fine
                                  work[i] = newWork;
                             //To change the work number of contact
                             String oldHome = home[i];
                             String newHome = JOptionPane.showInputDialog(null,"Please enter a new home number if you would like to change the home number for "+name[i]+". Or press cancel to exit");
                             if(newHome == null)
                                  home[i] = oldHome;                                        // if user clicks cancel keep old value
                                  finish();
                             if((oldHome.length()>0) && newHome.length()<=0)          // if number existed but no new number was entered
                                  int answer = JOptionPane.showConfirmDialog(null,"You are about to remove the home number for "+name[i]+".\nAre you sure you would like to remove the home number for this contact?","Please confirm the following",JOptionPane.YES_NO_OPTION);
                                  if(answer == JOptionPane.YES_OPTION)               // user wishes to remove old number and leave no number in place
                                       home[i] = newHome;                                   // new number is saved into the array
                                  else                                                       // user does not wish to remove number
                                       home[i] = oldHome;                                   // keep the old number
                             else                                                            // just replace the number with new one as everything seems fine
                                  home[i] = newHome;
                             //To change the cell number
                             String oldCell = cell[i];
                             String newCell = JOptionPane.showInputDialog(null,"Please enter a new cell number if you would like to change the cell number for "+name[i]+". Or press cancel to exit");
                             if(newCell == null)
                                  cell[i] = oldCell;                                        // if user clicks cancel keep old value
                                  finish();
                             if((oldCell.length()>0) && newCell.length()<=0)          // if number existed but no new number was entered
                                  int answer = JOptionPane.showConfirmDialog(null,"You are about to remove the Cell number for "+name[i]+".\nAre you sure you would like to remove the cell number for this contact?","Please confirm the following",JOptionPane.YES_NO_OPTION);
                                  if(answer == JOptionPane.YES_OPTION)               // user wishes to remove old number and leave no number in place
                                       cell[i] = newCell;                                   // new number is saved into the array
                                  else                                                       // user does not wish to remove number
                                       cell[i] = oldCell;                                   // keep the old number
                             else                                                            // just replace the number with new one as everything seems fine
                                  cell[i] = newCell;
                             found = true;
                        addTextToTextPane();
                   if(found == false)
                        JOptionPane.showMessageDialog(null,"No contact with that name found.","No result found",JOptionPane.INFORMATION_MESSAGE);
                        sort(name);
                        addTextToTextPane();
              catch(BadLocationException ble)
                   System.err.println("Could not insert text.");
         } // end of searchForName()
         // finish method for cancel button
         public void finish()
              JOptionPane.showMessageDialog(null,"This program will now close and automatically save all data entered. You may restart the program to modify any changes.","Information Message",JOptionPane.INFORMATION_MESSAGE);
              System.exit(0);
         // method to save data to file
         public void save()
              try
                   for(int i=0; i < name.length; i++)
                        output.writeUTF(name[i]);
                        output.writeUTF(surname[i]);
                        output.writeUTF(work[i]);
                        output.writeUTF(home[i]);
                        output.writeUTF(cell[i]);
                   JOptionPane.showMessageDialog(null,"Data succesfully saved to file.","Information message",JOptionPane.INFORMATION_MESSAGE);
              catch(IOException io)
                   System.exit(1);
         public static void main(String[] args)
         { // start of main()
              // Set look and feel of interface
              try
              { // start of try block
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } // end of try block
              catch(Exception e)
              { // start of catch block
                   JOptionPane.showMessageDialog(null,"There was an error in setting the look and feel of this application","Error",JOptionPane.INFORMATION_MESSAGE);
              } // end of catch block
              ContactsListInterface cli = new ContactsListInterface();
              cli.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
              cli.setJMenuBar(cli.createMenuBar());
              cli.setContentPane(cli.createContentPane());
              cli.setSize(520,500);
              cli.setVisible(true);
              cli.setResizable(false);
         } // end of main()
    } //end of classBefore thinking I am lazy I dont want you to correct my code. Just give me a few pointers on how to get my arrays back from the file and how to set my strings to  a non null value that wont show when my program starts.
    Edited by: Yucca on Mar 24, 2008 7:24 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

    Yucca wrote:
    It's pretty easy to write objects to file, but it depends on what you want to do with that file. Do you want it to be a human-readable text file? Is it only to be used by your program? The file is to be used by my program to save to and to read from. But I understand now that saving each entry as a string and not writing it to an array may be easier. Do I use the buffered reader instead of InputStreamReader? Oh sorry I forgot to mention that the file I save to will later be used when I convert my application to a database type/SQL tyype aplication.
    Edited by: Yucca on Mar 24, 2008 8:06 PMIt sounds to me like object serialization would be the easiest for what you want to do. Read through this:
    http://java.sun.com/developer/technicalArticles/Programming/serialization/
    And these apis:
    http://java.sun.com/j2se/1.5.0/docs/api/java/io/ObjectOutputStream.html
    http://java.sun.com/j2se/1.5.0/docs/api/java/io/ObjectInputStream.html

  • Anyone help me? i dunno what's this!!

    i am writting code for a simple gui window based java application , and this is the main windows' script:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    class MenuTest extends JFrame implements ActionListener{
    int inc;
    Customer customer[];
    JMenu mnuAccount, mnuTransaction, mnuHelp;
    JMenuItem withdrawalItem, depositItem, balanceItem, newAccountItem,exitItem;
    JMenuBar bar;     
    JPanel panel, p2, p3, p4;
    JLabel JlFirstName, JlLastName,JlBalance, JlID, enqbalance, money, JlDeposit;
    JTextField JtFFirstName, JtFLastName, JtFBalance, JtFID, JtFDeposit, JtFWithdraw;
    JButton ok, ok2, ok3, ok4, cancel;
    public MenuTest(){
         super("Banking Account");
         customer = new Customer [50];
         panel = new JPanel();
         p2 = new JPanel();
    p3 = new JPanel();
         p4 = new JPanel();
    panel.setVisible(false);     
         p2.setVisible(false);
         p3.setVisible(false);
         p4.setVisible(false);
         inc=0;
         JlFirstName = new JLabel("First Name ");     
         JlLastName = new JLabel("Last Name ");
         JlBalance = new JLabel("Balance ");
         JlID= new JLabel("ID");
    enqbalance = new JLabel("");
         JlDeposit = new JLabel("");
         JtFFirstName = new JTextField(50);
         JtFLastName = new JTextField(50);
         JtFBalance = new JTextField(50);
         JtFDeposit = new JTextField(6);
    JtFWithdraw = new JTextField(6);
         JtFID = new JTextField(4);
         ok = new JButton("OK");
         ok.addActionListener(this);
         ok2 = new JButton("OK");
         ok2.addActionListener(this);
         ok3 = new JButton("OK");
         ok3.addActionListener(this);
         ok4 = new JButton("Ok");
         ok4.addActionListener(this);     
         cancel = new JButton("Cancel");
         cancel.addActionListener(this);
    mnuAccount = new JMenu("Account");
    mnuTransaction = new JMenu("Transaction");
         mnuHelp = new JMenu("Help");
         //Set Shortcut key
         mnuAccount.setMnemonic('A');
         mnuTransaction.setMnemonic('T');
         mnuHelp.setMnemonic('H');     
         withdrawalItem = new JMenuItem("Withdrawal");
         depositItem = new JMenuItem("Deposit");
         balanceItem = new JMenuItem("Balance Inquiry");
         newAccountItem = new JMenuItem("New Account");
         exitItem = new JMenuItem("Exit");
    //Register the item and menu
         exitItem.addActionListener(this);
         mnuAccount.add(newAccountItem);
         newAccountItem.addActionListener(this);
         mnuAccount.addSeparator();
         mnuAccount.add(exitItem);
         mnuTransaction.add(withdrawalItem);
         withdrawalItem.addActionListener(this);
         mnuTransaction.add(depositItem);
         depositItem.addActionListener(this);
         mnuTransaction.add(balanceItem);     
         balanceItem.addActionListener(this);
         bar = new JMenuBar();
    bar.add(mnuAccount);
         bar.add(mnuTransaction);
         bar.add(mnuHelp);
         setJMenuBar(bar);
         setSize(400,400);
         setVisible(true);
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == exitItem) {
    JOptionPane.showMessageDialog(null,"Press Close On Window Screen To Exit","Help",JOptionPane.PLAIN_MESSAGE);
    //ADD NEW ACCOUNT     
    else if (e.getSource() == newAccountItem){
         JtFID.setText("");     
    panel.setLayout(new GridLayout(5,2));
    panel.setSize(400, 400);
         getContentPane().add(panel);
         panel.setVisible(true);
         p2.setVisible(false);
         p3.setVisible(false);
         p4.setVisible(false);
         panel.add(JlFirstName );
         panel.add(JtFFirstName);
         panel.add(JlLastName);
         panel.add( JtFLastName);
         panel.add( JlBalance);
         panel.add( JtFBalance);
         panel.add( JlID);
         panel.add(JtFID);
         panel.add(ok);
         panel.add(cancel);
         panel.setVisible(true);
    else if ((e.getSource() == ok) && (emptyID()==true))
         JOptionPane.showMessageDialog(null,"Empty 4-digit ID","Empty ID",JOptionPane.PLAIN_MESSAGE);     
    else if ((e.getSource() == ok) && (emptyID()==false))
         Customer c= new Customer(JtFFirstName.getText(), JtFLastName.getText(), JtFID.getText());
         Account account = new Account(Double.parseDouble(JtFBalance.getText()));
         c.setAccount(account);
         customer[inc] = c;
         inc++;
         JOptionPane.showMessageDialog(null,"Add Successful","Adding Customer",JOptionPane.PLAIN_MESSAGE);     
    else if (e.getSource() == cancel)
         JtFFirstName.setText("");
         JtFLastName.setText("");
         JtFBalance.setText("");
         JtFID.setText("");
    //BALANCE ENQUIRY
    else if (e.getSource() == balanceItem)
         JtFID.setText("");
         p2.setLayout(new GridLayout(3,3));
         getContentPane().add(p2);
         panel.setVisible(false);
         p2.add(JlID);
         p2.add(JtFID);
         p2.add(ok2);
         p2.add(enqbalance);
         p4.setVisible(false);
         p3.setVisible(false);
         p2.setVisible(true);
    //if ok is press things will be processed     
    else if ((e.getSource() == ok2) && (emptyID()==true))
         JOptionPane.showMessageDialog(null,"Empty 4-digit ID","Empty ID",JOptionPane.PLAIN_MESSAGE);     
    else if ((e.getSource() == ok2) && (emptyID()==false))
         if(findID(Integer.parseInt(JtFID.getText()))== -1){JOptionPane.showMessageDialog(null,"No such person","Balance Enquiry",JOptionPane.PLAIN_MESSAGE);}
         else
    int j = findID(Integer.parseInt(JtFID.getText()));
         enqbalance.setText("First Name=" + customer[j].getFirstName() + "Last Name = " + customer[j].getLastName() + "Balance = " +customer[j].getAccount().getBalance() );      
    //DEPOSIT ITEM
    else if (e.getSource() ==depositItem)
         JtFID.setText("");
         panel.setVisible(false);
         p2.setVisible(false);
         p4.setVisible(false);
         p3.add(JlID);
         p3.add(JtFID);
         JlDeposit.setText("Deposit amount");
         p3.add(JlDeposit);
         p3.add(JtFDeposit);
         p3.add(ok3);     
         p3.setLayout(new GridLayout(3,3));     
         getContentPane().add(p3);
         p3.setVisible(true);
    else if ((e.getSource() == ok3) && (emptyID()==true))
         JOptionPane.showMessageDialog(null,"Empty 4-digit ID","Empty ID",JOptionPane.PLAIN_MESSAGE);     
    else if ((e.getSource() == ok3) && (emptyID()==false))
         if(findID(Integer.parseInt(JtFID.getText()))== -1){JOptionPane.showMessageDialog(null,"No such person","Deposit",JOptionPane.PLAIN_MESSAGE);}
         else
         int j = findID(Integer.parseInt(JtFID.getText()));
    customer[j].getAccount().deposit(Double.parseDouble(JtFDeposit.getText()));
         JOptionPane.showMessageDialog(null,"Deposit Successful","Deposit",JOptionPane.PLAIN_MESSAGE);     
    //WITHDRAWAL
    else if (e.getSource() == withdrawalItem)
         JtFID.setText("");
         panel.setVisible(false);
         p2.setVisible(false);
         p3.setVisible(false);
    p4.setLayout(new GridLayout(3,3));
         p4.setSize(300,300);
         getContentPane().add(p4);
         p4.add(JlID);
         p4.add(JtFID);
         JlDeposit.setText("Withdrawal");
         p4.add(JlDeposit);
         p4.add(JtFWithdraw);
         p4.add(ok4);     
         p4.setVisible(true);
    else if ((e.getSource() == ok4) && (emptyID()) )
         JOptionPane.showMessageDialog(null,"Empty 4-digit ID","Empty ID",JOptionPane.PLAIN_MESSAGE);     
    else if( (e.getSource() == ok4) && (!emptyID()) )
         if(findID(Integer.parseInt(JtFID.getText()))== -1){JOptionPane.showMessageDialog(null,"No such person","Withdraw",JOptionPane.PLAIN_MESSAGE);}
         else
         int j = findID(Integer.parseInt(JtFID.getText()));      
    customer[j].getAccount().withdraw(Double.parseDouble(JtFWithdraw.getText()));
         JOptionPane.showMessageDialog(null,"Withdrawal Successful","Withdrawal",JOptionPane.PLAIN_MESSAGE);          
    public boolean emptyID()
    { if(JtFID.getText()=="")return true;
    return false;
    public int findID(int id)
    for(int i=0; i <=inc; i++)
         if(customer.getID() == Integer.parseInt(JtFID.getText()) )
              return i;
    return -1;     
    public static void main(String args[]){
    MenuTest app = new MenuTest();
    app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    when i compile the program and try one of the following:
    1) not enter the customer ID and press enter in deposit/withdrawal, the error in the background DOS is like this:
    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.
    java:48)
    at java.lang.Integer.parseInt(Integer.java:489)
    at java.lang.Integer.parseInt(Integer.java:518)
    at MenuTest.actionPerformed(MenuTest.java:257)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    86)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    java.lang.NullPointerException
    at MenuTest.findID(MenuTest.java:274)
    at MenuTest.actionPerformed(MenuTest.java:257)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    86)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    java.lang.NullPointerException
    at MenuTest.findID(MenuTest.java:274)
    at MenuTest.actionPerformed(MenuTest.java:257)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    86)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    anyboydy know how to solve this problem, further more, there's no dialog box pop up saying empty deposit/withdraw messages..please help me!

    recently i 've updated my piece of code to handle the NumberFormatException like the below:
         try{       
              Customer2 j = findID(Integer.parseInt(JtFID.getText()));     
    String info = "First Name: " + j.getFirstName() + "\nLast Name: " + j.getLastName() + "\nBalance: " +j.getAccount().getBalance() ;
         JOptionPane.showMessageDialog(null,info,"Customer Balance Enquiry",JOptionPane.PLAIN_MESSAGE);          
         enqbalance.setText("");                
    catch (NumberFormatException info){JOptionPane.showMessageDialog(null,"No such person /Invalid Data Insertion, please try again!","Balance Enquiry",JOptionPane.PLAIN_MESSAGE);}
    but there's still similar error stating me i've got this issue:
    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.
    java:48)
    this are the first few ling of error, how could this happened as i already add the exception handling purpose?

  • Comparing an Item in a List to...

    Hello. I'm new to these forums, and this is my first post here. I'm working on a hangman game just for fun, and I've run into a snag. When it checks to see if the key pressed is equal to (or the same as) the letter in position x. Every time, even if the letter is in the word, it returns false and does nothing. I hope this is clear. Below is my entire code (just to give you an idea of how this works) of my main class. There is another class that contains methods, but it does not affect this problem.
    Also note that I am fairly new to Java, but have been programming in Python for about half a year now (taking a programming class at my High School). I also so PHP, but even with a good programming background, I still seem to run into snags while programming in Java.
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    public class Hangman extends JFrame implements ActionListener, KeyListener {
        // Initiate some global variables
        int num_guesses;
        String word;
        String end_round = "yes";
        String[] blanks;
        String[] letters;
        // Get the word list
        String location = "C:/Documents and Settings/AMT/My Documents/My Programs/Java/Hangman/build/classes/hangman_words.txt";
        Vector words = hmFunctions.getWords(location);
        Vector backUpWords = words;
        // Create the main buttons
        JButton hint = new JButton("Hint");
        JButton giveup = new JButton("I Give Up");
        JButton help = new JButton("Help");
        JButton about = new JButton("About");
        JButton quit = new JButton("Quit");
        // Create the main window and add componants
        public Hangman() {
            super("Hangman v1.0");
            setSize(631, 510);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // Create the main pane
            Container hm_pane = getContentPane();
            hm_pane.setLayout(null);
            hm_pane.setFocusable(true);
            hm_pane.addKeyListener(this);
            // Set the button properties
            hint.setBounds(new Rectangle(2, 444, 100, 30));
            hint.addActionListener(this);
            giveup.setBounds(new Rectangle(130, 444, 100, 30));
            giveup.addActionListener(this);
            help.setBounds(new Rectangle(260, 444, 100, 30));
            help.addActionListener(this);
            about.setBounds(new Rectangle(390, 444, 100, 30));
            about.addActionListener(this);
            quit.setBounds(new Rectangle(520, 444, 100, 30));
            quit.addActionListener(this);
            // Add Componants to interface pane
            hm_pane.add(hint);
            hm_pane.add(giveup);
            hm_pane.add(help);
            hm_pane.add(about);
            hm_pane.add(quit);
            setContentPane(hm_pane);
            setVisible(true);
        // Check to see if they clicked anything
        public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            if (source == hint) {
            } else if (source == giveup) {
            } else if (source == help) {
                JOptionPane.showMessageDialog(null, "JHangman v1.0 Help...");
            } else if (source == about) {
                JOptionPane.showMessageDialog(null, "JHangman v1.0\nProgrammed by...");
            } else if (source == quit) {
                System.exit(0);
        // Check if user pressed any keys
        public void keyTyped(KeyEvent key_event) {
            if (end_round == "yes") {
                mainGame("start");        
            } else if (end_round == "no") {
                Character key = key_event.getKeyChar();
                String let = key.toString();
                System.out.println("Letter Pressed: " + let);
                mainGame(let);
        public void keyPressed(KeyEvent key_event) {  
        public void keyReleased(KeyEvent key_event) {
        // The check letter method
        public void mainGame(String funct) {
            if (funct == "start") {
                num_guesses = 0;
                // Check if words empty
                if (words.size() == 0) {
                    words = backUpWords;
                // Get word needed for the game and back up
                word = hmFunctions.getRndWord(words);
                words.remove(word);
                // Create the blanks and letters vector
                letters = new String[word.length()];
                blanks = new String[word.length()];
                // Make the blanks and letters and draw interface
                for (int a = 0; a < word.length(); a++) {
                    blanks[a] = "_";
                    letters[a] = word.substring(a, a + 1);
                System.out.println("Game Started!");
                System.out.println("Blanks and letters added successfuly!");
                end_round = "no";
            // If no other instruction given, then check to see if key pressed is in the word
            } else {
                for (int x = 0; x < word.length(); x++) {
                    if (funct == letters[x]) {
                        blanks[x] = funct;
                    System.out.println(blanks[x] + " ");
                num_guesses += 1;
                if (num_guesses == 8) {
                    end_round = "yes";
        // Main Program
        public static void main(String[] arguments) {
            hmFunctions hm_fct = new hmFunctions();
            // Draw the main interface
            Hangman HM_Window = new Hangman();
    }Any help would be greatly appriciated!

    Of course, looking more closely, you do seem to be assigning the literal reference into the String object reference. In String s = "a string literal";
    if ( s == "a string literal" )
      // process
    } you may actually get into the if block. I would have to test to be sure. However, in general practice, if you want to check to see if two String objects have the same contents, use equals(). If you want to see if two object references point to the same location in memory, use ==. Primitives, of course, are compared with ==.
    Your keyTyped() method checks for two values of end_round. Have you checked for neither the if nor the else conditions being true?
    Do you know if you are getting into your mainGame() method? Try putting a println() in as soon as you enter, so you know you got there and you know the actual parameter value.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to customize JFrame

    hi guys...im quite new to java swing..i have this problem and hope u can help me with this..
    i now creating an Help frame....i want to have it using the hard coding way...now i want to modify the buttons(or clickable thingy) of the Jframe..
    These are found at the top right portion of the frame..( like the minimize, maximize and close buttons..)
    and i would like to add new button like a question mark like those help frames from other application...
    to really understand what i mean, just right click on your desktop and click properties...and u will see a frame/window with a question mark at
    the top right...
    HOW CAN I DO THIS?!

    I'd been playing around with this (as you can guess) and even after incorporating that line I still get a disabled max button, what am I doing wrong?import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.GradientPaint;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.border.BevelBorder;
    import javax.swing.border.EmptyBorder;
    public class HelpFrame
          extends JFrame implements ActionListener, MouseListener, MouseMotionListener {
       JLabel title = new JLabel ("Help Button Frame");
       JButton close = new TitleBarButton ("X");
       JButton help = new TitleBarButton ("?");
       JPanel titleBar;
       JPanel content = new JPanel ();
       int mouseX, mouseY;
       public HelpFrame () {
          try {
             UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());
          } catch (UnsupportedLookAndFeelException ex) {
             ex.printStackTrace ();
          } catch (IllegalAccessException ex) {
             ex.printStackTrace ();
          } catch (InstantiationException ex) {
             ex.printStackTrace ();
          } catch (ClassNotFoundException ex) {
             ex.printStackTrace ();
          addMouseMotionListener (this);
          addMouseListener (this);
          // uncomment to remove original borders & title bar
          //setUndecorated (true);
          // and comment this
          setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
          // Added as per Michael's advice
          JFrame.setDefaultLookAndFeelDecorated(true);
          setResizable (false);
          title.setForeground (Color.WHITE);
          help.setToolTipText ("Help");
          help.addActionListener (this);
          close.setToolTipText ("Close");
          close.addActionListener (this);
          titleBar = new JPanel () {
             @Override
             public void paintComponent (Graphics g) {
                super.paintComponent (g);
                Graphics2D g2 = (Graphics2D) g;
                // magic numbers for WinXP default title bar color gradient
                g2.setPaint (new GradientPaint (0, 0, new Color (10, 36, 106),
                      getWidth (), 0, new Color (166, 202, 240)));
                g2.fillRect (0, 0, getWidth (), getHeight ());
          titleBar.setPreferredSize (new Dimension (500, 24));
          titleBar.setBorder (new EmptyBorder (1, 2, 0, 2));
          titleBar.setLayout (new GridBagLayout ());
          titleBar.addMouseListener (this);
          titleBar.addMouseMotionListener (this);
          GridBagConstraints gbc = new GridBagConstraints ();
          gbc.insets = new Insets (2, 5, 2, 0);
          gbc.gridx = 0;
          gbc.gridy = 0;
          gbc.weightx = 1.0;
          gbc.fill = GridBagConstraints.HORIZONTAL;
          titleBar.add (title, gbc);
          gbc.insets = new Insets (2, 2, 2, 2);
          gbc.gridx = 1;
          gbc.weightx = 0.0;
          gbc.fill = GridBagConstraints.NONE;
          titleBar.add (help, gbc);
          gbc.insets = new Insets (2, 0, 2, 0);
          gbc.gridx = 2;
          titleBar.add (close, gbc);
          content.setLayout (new BorderLayout ());
          content.setBorder (new BevelBorder (BevelBorder.RAISED));
          content.setPreferredSize (new Dimension (500, 300));
          setContentPane (content);
          add (titleBar, BorderLayout.NORTH);
       void makeUI () {
          pack ();
          setLocationRelativeTo (null);
          setVisible (true);
       public void actionPerformed (ActionEvent e) {
          if (e.getSource () == close) {
             dispose ();
             System.exit (0);
          } else if (e.getSource () == help) {
             JOptionPane.showMessageDialog (this,
                   "Your help comes here!",
                   "Help",
                   JOptionPane.QUESTION_MESSAGE);
       public void mouseDragged (MouseEvent e) {
          if (e.getSource () == titleBar) {
             setLocation (getX () + e.getX () - mouseX,
                   getY () + e.getY () - mouseY);
       public void mousePressed (MouseEvent e) {
          mouseX = e.getX ();
          mouseY = e.getY ();
       public void mouseReleased (MouseEvent e) { }
       public void mouseMoved (MouseEvent e) {}
       public void mouseClicked (MouseEvent e) {}
       public void mouseEntered (MouseEvent e) {}
       public void mouseExited (MouseEvent e) {}
       public static void main (String[] args) {
          SwingUtilities.invokeLater (new Runnable () {
             public void run () {
                new HelpFrame ().makeUI ();
    class TitleBarButton extends JButton {
       TitleBarButton (String caption) {
          super (caption);
          setPreferredSize (new Dimension (18, 18));
          setMargin (new Insets (2, 2, 2, 2));
          setBorder (new BevelBorder (BevelBorder.RAISED));
          setFocusPainted (false);
          setFocusable (false);
          //setRolloverEnabled (false);
    }Thanks, Darryl

  • Help with JOptionPane.showInputDialog

    Hi!!
    People here helped me before so trying my luck again:)
    In order to get information from people I use JOptionPane.showInputdialog,
    problem is if I need to get 2 different types of info I have to use
            naam = JOptionPane.showInputDialog(null, "Geef speler naam:");
            land = JOptionPane.showInputDialog(null, "Geef Land Speler:");Is there anyway to make this happen in 1 screen?
    Or do I have to make a new frame for that with textfields and such?
    if so, anyone got an example?

    im new here:) so.. New to Java Technology suits me
    well I guess.No it doesn't. New to Java forum is for classpath questions, simple compile time problems and lazy students to cross post their assigments into.
    Swing questions, such as the one you asked, should be asked in the Swing forum because the people who answer questions in there are more knowledgeable about Swing. Plus you will almost 100% likely to find working example codes from previous posts in the Swing forum for Swing related questions.
    Much more likely than in here anyway.

  • Cannot Import javax.swing.JOptionPane   Please HELP!!!

    import javax.swing.JOptionPane;
    this line of code returns the error:
    C:\Java Files\BankAccount\BankAccount_Test.java:1: Class javax.swing.JOptionPane not found in import.
    import javax.swing.JOptionPane;
    ^
    1 error
    Process completed.
    Please help, I don't know what the problem could be....

    Swing was not part of any JDK's earlier than 1.2. Swing (or anything with a J in front of it, ie. JFrame, JOptionPane, etc...) was probably the most dramatic (if not largest) modification/addition to the Java language, that's why versions later than, and including, 1.2 are known as "Java 2".

  • JOptionPane and UninitializedValue. Help

    I am trying to create a personalized dialog that has 2 buttons (OK and Cancel) and three RadioButton where the first two radio buttons disable input and when user presses OK it returns a fixed string and if the user chooses the third button input is enabled so he can enter his own input.
    Now everything seems fine except that when I run getInputValue it gives me "uninitializedValue" sometimes, sometimes it works and sometimes even though a new dialog comes in and I type something completelly new the old value is kept.
    I hope somebody can give me some tips.
    Code Snippet below (And sorry for the ugly code :P)
    public class JIDEDialog extends JOptionPane {
         public JIDEDialog()
         public String displayInputDialog(Component parentComponent,
    Object message,
    String title,
    int messageType,
    String projectName)
         final Object OK_OPTION = new Integer(1);
         final Object CANCEL_OPTION = new Integer(0);
    JButton aJButton = null;
    ButtonGroup group = new ButtonGroup();
    JRadioButton rButton = null;
    //JRadioButton r2Button = null;
    String defaultValue = null;
    Object[] options = null;
    if (title == null || title.compareTo("") == 0)
    title = "Type your input";
    //JOptionPane pane = new JOptionPane();
    setMessage(message);
    //pane.setOptionType(optionType);
    setMessageType(messageType);
    setIcon(null);
    options = new Object[5];
    aJButton = new JButton("OK");
    options[0] = aJButton;
    aJButton = new JButton("Cancel");
    options[1] = aJButton;
    rButton = new JRadioButton("Dat File");
    group.add(rButton);
    options[2] = rButton;
    rButton = new JRadioButton("Jar File");
    group.add(rButton);
    options[3] = rButton;
    rButton = new JRadioButton("Input");
    group.add(rButton);
    options[4] = rButton;
    group.setSelected(rButton.getModel(), true);
    setOptions(options);
    setWantsInput(true);
    setSelectionValues(null);
    setInitialSelectionValue(null);
    updateUI();
    final JDialog dialog = this.createDialog(parentComponent, title);
    dialog.setResizable(false);
    //setInitialValue(options[4]);
    selectInitialValue();
    ((JButton)options[0]).addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
              setValue(OK_OPTION);
              //dialog.dispose();
              dialog.hide();
         ((JButton)options[1]).addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
              setValue(CANCEL_OPTION);
              //dialog.dispose();
              dialog.hide();
         ((JRadioButton)options[2]).addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
              setWantsInput(false);
         ((JRadioButton)options[3]).addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
              setWantsInput(false);
         ((JRadioButton)options[4]).addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
              setWantsInput(true);
    dialog.show();
    //System.out.println(getInputValue());
    //If there is an array of option buttons:
    if(getValue() == OK_OPTION){
         if(((JRadioButton)options[2]).isSelected())
              defaultValue = ".."+System.getProperty("file.separator")+"data"+System.getProperty("file.separator")+projectName+".dat";           
         else if(((JRadioButton)options[3]).isSelected())
              defaultValue = ".."+System.getProperty("file.separator")+"data"+System.getProperty("file.separator")+projectName+".jar";
         else {
              defaultValue = (String)getInputValue();
    else {
              defaultValue = null;
    return defaultValue;
    Best Regards
    NooK

    Sorry for that, I did want some code tag when I posted the code at first but being new to this interface I couldn't find it and apparently I can't edit my own post above.
    As for uninitializedValue, there is not much more I could except that it is a constant in JOptionPane class
    static Object UNINITIALIZED_VALUE And also this info is given on the createDialog method but I didn't really get what they meant
    [bold]Each time the dialog is made visible, it will reset the option pane's value property to JOptionPane.UNINITIALIZED_VALUE to ensure the user's subsequent action closes the dialog properly.[bold]
    I have tried calling setInitialValue(Object) and selectInitialValue() to ensure that the initial value is not but I am not sure what initial value is meant (Like the button to be first selected when dialog is shown or the string to appear in the text field) so I couldn't do much but I suspect that some function is changing the initial valeu and I missed it.
    I paste the code again under tags
    public class JIDEDialog extends JOptionPane {
         public JIDEDialog() {}
         public String displayInputDialog(Component parentComponent,
                                                                                    Object message,
                                                                                    String title,
                                                                                    int messageType,
                                                                                    String projectName)
             final Object OK_OPTION = new Integer(1);
             final Object CANCEL_OPTION = new Integer(0);
                       JButton aJButton = null;
                       ButtonGroup group = new ButtonGroup();
                       JRadioButton rButton = null;
                      String defaultValue = null;
                      Object[] options = null;
                      if (title == null || title.compareTo("") == 0)
                      title = "Type your input";
                    setMessage(message);
                    setMessageType(messageType);
                    setIcon(null);
                    options = new Object[5];
                    aJButton = new JButton("OK");
                    options[0] = aJButton;
                    aJButton = new JButton("Cancel");
                   options[1] = aJButton;
                   rButton = new JRadioButton("Dat File");
                   group.add(rButton);
                   options[2] = rButton;
                   rButton = new JRadioButton("Jar File");
                   group.add(rButton);
                   options[3] = rButton;
                   rButton = new JRadioButton("Input");
                   group.add(rButton);
                   options[4] = rButton;
                   group.setSelected(rButton.getModel(), true);
                   setOptions(options);
                   setWantsInput(true);
                  setSelectionValues(null);
                  setInitialSelectionValue(null);
                  final JDialog dialog = this.createDialog(parentComponent, title);
                  dialog.setResizable(false);
                  selectInitialValue();
                   ((JButton)options[0]).addActionListener(new ActionListener()  {
              public void actionPerformed(ActionEvent ae)  {
                 setValue(OK_OPTION);
                  //dialog.dispose();
                 dialog.hide();
         ((JButton)options[1]).addActionListener(new ActionListener()  {
              public void actionPerformed(ActionEvent ae)  {
                 setValue(CANCEL_OPTION);
                  //dialog.dispose();
                 dialog.hide();
         ((JRadioButton)options[2]).addActionListener(new ActionListener()  {
              public void actionPerformed(ActionEvent ae)  {
                 setWantsInput(false);
         ((JRadioButton)options[3]).addActionListener(new ActionListener()  {
              public void actionPerformed(ActionEvent ae)  {
                 setWantsInput(false);
         ((JRadioButton)options[4]).addActionListener(new ActionListener()  {
              public void actionPerformed(ActionEvent ae)  {
                 setWantsInput(true);
            dialog.show();
            //If there is an array of option buttons:
            if(getValue() == OK_OPTION){
                 if(((JRadioButton)options[2]).isSelected())
                      defaultValue = ".."+System.getProperty("file.separator")+"data"+System.getProperty("file.separator")+projectName+".dat";                  
                 else if(((JRadioButton)options[3]).isSelected())
                      defaultValue = ".."+System.getProperty("file.separator")+"data"+System.getProperty("file.separator")+projectName+".jar";
                 else {
                      defaultValue = (String)getInputValue();
            else {
                 defaultValue = null;
            return defaultValue;
    }Hope this helps and hope someone can help me.

  • Needing help organizing JOptionPane outputs

    Evening all,
    I'm trying to have a few variables whose info I get from JOptionPane such as Id, Name, Address etc.. to print out in a finished JOptionPane. The program I have so far prints it out nice and neat in the cmd window, but I havent had to make it printout in a JOptionPane window all nice and neat.
    Would anyone be able to supply a small portion of code for this?
    I would need it to print out like so
    (title of the window is College of Java)
    Id:
    Name
    Address
    Major
    Status
    Gpa
    Many Thanks to all who help :)

    String message = "Id:\nName\nAddress\nMajor...";
    JOptionPane op = new JOptionPane();
    op.showMessageDialog(this, message, "High Scores", JOptionPane.PLAIN_MESSAGE);Like that?

  • Help Button in JOptionPane

    Hi all,
    is there any easy way to provide a (possible locale sensitive) Help Button in JOptionPane Dialogs? Are there any libs that extend the Standard Dialogs to provide such a button?
    Many thanks for your ideas!
    bye
    Marcus

    This guy made his own alternative OptionPane that has such a feature:
    [http://javagraphics.blogspot.com/2008/06/joptionpane-making-alternative.html|http://javagraphics.blogspot.com/2008/06/joptionpane-making-alternative.html]

  • JOptionPane goes behind browser window (Help PLEASE!)

    I apologize if this is not the best place to post this question.
    I have an applet that open a JOptionPane using the following:
    int rc = JOptionPane.showConfirmDialog(null,
    "Do you want to save the changes you made to " + appInfo.getName() + "?", ProductInfo.ProductName,
    JOptionPane.YES_NO_CANCEL_OPTION,
    JOptionPane.WARNING_MESSAGE);
    THE PROBLEM I'm seeing is that this JOptionPane pops up for a second and then goes behind the applet browser window.
    I have 2 html files (index.html and product.html). index.html opens product.html in a new browser window (minus the toolbar and menu) using a small javascript (see below for code).
    I only see this problem when I open product.html via index.html. When I open product.html by itself this problem does not occur.
    Please help if you can - thanks ahead of time!!
    INDEX.HTML
    ===============================
    <html>
    <head><title>ProductName&trade;, Version 2.0</title></head>
    <body>
    <script>
    <!--
    /*Full screen window opener script: Written by JavaScript Kit (www.javascriptkit.com) More free scripts here*/
    function winopen(){
    var targeturl="./product.html"
    newwin=window.open("","","scrollbars")
    if (document.all){
    newwin.moveTo(0,0)
    newwin.resizeTo(screen.width,screen.height)
    newwin.location=targeturl
    //-->
    </script>
    <script>winopen()</script>
    </body>
    </html>

    Solved my own problem!!
    I modified index.html (see below) and it now works - the JOptionPane stays on top. Still don't know why though.
    INDEX.HTML
    =============================
    <html>
    <head><title>SwitchView&trade;, Version 2.0</title>
    <SCRIPT>
    function fullWindow(url) {
    var str = "left=0,screenX=0,top=0,screenY=0,resizable";
    if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    str += ",height=" + ah;
    str += ",innerHeight=" + ah;
    str += ",width=" + aw;
    str += ",innerWidth=" + aw;
    win=window.open(url, "w", str);
    </SCRIPT>
    </head>
    <body>
    <script>fullWindow('./product.html')</script>
    </body>
    </html>

  • JOptionPane.showMessageDialog(Component, Object) Help

    Hi,
    I am trying to use the JOptionPane, to display a MessageDialog.
    But, the message should be displayed with special font(BOLD), and the message should have background color(Red). The message is too long, so, I had to set location, with the following code, the dialog window is displayed but I am not able to see the text message. It appears as one red line. Could someone help me in fixing this.
    Not sure, if I have to use Layout, would BoxLayout fix the problem?
    The code is:
    com.sun.java.swing.JPanel displayPanel = new com.sun.java.swing.JPanel();
    com.sun.java.swing.JLabel displayLabel1 = new com.sun.java.swing.JLabel();
    com.sun.java.swing.JLabel displayLabel2 = new com.sun.java.swing.JLabel();
    displayLabel1.setText(getReactivationMessage().substring(0,23));
    displayLabel1.setFont(new java.awt.Font("dialog", 1, 15));
    displayLabel2.setText(getReactivationMessage().substring(23));
    displayLabel2.setFont(new java.awt.Font("dialog", 1, 15));
    displayPanel.setLayout(null);
    displayLabel1.setSize(30, 20);
    displayLabel2.setSize(100, 20);
    displayLabel1.setLocation((displayPanel.getWidth()-30)/2,(displayPanel.getHeight())/2);
    displayLabel2.setLocation((displayPanel.getWidth()-100)/2,(displayPanel.getHeight()-20)/2);
    displayPanel.add(displayLabel1);
    displayPanel.add(displayLabel2);
    displayPanel.setBackground(java.awt.Color.red);
    com.onstar.businessApplications.swing.uiComponentLibrary.widgets.JOptionPane_On.showMessageDialog(winMgr.getCCSAgentWindow(),displayPanel);
    Thanks in Advance

    I didn't quite understand the problem, but if the problem is that the text runs all along one line, and therefore runs out of the right hand side of the dialog window, this is because you need to use a wrapping label.
    JLabel does not wrap text. There is a way to allow for this. This is by putting your string within an open and close html tag (i.e. <html>***myTextHere***</html>).
    Another option would be for you to extend JLabel and write a JWrapLabel or somesuch.
    HTH,
    Manuel Amago.

  • JOptionPane help please - I'd be v. grateful

    Hi,
    Can you help me please? I'm just learning Java and was curious if it's possible to change the font color of text in a MessageDialog?
    For example, if I was saying something like
    JoptionPane.showMessageDialog(null,
    "\n I have 2 cats" +
    "\n I have 1 dog" +
    "\n I have 3 budgerigars" +
    "\n" +
    "\n I have " + numberOfPets + " pets", JOptionPane.INFORMATION_MESSAGE)How do I change the last line for example to be in red and perhaps bold?
    Also for the lines above the last line, I wanted to indent these but if I try "\t" after the "\n", it does not work.
    Can somebody help me please?
    Many thanks
    Edited by: steveb on Nov 6, 2007 10:50 AM

    If you are new to Java, you shouldn't be worrying about little tweaks like this -- concentrate on learning object-oriented concepts.
    Anyway, the message string can include some html markup:
    String msg = "<html>foo <i>bar</i> <font color='green'>baz</font></html>";
    JOptionPane.showMessageDialog(null,msg);

  • Help with JOptionPane -- Popup Dialog Boxes

    I need to create a popup dialog box that looks like this:
    http://img88.imageshack.us/img88/6900/jbuttonpm2.jpg
    red = JTextField (Where the user will input a number that I need to store)
    green = Drop Down List with 1,2,3 as choices
    blue = JButtons for OK and Cancel
    So yeah, I need an easy way to collect a bunch of information from the user, and this was the best way I could think to do it. The user has to enter a number for all of the fields, but is there any way for the field to have a value of 0 there by default?
    I read some of the Java tutorials for using the JOptionPane's showXXXDialog but I wasn't sure if that can't of method could create such a complex dialog box. Any help would be really appreciated. How can I make that dialog box and get all the input I need from it?

    Create a panel containing red and green and pass it as message to JoptionPane.showConfirmDialog with OK_CANCEL_OPTIONS to have blue. If it returns OK_OPTION read and use values from panel. That's it.

Maybe you are looking for

  • Adjust font size

    The font in the 'upper panel' is pretty small. When I try to use crtl + the display in the preview pane is adjusted larger, however the font size in upper panel is not affected. How can I adjust the disply size or font size in the upper panel? Ubuntu

  • How to install/update drivers for CD/DVD player T60

    My laptop crashed while I was in the philippines.  Of course, I did not have the restore or recovery cds.  The technicians did a good job, but now I realize that they did not do that good of a job. I am trying to create the PC Doctor Diagnosis bootab

  • Discoverer Desktop

    Hi Can u tell about the uses of Oracle Discoverer Desktop...... Regards, Sankar.C

  • Simple Way to Track Photos Between Multiple Macs?

    Hello, everyone. I hope you are doing well. My wife and I take photos and video with 2 different iPhones, a Nikon SLR, a Panasonic compact digital, and a Flip HD video recorder. I put the photos I take on my Mac Pro. She puts the photos she takes on

  • Hitting quotes gives@,hitting at gives ",hitting hash gives\;not with other browsers.How do I correct this?

    I have suddenly started getting the problems that I've outlined above using Firefox3.6.15.I do not have the same problems using other browsers.