Java course litterature choice

Hello fellow Archers!
I'm heading for uni this autumn to study Software Engineering.
And my first coarse is on Java and I've had some troubles locating the books
other than on e-shops. Which makes it hard to get a good impression about the
books, so I've turned to my fellow archers in hope that someone here has
used any of these books and can give me an opinion (:
o  David J. Barnes and Michael Kölling, Objects First with Java; a
practical introduction using BlueJ, third edition, isbn 0-13-197629-
X, Prentice Hall, 2006. (2nd edition is also usable, but 3rd edition is
preferred).
o  John Lewis, William Loftus, Java Software Solutions: Foundations of
Program Design: International Edition, 6/E, 0321549341 
o  Walter Savitch, Absolute Java: International Edition, 3/E,
0321505042
o  Y. Daniel Liang, Introduction to Java Programming, Comprehensive:
International Edition, 7/E, 013605966
Since I've dabbled with Java in school some years ago, and been doing some
other programming since I don't really need one that is first and foremost targeted to
non-programmers but more for a book that I can have on my shelf/desk most of my
time during my first year of uni.
Thanks on beforehand!
-- Sebastian

sekre wrote:How is the book in terms of source code examples are there many/few, practical/strictly theoretical ?
The book I had in High School were totally useless in terms of source code examples so you basically had to have a second book simply to look at some examples. Was kinda a bummer for our teacher
I think there are a lot of examples. Not like on every page but definitely every other page. As far as how practical the examples are, I guess they get the point across of whatever he's trying to show .. they are fairly understandable.
sekre wrote:How are the exercises if any in the book? Short and relevant or requiring more problem solving than `Hello World`-ish exercises?
every chapter has exercises at the end (with solutions). They range from conceptual questions to actual programming assignments. There's a companion website that has solutions to the bigger coding problems. I've never really done any of them as the course that used the book had custom problems and didn't take the ones from the book.
sekre wrote:And last question, at the beginning of new chapters do they early introduce you to some sourcecode for that specific chapter or do you have to read through 5-10 pages before you actually see some relevant code?  (Strongly prefer to see an implementation early since it helps me understand what I read)
as far as Savitch's book is concerned, he usually dives right in with text in the beginning followed immediately by either diagrams or actual source code to illustrate what's going on.
Like I said, I liked that book a lot and it's not "dry" or anything like that.
There's nothing about reflection in this book and general design patterns are not really covered at all.
I guess it does what it's supposed to do, i.e. get you started with Java(introduce you classes, methods, generics, exceptions, collections)
this might help.. these are the chapters w/ page numbers where they start
Ch. 01 - getting started 1
Ch. 02 - console input and output 57
Ch. 03 - flow of control 93
Ch. 04 - defining classes I 163
Ch. 05 - defining classes II 247
Ch. 06 - arrays 333
Ch. 07 - inheritance 413
Ch. 08 - polymorphism and abstract classes 467
Ch. 09 - exception handling 507
Ch. 10 - file i/o 561
Ch. 11 - recursion 633
Ch. 12 - uml and patterns 671
Ch. 13 - interfaces and inner classes 693
Ch. 14 - generics and the arrayList class 739
Ch. 15 - linked data structures 783
Ch. 16 - collections, maps and iterators 881
Ch. 17 - swing I 923
Ch. 18 - swing II 1001
Ch. 19 - java never ends... 1065

Similar Messages

  • I would like to know which Sun Cert Java Course I should take ???

    I am a very good C programmer that is trying to learn Java programming.
    I know my way around all the various programming statements such as if-then-else, switch etc etc ...
    I know the basics of an Applet and a Stand Alone application ...
    I feel that I need some grounding on OO Technology ...
    I would like to learn JAVA from where I am ...
    I have also been reading up a lot on Java Programming lately ...
    I am more of an Intermediate programmer ...
    I have seen the Sun Certified Java courses web page and is quite confused by the many assortment of courses available ...
    I would like to ask which Java Course is right for me at my level of programming experiences ???
    Thanks in advance !!!
    Andy

    My limited understanding is that there are two main tests you can go for. The first is the Programmer certification, which tests your knowledge of the Java language itself, so you're asked questions about very specific things about the language syntax and such. I think these questions are stupid, because they serve no practical purpose, and some questions are more of a test of your memory.
    Then you can take the Developer certification, which is focused more on evaulating and writing programs.
    I haven't taken either, but there are some good resources for preparing for these tests.
    http://www.javaprepare.com/quests/test.html

  • I would like to know which Sun Cert JAVA Course should I take ???

    I am a very good C programmer that is trying to learn Java programming.
    I know my way around all the various programming statements such as if-then-else, switch etc etc ...
    I know the basics of an Applet and a Stand Alone application ...
    I feel that I need some grounding on OO Technology ...
    I would like to learn JAVA from where I am ...
    I have also been reading up a lot on Java Programming lately ...
    I am more of an Intermediate programmer ...
    I have seen the Sun Certified Java courses web page and is quite confused by the many assortment of courses available ...
    I would like to ask which Java Course is right for me at my level of programming experiences ???
    Thanks in advance !!!
    Andy

    www.jcert.org has the information laid out a little better. I picked up Java without a formal course and I had about the same specs as you (although I had done a fair amount of c++ work). I would suggest the Java book by van der Linden (I know I'm not spelling the name right). I think it's called Just Java 2. Also Thinking in Java by Eckel has gotten good recommendations. For exam prep, the Exam Cram book by Brogden is highly recommended, but it won't teach you OO.

  • Online Java courses ?

    Folks,
    Does anyone know of a good online Java course where there are server resources available for uploading servlets and connecting to database, etc. and testing them in a client/server environment ?
    Some of the tutorials are great, but you need a server to test with...unless of course there is something I can install to simulate a client/server environment.
    Thanks,
    Bob

    All you have to do to test servlets is to install a web server (that supports servlets) on your machine, Tomcat is the most widely used and it's free.
    Then you can start the server and go to the local url with your browser (http://localhost:8080) and you have a complete client-server environment on your machine.

  • Do week-long java courses help to understand java &  get a job?

    i tried searching for this topic before posting, but "courses" "classes" & "instruction" come up with a lot that has nothing to do with the topic at hand. :)
    like many others, i'm teaching myself out of a book (Deitel). so far i've been able to understand the material and create programs based on the exercises. however, i'm now into the meat of OOP with superclass, subclasses, how they interact and the like and i'm having a rough go of it. i can diagram and understand the abstract concept, but when i'm faced with an actual program example i have a difficult time following the interactions between classes.
    i'm considering taking one of those 5 day classes, but am wary of how much they will actually be able to cover in detail (not to mention the $$). has anyone here taken one of those classes and found them to be of great benefit to learning the OOP portion of Java? did it give you enough understanding to obtain an entry-level job?
    btw, i'm doing a pro bono project for a small company to get some real world experience. (i've heard that suggestion many times in regards to obtaining one's "experience" w/o a job)
    thank you all very much for your help.

    I took a week long course to learn Java. It worked I did learn the basics of Java but I did already know how to program in C and VB at the time. I found the AWT section of the class to be very valuable,cosidering I mostly write GUI. And the concepts of AWT mostly all apply to swing so that didn't set me back at all. Depending on the school it may help you to understand OOP. But be careful because most schools progress the class at the skill level of the majorty. So if you have 15 people in the class and 9 of them know nothing about programing your probably going to spend the week learning what a variable and a while loop do, you all pay the same tuition and they would rather 6 of you leave then 9 of you leave. If you have some prior programming knowledge I would recomend finding a class that caters to that.

  • Help with java course

    hello i'm a new java student and i am a bit stuck ,
    the question i am set is this :-
    Design and write a program which prompts a user to enter a sequence of 10 integers which are summed and the total displayed. IF the user imputs a negative number it is ignored i.e. the running total is not updated. the user wil not beable to imput any more then 10 numbers even if some of then are negative numbers.
    this is what i have so far,
    import java.io.*;
    class Course_io
    public static void main(String[] ars)
         throws IOException
         int num,Number_Count=0, Total_Count=0;
         System.out.println("imput a number");
         num = Course_io.readint();
         while(Number_Count<10)
              if (num>0)
              Number_Count = Number_Count + 1;
              else
              Number_Count = Number_Count + 1;
              Total_Count = Total_Count + num;
         System.out.println("imput a number");
         num = Course_io.readint();
         System.out.println("The Total was" + Total_Count);
    course_io is this (it was provided by my course):-
    import java.io.*;
    public class Course_io {
         public static int readlnt()
              throws java.io.IOException
              DataInputStream str = new DataInputStream(System.in);
              String input;
              int res = 0;
              Integer num = new Integer(res);//create integer object
              input = str.readLine();//read input and return a string
              return num.parseInt(input);//convert String to an int and return
              }// end of read method
         }//end of class number
    i don't want you to tell me the answer just give me a few hintas and a push in the right direction.
    thanks in advance
    Anthony

    i tryed this,
    import java.io.*;
    class Course
    public static void main(String[] ars)
         throws IOException
         int num,Number_Count=0, Total_Count=0;
         do{
         System.out.println("imput a number");
         num = Course_io.readlnt();
         if (num<0)
                   Number_Count = Number_Count + 1;
                   Total_Count = Total_Count + num;
                   else
                   Number_Count = Number_Count + 1;
         while(Number_Count<10)//supost to be less then 10 but need to do loop first
         System.out.println("imput a number");
         num = Course_io.readlnt();
         System.out.println("The Total was " + Total_Count);
    but ended up with loads of errors, the program as it is won't sum the nuimberes entered
    any help would be great
    thanxs
    anthony

  • Java course on a Mac

    Can i take this course using a Mac?

    Your Model & Other Details profile information says iMac G5/Intel. If you mean to say you have both an iMac G5 and Intel that's one thing that could be clearer. If you think iMac G5s are Intel, you are mistaken. There is this user tip that explains the difference as it relates to Mac OS X 10.6 compatibility:
    http://discussions.apple.com/thread.jspa?threadID=2126451
    And thus how it relates to Java compatibility:
    http://developer.apple.com/library/mac/#technotes/tn2002/tn2110.html
    That said, if your machine is 10.6 compatible, and not able to run with the latest Java the application, you can run Windows on your machine using one of these solutions*:
    http://www.macmaps.com/macosxnative.html#WINTEL
    without a speed hit. Some older solutions are available to G5 machines, but they are harder to find and significantly slower when running Windows.
    Apple has no "conflict" with Java. It is Microsoft which does. Java was designed as a platform agnostic system. Microsoft corrupted it by adding ActiveX plugins which only run in Windows. Microsoft won't port ActiveX to the Mac. So your tech's viewpoint that Apple has a conflict with Java is only saving their own skin, because they probably don't want to learn the open system that Java is.
    - * Links to my pages may give me compensation.
    Message was edited by: a brody

  • Java courses ???

    I am a BSc., CS graduate with 85% marks.I am interested and am decided to commit myself to Java Programming. But I am confused over which courses to study and also from which institute in south india,Chennai?
    Because every other institute is boasting of mastery in Java and other popular packages, but at the same time there seems to be lack of faculties, even in the reputed organisations like NIIT,APTECH etc..(I have a personal experirence of this in NIIT,when I did my GNIIT Program there was five different faculties in five months, can you believe this?) Also at the time of joining , most of the institutes promise to provide/arrange jobs at reputed companies like TCS, INFOSYS etc... and at the end of the day they simply ignore those promises.
    Hence PLEASE PLEASE SOME BODY HELP ME IN THIS REGARD. I desperately want to learn and master the java programming, and I will forever be gratefull if somebody provide me the accurate detail of from where I can learn java honestly in chennai ,tamil nadu,india.

    you can be like me... get a BFA in Graphic Design and learn Java on your own. It's been working for me for the last 9 years.

  • Java IDE's - Choices, choices, choices.

    Hey, I'm new to java and I hate having to program with notepad. So I got myself a trial version of Borland JBuilder. Boy, was that a bad experience. What I'm looking for is a simple program to help me get started with Java (auto formatting, pretty colors, etc). Any suggestions?
    Thanks in advance.

    Actually I found JBuilder 6 personal pretty nice.
    You can try Sun's Forte for java community edtion for free.
    You can take Visual Cafe for a spin - which is nice too.
    http://www.webgain.com/products/visual_cafe/
    and you can just use ultra edit with a java extention - just for editing - not compiling and stuff.
    http://www.ultraedit.com/downloads/index.html.
    And don't bother with VJ++ it really sucks.

  • Taking a Java Course, but Compile is not an Option

    am taking a class with UoPO and we use TextPad to do our Java assignments. I have both the latest version of TP, and the latest version of JDK, however, I do not have the option to compile. Can I get some guidance on the matter. If it matters,I am using VISTA 64-Bit. I have a team assignment due for review today and an individual assignment due Monday before we go on holiday. Any help would be appreciated.

    C.E.Moore wrote:
    Thank you for attempting to help, but I discovered the answer for myself. I'm not sure if Vista 64-Bit had anything to do with it, but I discovered that in order to copile and then run, I had to save the program in the JDK bin folder where the Java tools are. I don't know why, but I did. Every instruction I ever read simply said to save the program to my computer. It never specified to save it in the same folder as the compiler. This may be common sense to many, but not to someone who has never written program before.
    I seriously doubt that explains why it didn't show up in the menu.

  • Java Development Kit Choice

    Hi all,
    I'm in a situation where I have to make a decision on which Java DK should be installed on multiple computers in an educational setting. I want the students to use a text editor+command prompt to learn, but it would be nice to have the option to use an IDE later on, especially for students with more experience.
    My question is, if we are going to be predominantly using the text editor+command prompt combination, is there any disadvantage besides using more disk space to installing the "JDK 6 Update 7 with NetBeans" versus simply "JDK 6 Update 7".
    Thanks for your help!
    Edited by: Ravloo on Sep 2, 2008 6:55 PM

    My question is, if we are going to be predominantly using the text editor+command prompt combination, is there any disadvantage besides using more disk space to installing the "JDK 6 Update 7 with NetBeans" versus simply "JDK 6 Update 7".By installing the combination ( JDK plus NetBeans) you cause tighter linking between the two, and the potential for more installation problems. It used to be (and may have now changed) that you couldn't update one of the two when the combination wsa installed - it required both be replaced.
    I always install the Java JDK version I want, and then install the NB version I want, separately.

  • Beginning java programming in a course from home

    hi, i've recently started working on a java course, learning from home and am a bit stuck on what it all means really as my level of english isnt very good.
    it says i have to write a class to represent a calendar date, and then write a program that instantiates 2 of these date objects, initializes their member variables and print them out.
    Would someone please be abel to help me with an example of this,
    I would be so grateful!!!
    from
    waynemorgan86

    not compiled... not unit tested... but commented to the beejeepers.
    //DateStringExample is an example of a simple java class. It creates two dates,
    //initialises their member variables, and prints both values.
    class DateStringExample
         //the DateString class encapsulates all the variables and methods which
         //enable is to store a date as a String, and retrieve it again.
         private String DateString {
              //a "member" variable... note that it is private meaning that it is
              //visible only within the DateString class... so other classes can't
              //see it, allowing you to restrict access to this value, and validate
              //value when it is "stored".
              private String date;
              //a default contructor ("no arg" constructor) nb: if you don't
              //specify a default contructor java creates an empty one for you.
              DateString() {
                   //set the value of the date variable in this instance of the DateString
                   //class to todays date, which is the default value of a Date object.
                   this.date = (new Date).toString;
              //a "setter contructor" allows you to create a new DateString and
              //set it's value in one easy move.
              DateString(String date) throws Exception {
                   setDate(date);
              //a "setter" validates the supplied value and sets the member variable.
              void setDate(String date) throws Exception {
                   if (date = null) throw Exception("null date");
                   try {
                        Date tmp = DateFormat.parse(date);
                   } catch ( ParseException e ) {
                        throw new Exception("invalid date " + date, e);
                   this.date = date;
              //a "getter" returns the current value of the member variable.
              DateString getDate() {
                   return(this.date);
         //this is the special main method which java run's automatically when
         //you run the "program"
         public static void main(String[] argv)
              try {
                   //get me an instance of a DateString called today, which contains
                   //todays date (as a string);
                   DateString today = new DateString();
                   //get me another instance of a DateString called today, which contains
                   //tomorrowsa date
                   DateString tomorrow = new DateString("2006-09-20 12:46:00");
                   //output the two values
                   System.out.println("today is "+today+" and tomorrow is "+tomorrow);
                   //try to set tommorow to an invalid date, and print again
                   tomorrow.setDate("2006-02-31 00:00:00");
                   System.out.println("today is "+today+" and tomorrow is "+tomorrow);
              //catch any errors, and just report them to the standard error stream.
              } catch (Exception e) {
                   System.err.println(e);
    //NOTES:
    //* This whole class is obviously a complete waste of time, except as
    //      a simple example of a class to newbie java programmers.
    //* The Java language provides a rich featured set of classes for date manipulation.//and a few obvious bugs... hand this in as is and you will fail.
    corlettk: removed dodgy BadDateStringException, I think.

  • Certification In Java Or ABAP Course!?

    Dear Friends
    I've 5 years of experience in Java and now I'd like to get certified  on SAP technologies.Is it possible to tell me which one has more demand on SAP market APAP (courses TAW10,TAW12) or Java (courses JA310,JA320,....)

    Hi,
    As these days SAP is getting more integrated with JAVA technologies, so abviously from the product development perspective JAVA people are required, but yes it is expected from them to have ABAP understanding knowledge as well.
    From certification perspective as already suggested its better fro you to opt for JAVA modules at this point of time as you have plenty of experience on this technology and later on you may go for ABAP if you want.
    Regards,
    Subhash

  • I WANT ENLIGHTMENT IN JAVA

    guys
    ive been fed up with my assignments.i took introductory java course in my first semister(6 months back).I rethink everytime ive to solve something like..say inheritance problems.i should accept that i dnt find enough time to practise java(bad time management right), which is also due to whole lot of material on web,which scares shit of me
    ive 2 more months to go for my final exams.my course involves stuff like gui's,threading,corba,server-client programming,networking stuff...
    can somebody say from their experience how to learn the above java topics in the available time.ahhh like how many hours shud i spend per day,and any sources for learning java better and fast

    As stated the java tutorials are great, but also you have course material that you will be responsible for--I'm sure you have at least 1 book (most of my programming classes had at least 3). So get to reading them.
    How much time you should spend--let me see, most of the engineering classes I had recommend at least 2 hours of work per hour of class; sounds like you are on a semester or trimester schedule so each class is probably 3 hours per week. That should give 6 hours per week of study (minimum recomended per hour of class dosage), you have neglected 6 months of studies so 6(months)*4.5(weeks per month)*6(hours per week) = 162 hours extra over the next 9 weeks. So you have 9*6+162 = 216 hours over the next 9 weeks. That comes out to 24 hours per week or 8 hours per class hour. That should get you up to the point of one of the serious students in the class that has been studying all along.
    So crack open those books, and get the java tutorial, and nimble up those fingers if you're at all serious.
    BTW: it is your choice, the college and industry expect most of the engineering and computer science students to not make it through their courses. That is why they grade on a curve--only the most competitive will survive (now before I'm flamed for this--yes, I realize it is not the prefect way and it does not reflect the best programmers survive--but it is the way it's done).
    You know, I want to be a concert pianist, but not enough to pay the price--think about it: do you want it enough?

  • Info for Info Course

    Sorry, if this post is not useful to you.
    It will only be active for a week or so.
    I accidently took this Java course. I thought it would be a more web page building type course. I never foresee myself ever using Java. I don't know why I can't program for shit. It sucks. I'm supposed to be smart but why can't I program?
    Teacher says we can use java.sun.com for the practical portion of an exam. So I'm posting some useful code ( to me).
    When I'm done, just let this forum die to the bottom of the list.
    But in the meantime, if you need info on elementary Java stuff like GUI's, JDBC, Multithreading, etc., here it is.
    Cheers

    import javax.swing.*;
    import java.awt.*;
    // Generates the first application frame of the program.
    public class CareerAdvisor
    public static void main(String[] args)
         // Create application frame for User and Administrator JButton selections.
    StartFrame f = new StartFrame();
    f.setSize(350,300);
    f.setLocation(340,210);
    f.setVisible(true);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    /* Loads the question panel and contains the buttons for the navigation
    through the 5 question panels. */
    public class CareerAdvisorFrame extends JFrame
         Connection con;
         Statement stmt;
         ResultSet rs;     
         // Accesses the previous question.
         JButton jbPrevious = new JButton("Previous");
         // The user clicks the 'Done' button when she has completed all questions.
         JButton jbDone = new JButton("Done");
         // Accesses the next question.
         JButton jbNext = new JButton("Next");
         int currentQuestion;
         /* There are 5 questions for the user to answer. Each question has its own
         question panel. */
         QuestionPanel[] qP = new QuestionPanel[5];
         /* The CareerAdvisorFrame GUI needs to be put into a container, which is
         activated.*/
         Container c = this.getContentPane();
         // The center panel contains the question.
         JPanel pCenter = new JPanel();
         // The south panel contains the 3 navigation buttons.
         JPanel pSouth = new JPanel();
         JFrame thisFrame;          
         String messageA = "";
         // GUI created.
         public CareerAdvisorFrame()
                   thisFrame = this;
                   currentQuestion = 1;
                   // For each question, a question panel is generated.
                   for (int i = 0; i<5; i++)
                        qP= new QuestionPanel(i+1);
                   /* Specifying Border Layout for the container and the center panel. This
                   is because     the question panel is created in its own class using the Grid
                   Layout for the GUI construction. The south panel is constructed in this
                   class and Grid Layout is used because 1 row of 3 columns is needed for
                   the 3 navigation buttons. */
                   c.setLayout(new BorderLayout());
                   pCenter.setLayout(new BorderLayout());
                   pSouth.setLayout(new GridLayout(1,3));
                   // The 3 navigation buttons are added to the south panel.
                   pSouth.add(jbPrevious);
                   pSouth.add(jbDone);
                   pSouth.add(jbNext);
                   // The question panel is added to the center panel.
                   pCenter.add(qP[0], BorderLayout.CENTER);
                   // The south panel and center panels are added to the container.
                   c.add(pSouth, BorderLayout.SOUTH);
                   c.add(pCenter, BorderLayout.CENTER);
                   /* To listen for mouse clicks on the 3 navigation buttons, action
                   listeners must be added. Then, action handler parameters are passed. */
                   ActionHandler actH = new ActionHandler();
                   jbDone.addActionListener(actH);
                   jbPrevious.addActionListener(actH);
                   jbNext.addActionListener(actH);
         /* The location of the mouseclick is determined. Each of the 3 buttons have
         a specific function to accomplish and so methods are called. */
         public class ActionHandler implements ActionListener
              // The button source of the click is stored in ActionEvent e.
              public void actionPerformed(ActionEvent e)
                   /* If the user clicks 'Next' the next() method is accessed. Different
                   methods are accessed for the 'Previous' and 'Done' buttons. */
                   if (e.getSource() == jbNext)
                        next();
                   else if (e.getSource() == jbPrevious)
                        previous();
                   else if (e.getSource() == jbDone)
                        done();
         /* The current question advances and the next question panel is put into the
         frame with the next question. When question 5 is reached, the 'Next' button
         is disabled because there are no further questions for the user to access.
         The button is enabled for the first 4 questions. The 'Previous' button is
         enabled at start up, even for the first question. This is to give a uniform
         appearance for the user when she first sees the Career Advisor Frame. The
         'Previous' button is also enabled if the current question does not equal 5.*/
         private void next()
              if (currentQuestion < 5)
                   currentQuestion++;
                   if (currentQuestion == 5)
                        jbNext.setEnabled(false);
                        // The panel is being refreshed with the new information.
                        pCenter.validate();
                   else
                        jbPrevious.setEnabled(true);
                        pCenter.validate();
                   // The current question is removed to add the next question.     
                   pCenter.removeAll();
                   pCenter.add(qP[currentQuestion - 1], BorderLayout.CENTER);
                   pCenter.validate();
                   // The next question is physically repainted onto the panel.
                   repaint();
         /* After the current question decreases by one, the previous question panel
         is put into the frame with the previous question. When question 1 is
         reached, the 'Previous' button is disabled, since there is no question
         before the first one. The 'Next' button is enabled, when the current
         question is not equal to 1. */
         private void previous()
              if (currentQuestion > 1)
                   currentQuestion--;
                   if (currentQuestion == 1)
                        jbPrevious.setEnabled(false);
                        pCenter.validate();
                   else
                        jbNext.setEnabled(true);
                        pCenter.validate();
                   // The current question is removed to add the previous question.     
                   pCenter.removeAll();
                   pCenter.add(qP[currentQuestion - 1], BorderLayout.CENTER);
                   pCenter.validate();
                   repaint();
         /* The user's name is being stored in the Career database after the user
         provides it and then the career result is displayed. */
         private void done()
              // The 'Done' button is disabled after the user clicks it once
              jbDone.setEnabled(false);     
              String userName = "";
              /* The user enters his name in the input dialog. If he presses cancel, the
              program will exit. If he enters his name, he will be allowed to view his
              career result.*/
              do
                   userName = JOptionPane.showInputDialog(
                        null,"Please enter your name:", "Career Result Access", 1);
                   if (userName == null)
                        System.exit(0);
              }while (userName.equals(""));
         updateDataBase(userName);
    ColoredJOptionPane c = new ColoredJOptionPane(new Color(255,236,139));
              c.showMessageDialog(null,message, "Career Result", 1);
              // The Career Advisor Frame dies after the user hits 'ok' on the dialog.     
              this.setVisible(false);                    
         // The user's answers and user's name are updated in the Career database.
         private void updateDataBase(String userName)
              String sourceURL = "jdbc:odbc:career";
              String query1 = "SELECT * FROM UserRecord";
              try
                   /* The Microsoft Access Driver is loaded. The program is
                        connecting to the database. The stament object executes SQL
                        statements. */
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con = DriverManager.getConnection(sourceURL);
         stmt = con.createStatement(     ResultSet.TYPE_SCROLL_SENSITIVE,
                                                                                    ResultSet.CONCUR_UPDATABLE);
         /* Querying the UserRecord table of the Career database and storing the
         statement in result set. */                                                                                     
                        rs = stmt.executeQuery(query1);
                        // The result set is moving to insert a row into the table.
                        rs.moveToInsertRow();
              /* Each column, 1-7, of the table is being updated with the user's name
              and each of his 5 answers to the questions. The 7th column is updated
              with the career title, messageA, that was outputted to the user in the
              dialog with the career result. The row is appended at the end of the
              table for these strings to be loaded into. */
              rs.updateString(1, userName);     
              rs.updateString(2, qP[0].getAnswer());
              rs.updateString(3, qP[1].getAnswer());
              rs.updateString(4, qP[2].getAnswer());
              rs.updateString(5, qP[3].getAnswer());
              rs.updateString(6, qP[4].getAnswer());          
              rs.updateString(7, messageA);     
              rs.insertRow();
              // The result set, statement, and database connection are closed.
         rs.close();
         stmt.close();
         con.close();                                                                                
              // Exceptions are declared.
              catch(SQLException sqle)
                   System.err.println("Error creating connection");
         catch(ClassNotFoundException cnfe)
                   System.err.println(cnfe.toString());
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    // A question panel is created. It connects to a database.
    class QuestionPanel extends JPanel
         int questionNumber;
         String answer;
         int numberOfAnswers;
         // The background of the question panel is stored in SwimTiled.jpg.
         ImageIcon icon = new ImageIcon ("SwimTiled.jpg");
         JRadioButton[] rbAnswer = new JRadioButton[12];
         Connection con;
    Statement stmt;
    ResultSet rs;
    /* The question panel reads each of 5 questions stored in the Career
    database. There are 5 queries made for 5 tables, Q1 through Q5. Each question
    has it's own table. */
    public QuestionPanel(int qNum)
              questionNumber = qNum;
              /* Creating a button group allows only one radio button to be clicked per
              question. */
              ButtonGroup bg = new ButtonGroup();
              /* There are 14 rows created for the grid layout. One row is taken up by
              the question, one row for a blank space, and up to 12 rows for 12 radio
              button lines of text. The first question has the maximum number of radio
              buttons, named from 'a' to 'l'. The other questions require less than 12
              radio buttons.*/
              this.setLayout(new GridLayout(14,1));
              String sourceURL = "jdbc:odbc:career";
         String query1 = "SELECT * FROM Q1";
         String query2 = "SELECT * FROM Q2";
         String query3 = "SELECT * FROM Q3";
         String query4 = "SELECT * FROM Q4";
         String query5 = "SELECT * FROM Q5";
              try
              /* The Microsoft Access Driver is loaded. The program is
              connecting to the database. The stament object executes SQL
              statements. */
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con = DriverManager.getConnection(sourceURL);
         stmt = con.createStatement(     ResultSet.TYPE_SCROLL_SENSITIVE,
                                                                               ResultSet.CONCUR_UPDATABLE);
         /* When the qNum, or question number, equals 1, then Q1 is loaded into
         the result set as per query 1. This occurs for queries 2-5 as well.*/                    
              switch (qNum)
                        case 1:
                        rs = stmt.executeQuery(query1);break;
                        case 2:
                             rs = stmt.executeQuery(query2);break;
                        case 3:
                             rs = stmt.executeQuery(query3);break;
                        case 4:
                             rs = stmt.executeQuery(query4);break;
                        case 5:
                             rs = stmt.executeQuery(query5);break;
         // Exception handling
         catch(SQLException sqle)
              System.err.println("Error creating connection");
         catch(ClassNotFoundException cnfe)
              System.err.println(cnfe.toString());
         try
              // The result set proceeds to the next row.
              rs.next();
              /* The first part of the question, the non-radio button part is read
              from the 1st column of the corresponding question table in the
              database and put into a JLabel on the question panel. */
              this.add(new JLabel(rs.getString(1)));
              // This dummy JLabel creates a blank row in the question panel.
              this.add(new JLabel(""));
              // Action Handler created to handle actions on the radio buttons.
              ActionHandler actH = new ActionHandler();
              int k = 0;
              while(rs.next())
                   /* The result set cycles through one of the question tables, Q1-Q5,
                   and reads the radio button parts of the question into the button
                   group and then the question panel until rs.next reveals no new data.
                   These radio button parts are all in column 1 of the database table.
                   An action listener with an action handling parameter is added to the
                   rbAnswer array. */
                   rbAnswer[k] = new JRadioButton(rs.getString(1));
                   bg.add(rbAnswer[k]);
                   this.add( rbAnswer[k]);
                   rbAnswer[k].addActionListener(actH);
                   /* The radio button array is kept visible to see the writing,
                   despite the background. */
                   rbAnswer[k].setOpaque( false );
                   k++;
              numberOfAnswers = k;
         catch(SQLException sqle)
                   System.err.println("Error in read next");
                   /* Allows only some of the question panel to be painted with the
                   background file, not the radio buttons in this case. */
                   this.setOpaque( false );     
         // Returns one of the answers listed in the switch statement below.
         public String getAnswer()
              return answer;
         /* Listening for which radio button is clicked and getting the source of the
         radio button or answer that is clicked. The choice of radio buttons for a
         given question is between 1 and the amount stored in 'numberOfAnswers'.
         The switch statement assigns a particular radio button to a particular
         answer. */
         public class ActionHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   for (int i=0; i < numberOfAnswers; i++)
                        if (e.getSource() == rbAnswer[i])
                                  switch (i)
                                       case 0: answer = "a"; break;
                                       case 1: answer = "b"; break;
                                       case 2: answer = "c"; break;
                                       case 3: answer = "d"; break;
                                       case 4: answer = "e"; break;
                                       case 5: answer = "f"; break;
                                       case 6: answer = "g"; break;
                                       case 7: answer = "h"; break;
                                       case 8: answer = "i"; break;
                                       case 9: answer = "j"; break;
                                       case 10: answer = "k"; break;
                                       case 11: answer = "l"; break;
         // Background image is being painted onto question panel.
         protected void paintComponent(Graphics g)
              // Scale image to size of component.
              Dimension d = getSize();
              g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);
              super.paintComponent(g);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    /* StartFrame and StartFramePanel used to be one class upon initial design.
    Separating them out allows the Panel to be painted with a background icon.
    The container is created and made with border layout. The StartFramePanel
    is put into the StartFrame. */
    public class StartFrame extends JFrame
    Container c = this.getContentPane();
    public StartFrame()
              c.setLayout(new BorderLayout());
              StartFramePanel p = new StartFramePanel();
              // The StartFramePanel is centered in the container with a border layout.
              c.add(p, BorderLayout.CENTER);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    // This class tracks the number of users and their individual data.
    class AdminList extends JFrame
         Connection con;
    Statement stmt;
    ResultSet rs;
    Container c = this.getContentPane();
         /* The information displayed in a frame that is used by the Administrator. The
         information is read from the UserRecord Table in the Career database. */
         public AdminList()
              /* There are 45 rows in the container with a grid layout so that at least
              43 new records can be added to the administrator list. The 1st row contains
              the titles of each column and the 2nd row is a blank line.*/
              c.setLayout(new GridLayout(45,1));
              String sourceURL = "jdbc:odbc:career";
         String query = "SELECT * FROM UserRecord";               
         /* The Microsoft Access Driver is loaded. The program is
    connecting to the database. The stament object executes SQL
    statements. */
              try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con = DriverManager.getConnection(sourceURL);
         stmt = con.createStatement(     ResultSet.TYPE_SCROLL_SENSITIVE,
                                                                               ResultSet.CONCUR_UPDATABLE);
                   rs = stmt.executeQuery(query);
         // Exception statements
         catch(SQLException sqle)
              System.err.println("Error creating connection");
         catch(ClassNotFoundException cnfe)
              System.err.println(cnfe.toString());
              // Adding titles to the 7 columns of the admin list.
              c.add(new JLabel("Name"));
              c.add(new JLabel("Question 1"));
              c.add(new JLabel("Question 2"));
              c.add(new JLabel("Question 3"));
              c.add(new JLabel("Question 4"));
              c.add(new JLabel("Question 5"));
              c.add(new JLabel("Advice"));
              // Create a blank row of 7 empty string columns.
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              try
              int count = 0;
              /* Each row of the UserName table is being read by the result set. The
              1-7 represent the columns being read from the database. */
              while(rs.next())
              count ++;
              c.add(new JLabel(rs.getString(1)));
              c.add(new JLabel(rs.getString(2)));
              c.add(new JLabel(rs.getString(3)));
              c.add(new JLabel(rs.getString(4)));
              c.add(new JLabel(rs.getString(5)));
              c.add(new JLabel(rs.getString(6)));
              c.add(new JLabel(rs.getString(7)));
         /* When the last row of data is reached, rs.next stops. For the
         remaining rows, the for loop uses the counter to add blank lines to the
         Admin List with dummy JLabels. */
         for (int i = count+1; i <= 43; i++)
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
              c.add(new JLabel(""));
         // Exception statements.
         catch(SQLException sqle)
                   System.err.println("Error in read next");
    import java.awt.*;
    import javax.swing.*;
    // Used to color dialog boxes in other classes.
    class ColoredJOptionPane extends JOptionPane
    public ColoredJOptionPane(){}
    public ColoredJOptionPane(Color c)
         // Controls the color of the panel and option pane background in the dialog.
    UIManager.put("OptionPane.background",c);
    UIManager.put("Panel.background",c);
    /* The following line would only be used if we wanted to change the color of
    the buttons in the dialog. */
    // UIManager.put("Button.background",c);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    /* The start frame is the first frame that comes up for the user. Here, he can
    select whether to use the Career Advisor program by clicking the 'User' button
    or see the results of other users by clicking the 'Administrator' button.
    This panel is put into the start frame. */
    class StartFramePanel extends JPanel
         JButton jbUser = new JButton("User");
         JButton jbAdministrator = new JButton("Administrator");
         // This image is placed in the background of the 2 buttons.
         ImageIcon icon = new ImageIcon ("RoseTiled.jpg");     
         /* The frame for the StartFramePanel is created in the CareerAdvisorFrame
         class.*/
    public StartFramePanel()
         /* Since there are only 2 JButtons, the rest of the spaces are made dummy
         labels. There are 5 rows of 3 columns in the grid layout. No container is
         used since a JPanel is used rather than a frame. */
         this.setLayout(new GridLayout(5,3));
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(jbUser);
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(jbAdministrator);
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(new JLabel());
              this.add(new JLabel());
              /* Allows only some of the panel to be painted with the
              background file, not the JButtons in this case. */
              this.setOpaque( false );
              /* An ActionListener is being added to the 2 JButtons, with the action
              handler actH as a parameter being passed.     */
              ActionHandler actH = new ActionHandler();
              jbUser.addActionListener(actH);
              jbAdministrator.addActionListener(actH);
    /* After getting the source of the JButton click event, it is determined
    whether it is the jbUser or the jbAdministrator. In the former case,
    the user() method is called and in the latter, the administrator()
    method is called.*/
    public class ActionHandler implements ActionListener
                   public void actionPerformed(ActionEvent e)
                        if (e.getSource() == jbUser)
                        user();
                        else if (e.getSource() == jbAdministrator)
                        administrator();
              // This method enables the administrator to view the Admin List.
              private void administrator()
                   // Initializing string
                   String password = null;
                   /* A default color of white is used in the dialog. This is denoted by
                   the numbers 255,255,255. */
                   ColoredJOptionPane c = new ColoredJOptionPane(new Color( 255,255,255));
              int count = 0;
              /* If after prompting the individual for the password 4 times, he
              doesn't get it right, then he is shown a message dialog and then
              exited out of the program. */
                   do{
                             if (count>3)
                                  JOptionPane.showMessageDialog(
                                       null, "You have been timed out.", "Incorrect Password", 1);
                                  System.exit(0);
                             /* The administrator is prompted for the correct password
                             in an input dialog. The password is "dcba".*/
                             password =
                                  JOptionPane.showInputDialog(null,"Password:", "Login Screen", 1);
                             // Allows the individual to click 'Cancel' in the dialog.                         
                        if (password == null)
                                  return;
                             count++;
                        }while (!password.equals("dcba"));
                   /* The AdminList Frame is created with specificed size and location,
                   and then made visible. */
                   AdminList f = new AdminList();
    f.setSize(900,650);
    f.setLocation(20,20);
         f.setVisible(true);
              /* This method allows the user to see the Welcome Message and take the
              Career Advisor questionaire. It has the same features of the
              administrator() method. */
              private void user()
                   String password = null;
                   ColoredJOptionPane c = new ColoredJOptionPane(new Color( 255,255,255));
                   int count =0;
                   do
                        if (count>3)
                             JOptionPane.showMessageDialog(
                                  null, "You have been timed out.", "Incorrect Password", 1);
                             System.exit(0);
                        password =
                             JOptionPane.showInputDialog(null,"Password:", "Login Screen", 1);
                        if (password == null)
                             return;     
                        count ++;
                   }while ( !password.equals("abcd") );
         String welcome = "Welcome ";
         // A sky blue color is the background of the dialog.
                   ColoredJOptionPane d = new ColoredJOptionPane(new Color( 176,226,255));
                   /* The string 'welcome' is put into a message dialog. The title on the
                   dialog is 'Career Advising Service'. */
                   JOptionPane.showMessageDialog
                        (null,welcome,"Career Advising Service", 1);
    // The CareerAdvisor frame with the question panel is shown.
    CareerAdvisorFrame frame = new CareerAdvisorFrame();
    frame.setSize(850,400);
    frame.setLocation(55,180);
    frame.setVisible(true);
         // Background image is being painted onto the start panel.
         protected void paintComponent(Graphics g)
              // Scale image to size of component
              Dimension d = getSize();
              g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);
              super.paintComponent(g);

Maybe you are looking for

  • How do you get to verify ID if ICloud won't let the owner in

    I would like to know? As a first time owner of an Apple device, how is it possible to verify your account in your ICloud email address, when you cannot login into it, though I am logged in here and logged into Apple home page that I could get this fa

  • Can't re-shuffle songs

    Lately, I can't get my songs to re-shuffle. According to the card that ships with the Shuffle, all I have to do is "switch off, wait 5 seconds, then switch to shuffle or play". This has no effect whatsoever. The memory of where it left off also no lo

  • Cancellation for 1 line

    .........I am a member account on th efamily plan my son opened about four years ago. I pay the bills however. I added a new line for my new wife recently. My son who first opened th eaccount now wants to terminate his phone service. Since your custo

  • Suddenly turn off when I open the premiere pro cc 2014

    when I open the program just he let me chose the project and after that directly turn off itself. any Help???????? important 12 G DD Ram i7 1G display card

  • Speaker with out Library

    Good Days..... I wanna Ask about when i speak in microphone i want convert to text with out using any library ..? i think there is way for thats Please Help Me as soon Possible (urgent)