Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How do you add GUI to this java program?

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Thanked 0 Times in 0 Posts

    Default How do you add GUI to this java program?

    Ok, I wasn't sure where to post this problem since I don't know if this is classified under the new to java or advanced.

    I know only basic stuff in java. And I need to create a GUI for this type of program. It shows your credit card info. It has some other classes and makes use of the rmiregistry. This works fine in console but I need to show it in a GUI. The first thing that promps here is to enter your name (java Shopper localhost *my name*). Then it shows you your credit card info. Can anyone help me? Please and thank you

    import java.rmi.*;
    import javax.swing.*;
    public class Shopper {
        public static void main(String args[])
            CreditManager cm = null;
            CreditCard account = null;
                System.err.println("java Shopper <server> <accountname>");
                String url = new String("//"+args[0]+"/cardManager");
                System.out.println("Shopper: lookup cardManager, url="+url);
                cm = (CreditManager) Naming.lookup(url);
            }catch(Exception e)
                System.out.println("Error in getting Card Manager "+e);
                account = cm.findCreditAccount(args[1]);
                System.out.println("Found account for "+args[1]);
            }catch(Exception e)
                System.out.println("Error in getting acocunt for "+args[1]);
                	 System.out.println("Available credit is "+account.getCreditLine());
                System.out.println("Changing pin number for account");
                System.out.println("Buying a new watch for $100");
                account.makePurchase(100.0f, 1234);
                System.out.println("Available credit is now "+account.getCreditLine());
                System.out.println("Buying a new pair of shoes for $160");
                account.makePurchase(160.0f, 1234);
                System.out.println("Cardholder: Paying off $136 of balance");
                System.out.println("Available credit is now "+account.getCreditLine());
            }catch(Exception e)
                System.out.println("Transaction error for "+args[1]);
    Last edited by helloworld922; October 13th, 2009 at 06:44 PM.

  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    United Kingdom
    My Mood
    Thanked 293 Times in 226 Posts
    Blog Entries

    Default Re: How do you add GUI to this java program?

    Hey leyla

    Check out the Sun Swing tutorials and create a basic GUI...

    Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    Once you understand the basics you can easily make the GUI for your program.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Convert Java Program to Java ME code
    By rinchan11 in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: October 5th, 2009, 10:18 PM
  2. Help with adjusting a program. NEw to java!!!!!
    By raidcomputer in forum Loops & Control Statements
    Replies: 1
    Last Post: September 27th, 2009, 08:05 PM
  3. Java Messenger Program?
    By MysticDeath in forum Java Networking
    Replies: 1
    Last Post: September 8th, 2009, 11:25 PM
  4. PLEASE HELP!!!! simple java program...
    By parvez07 in forum Object Oriented Programming
    Replies: 5
    Last Post: August 26th, 2009, 06:38 AM
  5. Java Program Help
    By javakid93 in forum Java Theory & Questions
    Replies: 6
    Last Post: July 27th, 2009, 11:03 AM

Tags for this Thread