If you think you are a good programmer then enter here!!!

I have coded a password screen and have 2 text fields for the user to enter obviously their username and password. However when entering a password you should never be able to see what you are writing it should be in the form of stars or something so your password stays confidential.
So if your a programming guru and think you can do this then please give me the code which allows the user to enter their password but appears as stars and not letters.
This is the current password screen code:
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class Password extends JFrame implements ActionListener{
     private JPanel panel, panel2;
     private JLabel label1, label2;
     private JTextField text1, text2;
     private JButton exit, login;
     private ImageIcon picture;
     public Password(){
          displayForm();
          displayFields();
          displayButtons();
          getContentPane().add(panel,"Center");
          getContentPane().add(panel2,"North");
          setVisible(true);
          int x = 20;
          int y = 50;
          int textheight = 20;
          int textwidth = 150;
          int labelwidth = 100;
          int xdist = textwidth*2;
          int ydist = textheight + 10;
     public void displayForm(){
          setTitle("IS Ltd Login Screen");
          setSize(320,450);
          //Center the frame
          Dimension dim = getToolkit().getScreenSize();
          setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
          getContentPane().setLayout(new BorderLayout());
          Border etched = BorderFactory.createEtchedBorder();
          panel = new JPanel();
          panel.setLayout( null );
          panel2 = new JPanel();
          panel2.setLayout( new FlowLayout() );
          Border paneltitled = BorderFactory.createTitledBorder(etched,"");
//          panel.setBorder(paneltitled);
     public void displayFields(){
          int x = 20;
          int y = 50;
          int textheight = 20;
          int textwidth = 150;
          int labelwidth = 100;
          int xdist = textwidth*2;
          int ydist = textheight + 10;
          picture = new ImageIcon("logo.jpg");
          JLabel picLabel = new JLabel(picture);
          panel2.add(picLabel);
          label1 = new JLabel("User Name:");
          label1.setBounds(x, y, labelwidth, textheight);
          panel.add(label1);
          text1 = new JTextField("");
          text1.setBounds(x+labelwidth, y, textwidth, textheight);
          panel.add(text1);
          label2 = new JLabel("Password:");
          label2.setBounds(x, y + ydist, labelwidth, textheight);
          panel.add(label2);
          text2 = new JTextField("");
          text2.setBounds(x+labelwidth, y + ydist, textwidth, textheight);
          panel.add(text2);
     public void displayButtons(){
          exit= new JButton("EXIT");
          exit.addActionListener(this);
          exit.setBounds(20, 250, 70, 50 );
          panel.add( exit );
          login= new JButton("LOGIN");
          login.addActionListener(this);
          login.setBounds(220, 250, 70, 50 );
          panel.add( login );
     public void actionPerformed(ActionEvent e) {
          Object source = e.getSource();
          //try{
               if (source == login){
               JFrame myMenu = new SIMenu();
               dispose();
               else if (source == exit){
                    System.exit(0);
          /*catch (SQLException ex)     {
               System.out.println("Failed");
               System.out.println(ex.getMessage());
               System.exit(-1);
     public static void main(String[] args) {
          Password frame = new Password();
          frame.addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                    System.exit(0);
}

So its only change to the following code.
import  javax.swing.*;
import  javax.swing.border.*;
import  java.awt.*;
import  java.awt.event.*;
import  java.sql.*;
* put your documentation comment here
public class Password extends JFrame
        implements ActionListener {
    private JPanel panel, panel2;
    private JLabel label1, label2;
    private JTextField text1;
    private JPasswordField text2;
    private JButton exit, login;
    private ImageIcon picture;
     * put your documentation comment here
    public Password () {
        displayForm();
        displayFields();
        displayButtons();
        getContentPane().add(panel, "Center");
        getContentPane().add(panel2, "North");
        setVisible(true);
        int x = 20;
        int y = 50;
        int textheight = 20;
        int textwidth = 150;
        int labelwidth = 100;
        int xdist = textwidth*2;
        int ydist = textheight + 10;
     * put your documentation comment here
    public void displayForm () {
        setTitle("IS Ltd Login Screen");
        setSize(320, 450);
        //Center the frame
        Dimension dim = getToolkit().getScreenSize();
        setLocation(dim.width/2 - getWidth()/2, dim.height/2 - getHeight()/2);
        getContentPane().setLayout(new BorderLayout());
        Border etched = BorderFactory.createEtchedBorder();
        panel = new JPanel();
        panel.setLayout(null);
        panel2 = new JPanel();
        panel2.setLayout(new FlowLayout());
        Border paneltitled = BorderFactory.createTitledBorder(etched, "");
        // panel.setBorder(paneltitled);
     * put your documentation comment here
    public void displayFields () {
        int x = 20;
        int y = 50;
        int textheight = 20;
        int textwidth = 150;
        int labelwidth = 100;
        int xdist = textwidth*2;
        int ydist = textheight + 10;
        picture = new ImageIcon("logo.jpg");
        JLabel picLabel = new JLabel(picture);
        panel2.add(picLabel);
        label1 = new JLabel("User Name:");
        label1.setBounds(x, y, labelwidth, textheight);
        panel.add(label1);
        text1 = new JTextField("");
        text1.setBounds(x + labelwidth, y, textwidth, textheight);
        panel.add(text1);
        label2 = new JLabel("Password:");
        label2.setBounds(x, y + ydist, labelwidth, textheight);
        panel.add(label2);
        text2 = new JPasswordField ("");
        text2.setBounds(x + labelwidth, y + ydist, textwidth, textheight);
        panel.add(text2);
     * put your documentation comment here
    public void displayButtons () {
        exit = new JButton("EXIT");
        exit.addActionListener(this);
        exit.setBounds(20, 250, 70, 50);
        panel.add(exit);
        login = new JButton("LOGIN");
        login.addActionListener(this);
        login.setBounds(220, 250, 70, 50);
        panel.add(login);
     * put your documentation comment here
     * @param e
    public void actionPerformed (ActionEvent e) {
        Object source = e.getSource();
        //try{
        if (source == login) {
            JFrame myMenu = new SIMenu();
            dispose();
        else if (source == exit) {
            System.exit(0);
        /*catch (SQLException ex) {
         System.out.println("Failed");
         System.out.println(ex.getMessage());
         System.exit(-1);
     * put your documentation comment here
     * @param args
    public static void main (String[] args) {
        Password frame = new Password();
        frame.addWindowListener(new WindowAdapter() {
             * put your documentation comment here
             * @param e
            public void windowClosing (WindowEvent e) {
                System.exit(0);
}good luck!

Similar Messages

  • Does iPhoto not have safeguards against accidentally deleting an entire photo book, which is very easily done (when you think you are deleting just a photo)? No "are you sure you want to delete?". No way of copying your book before, or restoring it after?

    Does iPhoto not have safeguards against accidentally deleting an entire photo book, which is very easily done with a single press of delete (and which can be done when you think you are deleting just a photo)? No "are you sure you want to delete?" before it happens? No way of copying your book while you are working on it (to make multiple versions of it, or just to have a safeguard copy), and no real way of restoring it after (since, remarkably, the photo books don't appear as items - items which could very easily be recovered otherwise)?

    I get a dialog box when I try to delete a book.
    And if you right click on the book in the left column you can duplicate it so you can have multiple versions.

  • Do you think this is a good monitor??

    Do you think this is a good monitor?? I want to keep the cost under control. I edit wedding videos. Yes the colors & blacks must be accurate but dont want to spend more than this. These were rated very high. I want to by 2 for a dual setup. CS5 PC based.with GTX570 2.5 G video card. 24 gigs ram, 6 core.
    ViewSonic VX2739WM 27-Inch 1920x1080 Full HD Monitor
    http://www.amazon.com/ViewSonic-VX2739WM-27-Inch-1920x1080-Monitor/dp/B003GBRXKU%3FSubscri ptionId%3D14H876SFAKFS0EHBYQ02%26tag%3Dbrandonhubpag-20%26linkCode%3Dxm2%26camp%3D2025%26c reative%3D165953%26creativeASIN%3DB003GBRXKU
    OR THIS ONE:
    Viewsonic VX2753MH-LED 27-Inch LED Monitor
    http://www.amazon.com/gp/product/B004KCI80I/ref=olp_product_details?ie=UTF8&me=&seller=

    colors & blacks must be accurate
    Don't rely on a computer monitor for that.  Best to use a properly calibrated external TV (or production monitor) of the highest quality you can afford.
    For good black levels and accurate colors, both Panasonic and Samsung offer good options in their plasma lineups.

  • Who do you think you are?

    Who do you think you are? Every week i am peacefully watching youtube videos when, suddenly, i need to actualize flashplayer and i can´t watch more videos unless i do it. Farther, to reinstall it i must close all my explorer windows so i am loosing my time and job.

    You have a job that involves watching YouTube all the time? That sounds like a fun job!
    As for having to update Flash Player each week, that's part of having signed up to use the beta version of Flash 11.6. If you go to this page:
    http://www.adobe.com/support/flashplayer/downloads.html
    you could run the uninstaller to remove 11.6, then on that same page you could go to the 11.5 installer page. That version will only occasionally get security updates.

  • Do you think you're going to sell online on French Itunes store the show called Scandal?

    Do you think you're going to sell on French Itunes store the show called Scandal?

    You are not addressing Apple, this is a user to user technical support forum.
    If there is content that you would like to see in iTunes, contact Apple and the content owner. Ultimately Otis up to the content owner if that content is made available in iTunes.

  • So you think you can Dance

    Can anyone tell me if last nights episode (7/19) is availabe for purchase on itunes (storm coverage so I didn't get to see much)? I'm at work and don't have itunes installed on my computer.
    Thanks,
    Carrie
      Windows XP  
      Windows XP  

    I could be just missing it somehow, but I don't see any episodes of "So You Think You Can Dance" available on the iTunes Music Store at all.

  • You think you can earn money by stealth? Trying to install that stupid software by Norton. No way buddy!    You can stic

    You think you can earn money by stealth? Trying to install
    that stupid software by Norton. No way buddy!
    You can stick it where no sun shines!
    I will pester you just as you have pestered me!

    quote:
    Originally posted by:
    dontbesilly22
    You think you can earn money by stealth? Trying to install
    that stupid software by Norton. No way buddy!
    You can stick it where no sun shines!
    I will pester you just as you have pestered me!
    You think you can earn money by stealth? Trying to install
    that stupid software by Norton. No way buddy!
    You can stick it where no sun shines!
    I will pester you just as you have pestered me!

  • Where is the so you think you can dance page?

    where is the So You Think You Can Dance page? I cannot find it anywhere.

    Forget hotel technical support. All they'll do is refer you to a toll free number to the other side of the globe where somebody will tell you to click a Start button, or something. It's an utter waste of time.
    What you describe is a "captive network" and yes, the need to authenticate each and every time you shut down your Mac or let it sleep is a common annoyance. The IT idiots that sold the Internet package to the hotel chain is long gone. Complain to whomever you can find, and perhaps one day they'll address their own incompetence. Until then keep your Mac connected, don't shut it down or let it sleep. Even then you may find yourself logged out from time to time, which you might not even become aware of until web pages stop loading. You can do nothing to fix it, other than to refuse to frequent that hotel chain. Be sure to tell them why.

  • Would you think these are signs of a dead iPod battery?

    I don't feel like posting the entire thing, graphics, links, and all here, you can read about my recent iPod escapade here.
    http://www.xanga.com/imac_insomniac
    Sorry to direct you all elsewhere to read the entire dealie, but... um,... please PLEASE help? Does this really sound like a fried battery problem? or what other problem do you think this is?

    Xx1Dustin1Xx wrote:
    No. Your iPhone is not defective. The only issue is that your battery is not fully conditioned. To condition your battery, simply recharge the iPhone to 100% and remove the USB cord and let it drain to 0% and then recharge it back to 100%. This completes 1 Charge Cycle. If the battery still drains, repeat the process until the battery is fully conditioned, but I don't recommend that you discharge it more than 2 times after the first calibration. You might destroy your battery's health.
    No you will not destroy your battery's health by discharging it more than 2 times. Whoever told you that is wrong. The only thing it will do is add up the charge cycles faster. Lithium Ion batteries do not hold memory like the NiCd batteries used to and can take a full charge or small charge the same. No where on the site you quoted does it say you might destroy your battery's health after 2 full cycle charges. I wish people like you would stop pushing bad information like that.

  • Just when  you think you know..

    New to the HD side of PPCS3, was using 2.0 with SD camera for quite awhile and trying to replicate what I did on that side.
    We have an opening avi that we embed in each video. In the SD side it filled the screen, looks sharp and crisp. That avi, obviously doesn't work in the HD side, 16:9. So recreated graphic by changing size to 1920x1080 and imported it to a new project. Did the movement and transitions and such and looks great in the editor. As soon as I export to AVI and try to use it in a new 16:9 HD project it's really small and doesn't fill the screen like it did on the post side.
    I'm NOT a graphic artist, but can fudge my way around Photoshop Elements or even use a graphic from one of our staff that knows what they are doing. The problem doesn't seem to be the actual graphic but the way it's exporting (I think). I changed all the settings for the .avi (Movie) export but no luck. I've run out of hair and ideas.. Advice? comments? ideas?
    Thanks!!!
    /bill

    >What should the settings be?
    The settings should be what you
    want. Start with a preset and change the settings that you want.
    You will also find links to many
    free tutorials in the PremiereProPedia that will quickly show you how things are done in Premiere Pro.
    Cheers
    Eddie
    PremiereProPedia   (
    RSS feed)
    - Over 300 frequently answered questions
    - Over 250 free tutorials
    - Maintained by editors like
    you
    Forum FAQ

  • Why do you think you have to (a) add extensions I don't want, (b) change my home page, (c) move tool bars around, (d) lord knows what else, at every update?

    Well, well, well. Here's update #32.0, without any idea what to expect. (Mozilla is turning into MicroSoft Light.)
    So okay, let 'er rip. Now I have this thing called Nimbus, which I don't remember asking for, and I have yet to figure out how to get rid of it. Thanks for blessing me with more stuff I'm never going to use.
    And gee, another new home page. Great. Is it not possible to leave my settings alone while you upgrade?
    And looky looky, my toolbar has been rearranged. Joy!
    I'm really sick of this.
    Free and open source or not, if I wanted continuous screwing with my software, I'd've stayed with Explorer.
    And let me put the "Reload Page" button where I want to put it, not where YOU think it belongs.

    hello, firefox doesn't add any third party extensions during an update - this rather sounds like adware that is present on your system. please perform these steps:
    # [[Reset Firefox – easily fix most problems|reset firefox]] (this will keep your bookmarks and passwords)
    # afterwards go to the firefox menu ≡ > addons > extensions and in case there are still extensions listed there, disable them.
    # finally run a full scan of your system with different security tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] and [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] to make sure that adware isn't present in other places of your system as well.
    [[Troubleshoot Firefox issues caused by malware]]

  • When you think you need write with clause of answers.

    This thread is not a question.
    I will use this thread to refer to in other threads, when anyone ask me "Do I have to write with clause?"
    The answer is NO you don't have to write with clause AT ALL.
    with clause is create temp table on the fly.
    with tempTable as(
    select 1 as column1,2 as column2 from dual union all
    select 1 as column1,2 as column2 from dual union all
    select 1 as column1,2 as column2 from dual)
    select * from tempTable;If you have created the Table,you do NOT have to write with clause like above.
    therefore you can write like below.
    select * from tempTable;

    user13091888 wrote:
    I dont's see reason why you created this thread but...
    Global temporary table and with clause is not equivalent. If you want select from temp table you have insert here some data first and then oracle have to create temp segment for your session. If you use with clause there is not neccessary to create temp segment for you unless you run out of your available memory e.g. making sorts, big hash joins etc.?:|
    He never mentioned Global Temporary Tables.
    He was saying that the subquery factoring clause is used in answers on the forum where people are temporarily creating the data for the purposes of the answer, rather than create a real table. I would guess English isn't his first language, so the way he worded it could be misconstrued, but it's fairly obviousl what he was saying, even though I agree the thread is pointless.

  • If YOU think your good at programming enter here!!!

    For those of you who just helped me thanks a lot.
    Another problem, i have coded the system using java ontop of an Oracle DB. In several of my forms I have a delete button which I want to give some functionality to as it has none at the moment. The functionality I want is to be able press this delete button and for it to delete the current showing record in the DB.
    For example if i was looking at a customer in the customer form and pressed the delete button I would like it to delete that customer from the DB. Look at my code so far BELOW to see if you can give me any tips on what the code should look like.
    10 dukes for whoever gives me a solution that works so all you programming guru's get your thinking hats on and answer this little baby!!!
    CUSTOMER CLASS
    import java.util.*;
    import java.sql.*;
    public class Customer{
         private int customer_id;
         private String customer_name;
         private String address1;
         private String address2;
         private String town;
         private String county;
         private String post_code;
         private String country;
         private String fax;
         private String telephone;
         private String contact_name;
         private String email;
         private boolean newCustomer;
         //private JobList jobList;
         public Customer(int c){
              customer_id = c;
              newCustomer = true;
         public Customer(int inCustomer_id,String inCustomer_name,String inAddress1, String inAddress2, String inTown, String inCounty,String inPost_code,String inCountry,String inFax,String inTelephone,String inContact_name,String inEmail){
              customer_id=inCustomer_id;
              customer_name=inCustomer_name;
              address1=inAddress1;
              address2=inAddress2;
              town=inTown;
              county=inCounty;
              post_code=inPost_code;
              country=inCountry;
              fax=inFax;
              telephone=inTelephone;          
              contact_name=inContact_name;
              email=inEmail;
              newCustomer = false;
         public String getAddress1(){
              if (address1 == null)
                   return ("");
              else
                   return address1;
         public String getAddress2(){
              if (address2 == null)
                   return ("");
              else
                   return address2;
         public String getCounty(){
              if (county == null)
                   return ("");
              else
                   return county;
         public String getFax(){
              if (fax == null)
                   return ("");
              else
                   return fax;
         public int getCustomer_id(){
              if (customer_id == 0)
                   return (0);
              else
                   return customer_id;
         public String getCustomer_name(){
              if (customer_name == null)
                   return ("");
              else
                   return customer_name;
         public String getTelephone(){
              if (telephone == null)
                   return ("");
              else
                   return telephone;
         public String getPost_code(){
              if (post_code == null)
                   return ("");
              else
                   return post_code;
         public String getTown(){
              if (town == null)
                   return ("");
              else
                   return town;
         public String getCountry(){
              if (country == null)
                   return ("");
              else
                   return country;
         public String getContact_name(){
              if (contact_name == null)
                   return ("");
              else
                   return contact_name;
         public String getEmail(){
              if (email == null)
                   return ("");
              else
                   return email;
         /*public JobList getJobList() throws SQLException {
              // if the joblist object exists return it otherwise create it
              if (jobList != null){
                   return jobList;
              else{
                   return new JobList(this);
         public boolean isNewCustomer(){
              return newCustomer;
         public void setAddress1(String inAddress1){
              address1=inAddress1;
         public void setAddress2(String inAddress2){
              address2=inAddress2;
         public void setCounty(String inCounty){
              county=inCounty;
         public void setFax(String inFax){
              fax=inFax;
         public void setCustomer_id(int inCustomer_id){
              customer_id = inCustomer_id;
         public void setCustomer_name(String inCustomer_name){
              customer_name=inCustomer_name;
         public void setTelephone(String inTelephone){
              telephone=inTelephone;
         public void setPost_code(String inPost_code){
              post_code=inPost_code;
         public void setTown(String inTown){
              town=inTown;
         public void setCountry(String inCountry){
              country=inCountry;
         public void setContact_name(String inContact_name){
              contact_name=inContact_name;
         public void setEmail(String inEmail){
              email=inEmail;
    CUSTOMERLIST CLASS
    import java.sql.*;
    import java.util.*;
    public class CustomerList{
         private ResultSet rs ;
         private Connection con;
         private Statement stmt;
         public CustomerList () {
              ConnectionManager man = ConnectionManager.getInstance();
              con = man.getConnection();
         public Customer getFirstCustomer()throws SQLException     {
              Customer firstCustomer;
              stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
              rs = stmt.executeQuery("select customer_id,customer_name,address1,address2,town,county,post_code,country,fax,telephone,contact_name,email from customer");
              rs.next();
              firstCustomer = loadCustomer();
              return firstCustomer;
         public Customer getLastCustomer() throws SQLException{
              Customer lastCustomer;
              rs.last();
              lastCustomer = loadCustomer();
              return lastCustomer;
         public Customer getNextCustomer()throws SQLException{
              Customer nextCustomer ;
              if (rs.next()){
                   nextCustomer = loadCustomer();
              else{
                   nextCustomer = null;
              return nextCustomer;
         public Customer getPreviousCustomer()throws SQLException{
              Customer previousCustomer;
              if (rs.previous()){
                   previousCustomer = loadCustomer();
              else
                   previousCustomer = null;
              return previousCustomer;
         public Customer findCustomer(int inCustNum) throws SQLException{
              Customer foundCust;
              if (inCustNum==0){
                   foundCust = getFirstCustomer();
              else{
                   stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   rs = stmt.executeQuery("select customer_id,customer_name,address1,address2,town,county,post_code,country,fax,telephone,contact_name,email from customer where customer_id = "+inCustNum);
                   if (rs.next()){
                        foundCust = loadCustomer();
                   else
                        foundCust = null;
              return foundCust;
         public Customer addCust()throws SQLException{
              Statement stmt2 = con.createStatement();
              ResultSet rsadd = stmt2.executeQuery("select custid.nextval from dual");
              rsadd.next();
              int id = rsadd.getInt("nextval");
              rsadd.close();
              stmt2.close();
              Customer newCust = new Customer(id);
              return newCust;
         public Customer saveCustomer(Customer inSaveCust)throws SQLException{
              Statement stmt3 = con.createStatement();
              int rowNum;
              //int incid = inSaveCust.getCid();
              if (inSaveCust.isNewCustomer()){
                   stmt3.executeUpdate("insert into customer values ("
                   +inSaveCust.getCustomer_id()
                   +",'"+inSaveCust.getCustomer_name()
                   +"','"+inSaveCust.getAddress1()
                   +"','"+inSaveCust.getAddress2()
                   +"','"+ inSaveCust.getTown()
                   +"','"+ inSaveCust.getCounty()
                   +"','"+inSaveCust.getPost_code()
                   +"','"+inSaveCust.getCountry()
                   +"','"+inSaveCust.getFax()
                   +"','"+ inSaveCust.getTelephone()
                   +"','"+inSaveCust.getContact_name()
                   +"','"+inSaveCust.getEmail()+"')");
                   inSaveCust = getFirstCustomer();//refreshes list after insert
                   inSaveCust = getLastCustomer();// goes to the inserted record ie last one
              else {
                   rowNum = rs.getRow();//traps the record number so can be returned to
                   stmt3.executeUpdate("update customer set customer_name = '"+inSaveCust.getCustomer_name()
                   + "', address1 = '"+inSaveCust.getAddress1()
                   + "', address2 = '"+inSaveCust.getAddress2()
                   + "', town = '"+ inSaveCust.getTown()
                   + "', county = '"+ inSaveCust.getCounty()
                   + "', post_code = '"+inSaveCust.getPost_code()
                   + "', telephone = '"+inSaveCust.getCountry()
                   + "', fax = '"+inSaveCust.getFax()
                   + "', country = '"+inSaveCust.getTelephone()
                   + "', contact_name = '"+inSaveCust.getContact_name()
                   + "', email = '"+inSaveCust.getEmail()
                   +"' where customer_id = "+inSaveCust.getCustomer_id());
                   inSaveCust = getFirstCustomer();
                   rs.absolute(rowNum); // points back to same record number as updated
                   inSaveCust = loadCustomer();
              con.commit();
              return inSaveCust;
         public boolean isFirst() throws SQLException{
              return rs.isFirst();
         public boolean isLast() throws SQLException{
              return rs.isLast();
         public Customer loadCustomer ()throws SQLException{
              Customer cust = new Customer(rs.getInt("customer_id"),rs.getString("customer_name"),rs.getString("address1"),
                             rs.getString("address2"),rs.getString("town"),rs.getString("county"),
                             rs.getString("post_code"),rs.getString("country"),rs.getString("fax"),
                             rs.getString("telephone"),rs.getString("contact_name"),rs.getString("email"));
              return cust;
    CUSTOMERFORM CLASS
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.util.*;
    public class CustomerForm extends JFrame implements ActionListener {
    private Customer currentCustomer;
    private CustomerList inCustomerList;
    private JPanel panel;
    private JTextField textCustomer_id,textCustomer_name,textAddress1,textAddress2,textTown,
         textCounty,textPost_code,textCountry,textTelephone,textFax,textContact_name,textEmail,textFind;
    private JButton nextCust, prevCust,firstCust,lastCust,newCust,
         findCust,add,save,delete,jobs,close;
         public CustomerForm(CustomerList inC)throws SQLException{
              inCustomerList = inC;
              currentCustomer = inCustomerList.getFirstCustomer();
              displayForm();
              displayFields();
              setTextFields();
              displayButtons();
              getContentPane().add(panel);
              setVisible(true);
         public void displayForm() throws SQLException{
              setTitle("Customer Form");
              setSize(700,500);
              // Center the frame
              Dimension dim = getToolkit().getScreenSize();
              setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
              getContentPane().setLayout(new BorderLayout());
              Border etched = BorderFactory.createEtchedBorder();
              panel = new JPanel();
              panel.setLayout( null );
              Border paneltitled = BorderFactory.createTitledBorder(etched,"");
              panel.setBorder(paneltitled);
         public void displayFields() throws SQLException{
              int x = 10;
              int y = 50;
              int textheight = 20;
              int textwidth = 150;
              int labelwidth = 110;
              int ydist = textheight + 10;
              int xdist = textwidth*2;
              JLabel labelCustomer_id = new JLabel("Customer Number:");
              labelCustomer_id.setBounds( x, y, labelwidth, textheight);
              panel.add(labelCustomer_id);
              JLabel labelCustomer_name = new JLabel("Customer Name:");
              labelCustomer_name.setBounds(xdist, y, labelwidth, textheight);
              panel.add(labelCustomer_name);
              JLabel labelAddress1 = new JLabel("Address 1:");
              labelAddress1.setBounds( x, y+ydist, labelwidth, textheight);
              panel.add(labelAddress1);
              JLabel labelAddress2 = new JLabel("Address 2:");
              labelAddress2.setBounds( xdist, y+ydist, labelwidth, textheight);
              panel.add(labelAddress2);
              JLabel labelTown = new JLabel("Town:");
              labelTown.setBounds(x, y+ydist*2, labelwidth, textheight);
              panel.add(labelTown);
              JLabel labelCounty = new JLabel("County:");
              labelCounty.setBounds(xdist, y+ydist*2, labelwidth, textheight);
              panel.add(labelCounty);
              JLabel labelPost_code = new JLabel("Post Code:");
              labelPost_code.setBounds(x, y+ydist*3, labelwidth, textheight);
              panel.add(labelPost_code);
              JLabel labelCountry = new JLabel("Country:");
              labelCountry.setBounds(xdist, y+ydist*3, labelwidth, textheight);
              panel.add(labelCountry);
              JLabel labelTelephone = new JLabel("Phone:");
              labelTelephone.setBounds(x, y+ydist*4, labelwidth, textheight);
              panel.add(labelTelephone);
              JLabel labelFax = new JLabel("Fax:");
              labelFax.setBounds(xdist, y+ydist*4, labelwidth, textheight);
              panel.add(labelFax);
              JLabel labelContact_name = new JLabel("Contact Name:");
              labelContact_name.setBounds(x, y+ydist*5, labelwidth, textheight);
              panel.add(labelContact_name);
              JLabel labelEmail = new JLabel("E-mail address:");
              labelEmail.setBounds(xdist, y+ydist*5, labelwidth, textheight);
              panel.add(labelEmail);
              JLabel labelFind = new JLabel("Customer Number Search:");
              labelFind.setBounds( 40, 360, 200, textheight);
              panel.add(labelFind);
              textAddress1 = new JTextField();
              textAddress1.setBounds(x+labelwidth, y+ydist, textwidth, textheight);
              panel.add(textAddress1);
              textAddress2 = new JTextField();
              textAddress2.setBounds(xdist+labelwidth, y+ydist, textwidth, textheight);
              panel.add(textAddress2);
              textTown = new JTextField();
              textTown.setBounds(x+labelwidth, y+ydist*2, textwidth, textheight);
              panel.add(textTown);
              textCounty = new JTextField();
              textCounty.setBounds(xdist+labelwidth, y+ydist*2, textwidth, textheight);
              panel.add(textCounty);
              textPost_code = new JTextField();
              textPost_code.setBounds(x+labelwidth, y+ydist*3, textwidth, textheight);
              panel.add(textPost_code);
              textCountry = new JTextField();
              textCountry.setBounds(xdist+labelwidth, y+ydist*3, textwidth, textheight);
              panel.add(textCountry);
              textTelephone = new JTextField();
              textTelephone.setBounds(x+labelwidth, y+ydist*4, textwidth, textheight);
              panel.add(textTelephone);
              textFax = new JTextField();
              textFax.setBounds(xdist+labelwidth, y+ydist*4, textwidth, textheight);
              panel.add(textFax);
              textContact_name = new JTextField();
              textContact_name.setBounds(x+labelwidth, y+ydist*5, textwidth, textheight);
              panel.add(textContact_name);
              textEmail = new JTextField();
              textEmail.setBounds(xdist+labelwidth, y+ydist*5, textwidth+50, textheight);
              panel.add(textEmail);
              textFind = new JTextField();
              textFind.setBounds(200, 360, 80, textheight);
              panel.add(textFind);
              textCustomer_id = new JTextField();
              textCustomer_id.setBounds(x+labelwidth, y, textwidth, textheight);
              panel.add(textCustomer_id);
              textCustomer_name = new JTextField();
              textCustomer_name.setBounds(xdist+labelwidth, y, textwidth+50, textheight);
              panel.add(textCustomer_name);
              public boolean delete() {
              textCustomer_id.setText("");
              textCustomer_name.setText("");
              textAddress1.setText("");
              textAddress2.setText("");
              textTown.setText("");
              textCounty.setText("");
              textPost_code.setText("");
              textCountry.setText("");
              textTelephone.setText("");
              textFax.setText("");
              textContact_name.setText("");
              textEmail.setText("");
              textFind.setText("");
              return true;
         public void displayButtons(){
              firstCust= new JButton("FIRST");
              firstCust.addActionListener(this);
              firstCust.setBounds(50, 430, 100, 20 );
              panel.add( firstCust );
              nextCust = new JButton("NEXT");
              nextCust.addActionListener(this);
              nextCust.setBounds(150, 430, 100, 20 );
              panel.add( nextCust );
              prevCust = new JButton("PREVIOUS");
              prevCust.addActionListener(this);
              prevCust.setBounds(250, 430, 100, 20 );
              panel.add( prevCust );
              lastCust= new JButton("LAST");
              lastCust.addActionListener(this);
              lastCust.setBounds(350, 430, 100, 20 );
              panel.add( lastCust );
              findCust= new JButton("FIND");
              findCust.addActionListener(this);
              findCust.setBounds(350, 360, 100, 20 );
              panel.add( findCust );
              add = new JButton("ADD");
              add.addActionListener(this);
              add.setBounds(150, 400, 100, 20 );
              panel.add( add );
              save = new JButton("SAVE");
              save.addActionListener(this);
              save.setBounds(250, 400, 100, 20 );
              panel.add( save );
              jobs = new JButton("JOBS");
              jobs.addActionListener(this);
              jobs.setBounds(550, 360, 100, 20 );
              panel.add( jobs );
              close = new JButton("CLOSE");
              close.addActionListener(this);
              close.setBounds(550, 430, 100, 20 );
              panel.add( close );
              delete = new JButton("DELETE");
              delete.addActionListener(this);
              delete.setBounds(350, 400, 100, 20 );
              panel.add( delete );
         public void getTextFields(){
              currentCustomer.setCustomer_id(Integer.parseInt(textCustomer_id.getText()));
              currentCustomer.setCustomer_name(textCustomer_name.getText());
              currentCustomer.setAddress1(textAddress1.getText());
              currentCustomer.setAddress2(textAddress2.getText());
              currentCustomer.setTown(textTown.getText());
              currentCustomer.setCounty(textCounty.getText());
              currentCustomer.setPost_code(textPost_code.getText());
              currentCustomer.setCountry(textCountry.getText());
              currentCustomer.setFax(textFax.getText());
              currentCustomer.setTelephone(textTelephone.getText());
              currentCustomer.setContact_name(textContact_name.getText());
              currentCustomer.setEmail(textEmail.getText());
         public void setTextFields() throws SQLException{
              textCustomer_id.setText(String.valueOf(currentCustomer.getCustomer_id()));
              textCustomer_id.setEditable(false);
              textCustomer_name.setText(currentCustomer.getCustomer_name());
              textAddress1.setText(currentCustomer.getAddress1());
              textAddress2.setText(currentCustomer.getAddress2());
              textTown.setText(currentCustomer.getTown());
              textCounty.setText(currentCustomer.getCounty());
              textPost_code.setText(currentCustomer.getPost_code());
              textCountry.setText(currentCustomer.getCountry());
              textFax.setText(currentCustomer.getFax());
              textTelephone.setText(currentCustomer.getTelephone());
              textContact_name.setText(currentCustomer.getContact_name());
              textEmail.setText(currentCustomer.getEmail());
         public void actionPerformed(ActionEvent e) {
         Object source = e.getSource();
         try {
         if (source == nextCust)
         currentCustomer = inCustomerList.getNextCustomer();
         else if (source == prevCust)
         currentCustomer = inCustomerList.getPreviousCustomer();
         else if (source == findCust) {
         try {
         currentCustomer =
         inCustomerList.findCustomer(Integer.parseInt(textFind.getText()));
         catch (NumberFormatException ex) {
         JOptionPane.showMessageDialog(
         null, "Invalid Customer number", "ERROR",
         JOptionPane.ERROR_MESSAGE);
         if (currentCustomer == null) {
         JOptionPane.showMessageDialog(null, "Customer not found");
         currentCustomer = inCustomerList.getFirstCustomer();
         textFind.setText(null);
         else if (source == firstCust)
         currentCustomer = inCustomerList.getFirstCustomer();
         else if (source == lastCust)
         currentCustomer = inCustomerList.getLastCustomer();
         else if (source == add) {
         currentCustomer = inCustomerList.addCust();
         add.setEnabled(false);
         else if (source == delete) {
                        delete();
         else if (source == save) {
         add.setEnabled(true);
         getTextFields();
         currentCustomer = inCustomerList.saveCustomer(currentCustomer);
         //else if (source == jobs) {
         // JFrame newJobForm = new JobForm(currentCustomer.getJobList());
         //else if (source == delete) {
                   //          setTextFields == null;
         else if (source == close) {
         dispose();
         setTextFields();
         nextCust.setEnabled(!inCustomerList.isLast());
         prevCust.setEnabled(!inCustomerList.isFirst());
         firstCust.setEnabled(!inCustomerList.isFirst());
         lastCust.setEnabled(!inCustomerList.isLast());
         catch (SQLException ex) {
         System.out.println("Failed");
         System.out.println(ex.getMessage());
         ex.printStackTrace();
         System.exit(-1);
    THANKS A LOT TO WHO EVER THINKS THEY CAN DO THIS!!!

    Hi Pcrighton:
    Is this a trick question?
    If you already knew how to trap the delete button, why can't you find out the record associated with the current customer and use Oracle SQL DELETE to delete that record from the table (assuming that user has permission to delete records from the database).
    I don't have Oracle on my PC (have Oracle 7 on my RS/6000 but it's not hooked up to the network, also Java wasn't installed on that machine) so I can't show you anything.
    V.V.

  • Do you think that liquipel is good for an iPhone 4s

    IS it a good Idea to send my iPhone 4s to liquipel

    It seems okay, but if your phone breaks due to water damage or in general, it won't be covered by the standard warranty, unless you purcahse AppleCare+

  • So you think you are an Java uber-geek? Then figure this one out. . .

    Ok, uber-Java geeks, let's see if you can figure this one out. It' s butt-ugly and got me totally stumped.
    This is in a Tomcat 5.5 environment.
    I have a jsp (hierarchy.jsp) which has static nested class called MgmtAuthBean. This hierarchy.jsp creates a TreeMap object which contains instances of the static nested class, MgmtAuthBean. So, after compilation of the hierarchy.jsp, I end having 2 jsp's:
    hierarchy_jsp.java <==== original jsp
    hierarchy_jsp$MgmtAuthBean.java <==== nested static class jsp
    Ok, easy to understand so far. . .now for the rub. . .
    The hierarchy_jsp.java then saves the TreeMap object in a session.
    Another servlet (ExcelServlet) then accesses this saved session object, but in the process of reconstituting the TreeMap object, it requires access to the nested static class hierarchy_jsp$MgmtAuthBean.java.
    The problem is that ExcelServlet craters because it can't find hierarchy_jsp$MgmtAuthBean.java in order to reconstitute the TreeMap object.
    Since jsp's are dynamically created when called, how do I point either the Tomcat container or ExcelServlet to hierarchy_jsp$MgmtAuthBean.java?
    For reason's too stupid to explain, I can't get rid of the static nested class, so I have to figure out how to make this work. . .
    :)

    Tomcat provides a utility for pre-compiling JSP into Servlet class files. This can also be done in ANT. You can precompile the JSP which will create the inner class file and then compile the Java files that need the inner class file. It may take some tweaking to get all of the classes to compile in the correct order.
    A possible alternative is t have the inner class implement an interface. the hierarchy_jsp can then refer to the contents of the TreeMap as instances of the interface instead of as instances of the inner class.

Maybe you are looking for

  • Premiere CS4 - Encoding with AME ridiculously slow

    Hello there. After having read many threads on various forums, I have not come to a single hint as to why AME is encoding any type of video materal extremely slow. I'm sorry if this question has been asked many times on this forum, but maybe someone

  • Re: Acer Aspire Switch 10 - Proprietary Charging Port to micro-USB adapter

    I have a high power power bank capable of charging via both usb and 19v. Included were adapter cables that fit many devices that don't charge via usb. However none fit an acer switch 12.Any ideas?

  • 6i installs ok? but no 8i database created?

    We are updating our oracle system. Clean install on a P4 with Win XP pro. 9i personal database rel 2 installed in OraHome92. 9i appears to be running ok. This will be used to develop against. 6i Internet Developer was then installed in oracle homes O

  • Wrong Color Mode unable to import?

    I shot over 700 RAW images using sRGB Color Space rather than Adobe RGB.  When I attempt to import the images into Lightroom I get a message:  "The following files were not imported.  The files use an unsupported color mode".  Can someone assist me i

  • Outputing member names & aliases from an outline

    Is there a easy way to export member & alias info. If I open an outline, I can do a copy and paste, but only the member names themselves get copied, no alias info. Is there an easy way to do this.