Basic java problem..

need this program to show each category individually...cant do it at all..been at it a week....must be the && and || signs...i think...plz can someone help me as im really stuck now...thank you so much..
import java.util.Scanner;
public class assignmentquestion3 {
public static Scanner key=new Scanner(System.in);
public static void main(String []args){
int fullfee=800,newfullfee=3800,associatefee=200,newla diesfee= 2350,ladiesfee= 350,under18fee = 175;
int selectcat=0;
int reply = 0;
int addmember=0;
int currentfulltotalmem=0,newfulltotalmem=0,associatet otalmem=0,ladiestotalmem=0,under18totalmem=0;
int assoctotalcash=0,ladiestotalcash=0,under18totalcas h=0;
int fullprepay=150;
int ladiesfull=2500;
int completefull = 0;
int ladiescurrent=500;
int under18=175;
//Main introduction screen for the user and selections available. do while loops only allowing numbers 1,2,3 or 4.
do{
do{
System.out.printf("\n\t %90s","********************Membership Rates For The Golf Club********************");
System.out.printf("\n\n %105s","This program will allow users to enter details of members as well as calculating and.");
System.out.printf("\n%106s","outputing the total amount each member should pay. The program allows users to view the");
System.out.printf("\n%106s","total number of members in each category and the total income for each category.");
System.out.printf("\n\n\t %75s","Please select your membership category: ");
System.out.printf("\n\n\t %68s","Please press '1' for FULL");
System.out.printf("\n\n\t %68s","Please press '2' for ASSOCIATE");
System.out.printf("\n\n\t %68s","Please press '3' for LADIES");
System.out.printf("\n\n\t %68s","Please press '4' for UNDER 18");
System.out.printf("\n\n\t %68s","Please enter 1,2,3 or 4: ");
selectcat=key.nextInt();
}while (selectcat>4 || selectcat<1);
do{
System.out.printf("\n\n\t %75s","Are you a Current Member (press 1) or a New Member (press 2): ");
reply=key.nextInt();
}while (reply<1 || reply>2);
//if number '1' for 'FULL' category is selected by the user and reply is 'yes'(1) then new full member fee is shown to user
if (selectcat==1 ||reply==1)
System.out.printf("\n\n\t %68s","CURRENT FULL MEMBERSHIP SELECTED");
System.out.printf("\n\n\t %68s","Current full membership fees yearly are £"+fullfee+"");
System.out.printf("\n\n\t %68s","Full members must also pre-pay £"+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
System.out.printf("\n\n\t %72s","The total of this membership is: £"+fullfee+"");
currentfulltotalmem=currentfulltotalmem+1;
System.out.printf("\n\n\t %72s","The total number of 'CURRENT FULL MEMBERSHIPS = "+currentfulltotalmem+"");
completefull=completefull+fullfee;
System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = £"+completefull+"");
//if number '1' is selected by the user and reply is 'no' (2) then full member fee is shown to user
else if (selectcat==1 &&reply==2)
System.out.printf("\n\n\t %68s","NEW FULL MEMBERSHIP SELECTED");
System.out.printf("\n\n\t %68s","Full membership fees yearly are £"+newfullfee+"");
newfulltotalmem=newfulltotalmem+1;
System.out.printf("\n\n\t %68s","The total number of 'NEW FULL MEMBERSHIPS = "+newfulltotalmem+"");
completefull=completefull+newfullfee;
System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = £"+completefull+"");
//if number '2' is selected by the user then associate member fee is shown to user
if (selectcat==2 &&(reply==1 || reply==2))
System.out.printf("\n\n\t %75s","ASSOCIATE MEMBERSHIP SELECTED");
System.out.printf("\n\n\t %75s","ASSOCIATE membership fees yearly are £"+associatefee+"");
associatetotalmem=associatetotalmem+1;
System.out.printf("\n\n\t %75s","The total number of 'ASSOCIATE MEMBERSHIPS' WITHIN THE CLUB = "+associatetotalmem+"");
assoctotalcash=assoctotalcash+associatefee;
System.out.printf("\n\n\t %68s","The total amount of income for 'ASSOCIATE MEMBERSHIPS' within the club = £"+assoctotalcash+"");
//if number '3' is selected by the user and reply is 'yes' then new ladies member fee is shown to user
if (selectcat==3 &&reply==1)
System.out.printf("\n\n\t %68s","LADIES CURRENT MEMBERSHIP SELECTED");
System.out.printf("\n\n\t %68s","Ladies full membership fees yearly are £"+ladiesfee+"");
System.out.printf("\n\n\t %68s","Ladies must also pre-pay £"+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
System.out.printf("\n\n\t %68s","The total of this membership is: £"+ladiescurrent+"");
ladiestotalmem=ladiestotalmem+1;
System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' WITHIN THE CLUB = "+ladiestotalmem+"");
ladiestotalcash=ladiestotalcash+ladiescurrent;
System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = £"+ladiestotalcash+"");
//if number '3' is selected by the user and reply is 'no' then the current ladies member fee is shown to user
else
if (selectcat==3 && reply==2)
System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP SELECTED");
System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP fees yearly are £"+newladiesfee+"");
System.out.printf("\n\n\t %68s","Ladies must also pre-pay £"+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
System.out.printf("\n\n\t %68s","The total of this membership is: £"+ladiesfull+"");
ladiestotalmem=ladiestotalmem+1;
System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' within the club = "+ladiestotalmem+"");
ladiestotalcash=ladiestotalcash+ladiesfull;
System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = £"+ladiestotalcash+"");
//if number '4' is selected by the user then under 18 member fee is shown to user
else if (selectcat==4 &&(reply==1||reply==2))
System.out.printf("\n\n\t %75s","UNDER 18 MEMBERSHIP SELECTED");
System.out.printf("\n\n\t %75s","UNDER 18 yearly membership fees are £"+under18fee+"");}
System.out.printf("\n\n\t %68s","The total of this membership is: £"+under18+"");
under18totalmem=under18totalmem+1;
System.out.printf("\n\n\t %75s","The total number of 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalmem+"");
under18totalcash=under18totalcash+under18;
System.out.printf("\n\n\t %68s","The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = £"+under18totalcash+"");
//allowing user to select '0' to add another member or any other key to exit program
System.out.printf("\n\n\t %68s","Please Press '0' to add another member or any other key to exit.: ");
addmember=key.nextInt();
}while (addmember==0 ||addmember>1);}}
//

im so sorry guys for not showing my code problems first to...
the problem is :
to produce a program which will show membership rates for a golf club..
membership yearly rate new member joining fee
category
full 650 3000
associate 200
ladies 350 2000
under 18 175
new members must pay a joining fee in addition to the yearly rate as shown
full/ladies members also prepay £150
write a program which will enter details of members,calculate and output the total amount each member should pay.
output number of members in each category
the total income for each category....
the problem im having is whenever i make the choices 1,2,3,4 (CATEgorys) AND hit 1 or 2(current or new member selections) it brings up more than one category...
for example when i hit 1(Category full) and 1(current member)..it displays this:
Are you a Current Member (press 1) or a New Member (press 2): 1
CURRENT FULL MEMBERSHIP SELECTED
Current full membership fees yearly are £800
Full members must also pre-pay £150 on a card can be used in the club facilities such as bar and shop
The total of this membership is: £800
The total number of 'CURRENT FULL MEMBERSHIPS = 1
The total amount of income for 'FULL MEMBERSHIPS' within the club = £800
The total of this membership is: £175
The total number of 'UNDER 18 MEMBERSHIPS' within the club = 1
The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = £175
Please Press '0' to add another member or any other key to exit.:
under 18 membership as well?...does this for other selections too...is it my arithmetic operators?....my if loops?...

Similar Messages

  • Basic java problem help needed please

    the problem is :
    to produce a program which will show membership rates for a golf club..
    membership yearly rate new member joining fee
    category
    full 650 3000
    associate 200
    ladies 350 2000
    under 18 175
    new members must pay a joining fee in addition to the yearly rate as shown
    full/ladies members also prepay 150
    write a program which will enter details of members,calculate and output the total amount each member should pay.
    output number of members in each category
    the total income for each category....
    i need this program to show each category individually...cant do it at all..been at it a week....must be me && and || signs...i think...plz can someone help me as im really stuck now...thank you so much..
    import java.util.Scanner;
    public class assignmentquestion3 {
    public static Scanner key=new Scanner(System.in);
    public static void main(String []args){
    int fullfee=800,newfullfee=3800,associatefee=200,newla diesfee= 2350,ladiesfee= 350,under18fee = 175;
    int selectcat=0;
    int reply = 0;
    int addmember=0;
    int currentfulltotalmem=0,newfulltotalmem=0,associatet otalmem=0,ladiestotalmem=0,under18totalmem=0;
    int assoctotalcash=0,ladiestotalcash=0,under18totalcas h=0;
    int fullprepay=150;
    int ladiesfull=2500;
    int completefull = 0;
    int ladiescurrent=500;
    int under18=175;
    //Main introduction screen for the user and selections available. do while loops only allowing numbers 1,2,3 or 4.
    do{
    do{
    System.out.printf("\n\t %90s","********************Membership Rates For The Golf Club********************");
    System.out.printf("\n\n %105s","This program will allow users to enter details of members as well as calculating and.");
    System.out.printf("\n%106s","outputing the total amount each member should pay. The program allows users to view the");
    System.out.printf("\n%106s","total number of members in each category and the total income for each category.");
    System.out.printf("\n\n\t %75s","Please select your membership category: ");
    System.out.printf("\n\n\t %68s","Please press '1' for FULL");
    System.out.printf("\n\n\t %68s","Please press '2' for ASSOCIATE");
    System.out.printf("\n\n\t %68s","Please press '3' for LADIES");
    System.out.printf("\n\n\t %68s","Please press '4' for UNDER 18");
    System.out.printf("\n\n\t %68s","Please enter 1,2,3 or 4: ");
    selectcat=key.nextInt();
    }while (selectcat>4 || selectcat<1);
    do{
    System.out.printf("\n\n\t %75s","Are you a Current Member (press 1) or a New Member (press 2): ");
    reply=key.nextInt();
    }while (reply<1 || reply>2);
    //if number '1' for 'FULL' category is selected by the user and reply is 'yes'(1) then new full member fee is shown to user
    if (selectcat==1 ||reply==1)
    System.out.printf("\n\n\t %68s","CURRENT FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Current full membership fees yearly are "+fullfee+"");
    System.out.printf("\n\n\t %68s","Full members must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %72s","The total of this membership is: "+fullfee+"");
    currentfulltotalmem=currentfulltotalmem+1;
    System.out.printf("\n\n\t %72s","The total number of 'CURRENT FULL MEMBERSHIPS = "+currentfulltotalmem+"");
    completefull=completefull+fullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = "+completefull+"");
    //if number '1' is selected by the user and reply is 'no' (2) then full member fee is shown to user
    else if (selectcat==1 &&reply==2)
    System.out.printf("\n\n\t %68s","NEW FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Full membership fees yearly are "+newfullfee+"");
    newfulltotalmem=newfulltotalmem+1;
    System.out.printf("\n\n\t %68s","The total number of 'NEW FULL MEMBERSHIPS = "+newfulltotalmem+"");
    completefull=completefull+newfullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = "+completefull+"");
    //if number '2' is selected by the user then associate member fee is shown to user
    if (selectcat==2 &&(reply==1 || reply==2))
    System.out.printf("\n\n\t %75s","ASSOCIATE MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","ASSOCIATE membership fees yearly are "+associatefee+"");
    associatetotalmem=associatetotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'ASSOCIATE MEMBERSHIPS' WITHIN THE CLUB = "+associatetotalmem+"");
    assoctotalcash=assoctotalcash+associatefee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'ASSOCIATE MEMBERSHIPS' within the club = "+assoctotalcash+"");
    //if number '3' is selected by the user and reply is 'yes' then new ladies member fee is shown to user
    if (selectcat==3 &&reply==1)
    System.out.printf("\n\n\t %68s","LADIES CURRENT MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Ladies full membership fees yearly are "+ladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: "+ladiescurrent+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' WITHIN THE CLUB = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiescurrent;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = "+ladiestotalcash+"");
    //if number '3' is selected by the user and reply is 'no' then the current ladies member fee is shown to user
    else
    if (selectcat==3 && reply==2)
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP fees yearly are "+newladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: "+ladiesfull+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' within the club = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiesfull;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = "+ladiestotalcash+"");
    //if number '4' is selected by the user then under 18 member fee is shown to user
    else if (selectcat==4 &&(reply==1||reply==2))
    System.out.printf("\n\n\t %75s","UNDER 18 MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","UNDER 18 yearly membership fees are "+under18fee+"");}
    System.out.printf("\n\n\t %68s","The total of this membership is: "+under18+"");
    under18totalmem=under18totalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalmem+"");
    under18totalcash=under18totalcash+under18;
    System.out.printf("\n\n\t %68s","The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalcash+"");
    //allowing user to select '0' to add another member or any other key to exit program
    System.out.printf("\n\n\t %68s","Please Press '0' to add another member or any other key to exit.: ");
    addmember=key.nextInt();
    }while (addmember==0 ||addmember>1);}}
    the problem im having is whenever i make the choices 1,2,3,4 (CATEgorys) AND hit 1 or 2(current or new member selections) it brings up more than one category...
    for example when i hit 1(Category full) and 1(current member)..it displays this:
    Are you a Current Member (press 1) or a New Member (press 2): 1
    CURRENT FULL MEMBERSHIP SELECTED
    Current full membership fees yearly are 800
    Full members must also pre-pay 150 on a card can be used in the club facilities such as bar and shop
    The total of this membership is: 800
    The total number of 'CURRENT FULL MEMBERSHIPS = 1
    The total amount of income for 'FULL MEMBERSHIPS' within the club = 800
    The total of this membership is: 175
    The total number of 'UNDER 18 MEMBERSHIPS' within the club = 1
    The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = 175
    Please Press '0' to add another member or any other key to exit.:
    under 18 membership as well?...does this for other selections too...is it my arithmetic operators?....my if loops?...

    Multi-post [http://forums.sun.com/thread.jspa?threadID=5346248&messageID=10498270#10498270]
    And it still doesn't compile.

  • Basic (and I mean basic) java problem with a simple hello world script

    I have a simple cut-and-paste html page and java class in my /home/jc158027/java directory.
    jc158027> cat HelloWorld.java
    import java.applet.*;
    import java.awt.*;
    public class HelloWorld extends Applet{
    Label helloLabel = new Label ("Hello World");
    public void init () {
      setBackground (Color.yellow);
      add (helloLabel);
    }Ok, so I javac HelloWorld.java and get HelloWorld.class, so far so good.
    Next I create my html page:
    jc158027> cat hw.html
    <HTML>
    <HEAD>
    <TITLE>Jay's Java Test Page</TITLE>
    <BODY>
    <HR>
    This line of text comes before the applet.<P>
    <APPLET CODE = 'HelloWorld.class" WIDTH=500 Height=90>
    </APPLET>
    <P>
    This line of text comes after the applet.
    </BODY>
    </HTML>The result is that the text lines work, I get a nice grey box with no applet running. Looking at my console I get the following error:
    Caused by: java.io.FileNotFoundException: /home/jc158027/java/HelloWorld/class".class (No such file or directory)
    What I don't understand is the HelloWorld/class".class portion, shouldn't it be just either HelloWorld".class or HelloWorld/class, it is as though it is trying to look in a directory (class) that does not exist.
    What am I missing here?

    And if you put dots in where it expects a class name, it assumes those dots are to separate levels in a package name.
    So it was looking for a class named "class", which would be in a file called class.class, in a package named "HelloWorld". Packages correspond to directories relative to some classpath root, so it looked for the directory HelloWorld to be the parent of the classes in the HelloWorld package.

  • Basic java comparision

    Hi..
    I have a basic JAVA problem..can anyone help on this.
    I have a constant declared in a EMPConstanta.java
    public static String HISTORICAL = "historical";
    In another java class..i need to compare 2 strings..
    String statusType = req.getParameter("historical"); //this vale comes from JSP hidden parameter and the value of statusType is historical
    Now I want to compare with constant vale.. and I am doing like this..
    if(statusType.equals( ASMConstants.HISTORICAL)){
    statusType = ASMConstants.CURRENT;
    Problem is both the values are historical�but it is not entering to if condition..any suggestions

    http://forum.java.sun.com/thread.jspa?threadID=5203921&tstart=0
    avoid multi post

  • Knight tour programming with only basic java

    i had this assignment from school which ask us to create a program to calculate how many posssibilities to complete knight's tour from a position using basic java and not using applet. So far i can only create an incomplete program which can only go a speccific way and is also incomplete. i am trying to understand the jaava applet type of knight tour program but got too confused as i have just started learning this. Please help me with this.
    here's my code:
    public class uk16638_a3{
         public static void main(String[] args){
         int horizontal[] = {2,1,-1,-2,-2,-1,1,2};
         int vertical[] = {-1,-2,-2,-1,1,2,2,1};
         int chessBoard[][]=new int[8][8];
         int move, currentRow = 0, currentCol= 0, move_count = 0, new_vert, new_horz;
    for(int i=0; i<8; i++)
         for(int j =0; j<8; j++)
              chessBoard[i][j] = 0;
    chessBoard[0][0] = 1;
    do{
    for(move=0;move<8;move++){
    new_vert = currentRow + vertical[move];
    new_horz = currentCol + horizontal[move];
    if ( (new_vert>=0) && (new_vert < 8) )
    if( (new_horz>=0) && (new_horz < 8) )
    if( chessBoard[new_horz][new_vert]==0 ) {
    chessBoard[new_horz][new_vert] = 1;
    move_count++;
    currentRow = new_vert;
    currentCol = new_horz;
    }}}while(move<8);}}

    Sorry with the inconvenience cause i am new with this forum so i am causing many problems to all of you. here's the full code i put but i would really like to ask someone to teach me on creating a backtrack and let the knight moves following a different sequence from the one i already set.
    public class uk16638_a3{
    public static void main(String[] args){
    //the movements of a knight horizontally and vertically
    int horizontal[] = {2,1,-1,-2,-2,-1,1,2};
    int vertical[] = {-1,-2,-2,-1,1,2,2,1};
    int chessBoard[][]=new int[8][8];
    int move, currentRow = 0, currentCol= 0, move_count = 0, new_vert, new_horz;
    //setting all elements in the array to 0
    for(int i=0; i<8; i++)
    for(int j =0; j<8; j++)
    chessBoard[i][j] = 0;
    //the knight starts here
    chessBoard[0][0] = 1;
    //using do while loop, i try to move the knight following the sequence i had already set in the array above. But because its moving at the same direction all the time, it gets stuck.
    do{
    for(move=0;move<8;move++){
    //setting the new coordinates for it to move to
    new_vert = currentRow + vertical[move];
    new_horz = currentCol + horizontal[move];
    if ( (new_vert>=0) && (new_vert < 8) )
    if( (new_horz>=0) && (new_horz < 8) )
    //new position check if its already occupied or not, if occupied it will move on to the next part of the move sequence i set
    if( chessBoard[new_horz][new_vert]==0 ) {
    chessBoard[new_horz][new_vert] = 1;
    move_count++;
    //current coordinate of the new knight position
    currentRow = new_vert;
    currentCol = new_horz;
    }}}while(move<8);}}
    Edited by: Mikki88 on Mar 2, 2009 1:53 AM

  • Please help me with two Java problems

    Hello,
    I have 2 Java problems to work on and wondered if someone can help please?
    1. I've created an array, but I have to now create a text file and write a program to read the array from the file. I have no idea where to start the program!
    2.public class SumExample1 {
    /* To determine if a number lies between 1 and 1000
    * @param args the command line arguments
    public static void main(String[] args) {
    int num;
    System.out.print("Enter a number: ");
    num = TextIO.getInt();
    if ((num >=1) && (num<=1000))
    System.out.println("OK");
    else
    System.out.println ("Not OK");
    Ive used a GUI to create some fields and buttons to press. How can I make it perform this little program?
    Many thanks,
    K

    I recommend you read the tutorials on basic (file) IO and Swing (and Event Listeners if you want to make your GUI alive). Perhaps have a look at the Scanner class and BufferedInputStream. That should give you enough to start and write the program yourself. Try working in the command prompt first, should be easier, then once the logic works wrap it in a Swing GUI.
    You can find the tutorials here:
    http://download.oracle.com/javase/tutorial/
    Swing:
    http://download.oracle.com/javase/tutorial/uiswing/index.html
    Basic IO:
    http://download.oracle.com/javase/tutorial/essential/io/index.html
    Hope this helps.
    PR

  • Getting the error " [java] Problem invoking WLST - java.lang.RuntimeException: Could not find the OffLine WLST class " while building the O2A 2.1.0 PIP

    Getting the error " [java] Problem invoking WLST - java.lang.RuntimeException: Could not find the OffLine WLST class " while building the O2A 2.1.0 PIP. I am using the Design Studio 4.3.2 for building the O2A 2.1.0 PIP. Please let me know how to resolve this issue. Here I am enclosing the log file .

    We have basically the same issue when we try to create the interpreter using the embedded method..
    I was able to use the interpreter embedded in a java client as long as the weblogic jars were located in a weblogic install if I tried to use them from a maven repository no luck at all...
    All of this worked easily in 9.2 now in 10.3 it seems more error prone and less documented.
    I have seen close to a 100 posts on issues related to this so is there a document which outlines specifics....
    We / I have used weblogic now for almost 10 years and moving from 8.1 to 9.2 was painful and we expected the move from 9.2 to 10.3 not to be soo bad but its proving to be as painful if not more painful than moving to 9.2. We seem to spend a good bit of our time working around issues in the next new release that were not in the previous one..
    Any help would be appreciated I think we will open a support case but even that is more painful...
    Any help would be greatly appreciated..
    PS: We confirmed that all jars in the startweblogic classpath were in the startup. The server we have the embedded wlst instance is a managed server and we are using the component in a war... Are there any restrictions which we are unaware of.
    Error we get is
    1 [ERROR] com.tfn.autex.order.weblogic.QueueMaintenanceUtility.addQueue():217 Error Adding Queue wowsers JNDI Name wowsers Exception: Invocation Target exception while getting the WLSTOffLineScript path

  • Cannot access Yahoo Kids/indicates Java problem/but Java is installed

    problems playing yahoo games/indicates java problem/java is installed and enabled but cannot get game to come up.

    With details provided I am not sure what problem you are facing.
    Here is generic advise on troubleshooting strategy.
    Please provide basic details:
    1) OS version and architecture
    2) browser's you are tried (and their versions)
    3) JRE version you have installed (for each architecture)
    Assuming you have Java 7 update 7 installed (latest what java.com offers) please report
    4) what version is reported on
    http://www.java.com/en/download/installed.jsp?detect=jre
    5) Can you run some other sample applets?
    E.g. http://rintintin.colorado.edu/~epperson/Java/TicTacToe.html
    Check java troubleshooting guide for tips:
    http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html#gcexdf
    Specifically start with enabling full tracing details and java console. Do you see it popping when you try to start your target application?
    Are there any errors? (If you do not see console then it may be exiting too soon - check if trace file is created in the trace folder).

  • JTable displays string in wrong order : my code problem or Java problem ?

    I have the following code that displays data in a JTable, most of the time it works fine, but I've realized when I have a cell with values like : "Snowboarding"+"[123456789]"
    It would display it as : [Snowboarding[123456789
    For a string like : "Chasing toddlers"+"<123456789>"
    It would display it as : <Chasing toddlers<123456789
    It not only moved the last bracket to the front, but also changed its direction from "]" to "[" and from ">" to "<"
    Is there anything wrong with my code ? Or is this a Java problem ?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    public class Table_Panel extends JPanel implements ItemListener
      public static final long serialVersionUID=26362862L;
      static final int Row_Color_Style_Default=-1,Row_Color_Style_None=0,Row_Color_Style_Blue_Gray=1,Row_Color_Style_Cyan_Gray=2,Row_Color_Style_Blue=3,
                       Row_Color_Style_Gray=4,Row_Color_Style_Red_Green=5,Row_Color_Style_Green_Yellow=6,Row_Color_Style_Red_Yellow=7,
                       Max_Header_Cell_Width=0,Header_Width=1,Cell_Width=2;
      static int Row_Color_Style=Row_Color_Style_Cyan_Gray,Preffered_Width=Header_Width;
    //  static int Row_Color_Style=Row_Color_Style_None,Preffered_Width=Header_Width;
    //boolean        Debug=true,
      boolean        Debug=false,
    //               Use_Row_Colors=true,
                     Use_Row_Colors=false;
      JFrame Table_Frame;
      TableModel My_Model;
      JScrollPane scrollPane=new JScrollPane();
      public JTable Table;
      static String columnNames[],Default_Delimiter=\",\";
      Object[][] data;
      static Dimension Screen_Size=Toolkit.getDefaultToolkit().getScreenSize();
      int Column_Width[];
      static Color Default_Selection_Color=new Color(250,135,200);
      Color Selection_Color=Default_Selection_Color;
      public Table_Panel(ResultSet RS,String Table_Name,boolean Show_External_Table,int Row_Color_Style,int Preffered_Width,boolean In_Original_Order)
        String Value,Table_Column_Names[]=null;
        Object[][] Table_Data=null;
        int Row_Count,Index=0;
        try
          if (RS==null) return;
          else
            RS.last();
            Row_Count=RS.getRow();
            RS.beforeFirst();
          ResultSetMetaData rsmd=RS.getMetaData();
          int Column_Count=rsmd.getColumnCount();
          Table_Column_Names=new String[Column_Count];
          Table_Data=new Object[Row_Count][Column_Count];
          for (int i=1;i<=Column_Count;i++) Table_Column_Names[i-1]=rsmd.getColumnLabel(i);            // Get column names
    //Out("Row_Count="+Row_Count+"  Column_Count="+Column_Count);
          while (RS.next())                                                                            // Get all rows
            for (int i=1;i<=Column_Count;i++)
              Value=RS.getString(i);
              Table_Data[Index][i-1]=(Value==null)?"null":Value;
            Index++;
    //      if (Test_Ct++>300) break;
        catch (Exception e) { e.printStackTrace(); }
        scrollPane=new Table_Panel(Table_Name,Table_Column_Names,Table_Data,Table_Data.length,false,Show_External_Table,false,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order).scrollPane;
      public Table_Panel(String[] Table_Column_Names,Object[][] Table_Data,Color Selection_Color,boolean In_Original_Order)
        this("",Table_Column_Names,Table_Data,Table_Data.length,false,false,false,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order);
      public Table_Panel(String Table_Name,String[] Table_Column_Names,Object[][] Table_Data,boolean Show_External_Table,Color Selection_Color,boolean In_Original_Order)
        this(Table_Name,Table_Column_Names,Table_Data,Table_Data.length,false,Show_External_Table,false,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order);
      public Table_Panel(String Table_Name,String[] Table_Column_Names,Object[][] Table_Data,int Row_Count,boolean Is_Child,boolean Show_External_Table,boolean Manage_Attachment,int Row_Color_Style,int Preffered_Width,Color Selection_Color,boolean In_Original_Order)
        columnNames=Table_Column_Names;
        if (In_Original_Order) data=Table_Data;
        else
          data=new Object[Table_Data.length][columnNames.length];
          for (int row=0;row<Table_Data.length;row++)
            data[row]=new Object[columnNames.length];
            for (int Column=0;Column<Table_Data[row].length;Column++) data[row][Column]=Table_Data[Table_Data.length-1-row][Column];
        Column_Width=new int[columnNames.length];
        this.Row_Color_Style=Row_Color_Style;
        Use_Row_Colors=(Row_Color_Style!=Row_Color_Style_None);
        this.Preffered_Width=Preffered_Width;
        if (Selection_Color!=null) this.Selection_Color=Selection_Color;
    //    Out("this.Selection_Color="+this.Selection_Color);
    //    TableModel My_Model=new DefaultTableModel(Table_Data,columnNames)
        TableModel My_Model=new DefaultTableModel(data,columnNames)
          public int getColumnCount() { return columnNames.length; }
          public int getRowCount() { return data.length; }
          public String getColumnName(int col) { return columnNames[col]; }
          public Object getValueAt(int row,int col)
    //      Out(row+","+col+"["+data[row][col]+"]   data.length="+data.length+"  data[0].length="+data[0].length);
            return (data[row][col]==null)?"":((data[row][col] instanceof Boolean)?data[row][col]:data[row][col].toString()); // Non-boolean values will have bgcolor
          public Class getColumnClass(int column)
            Class returnValue;
            if ((column>=0) && (column<getColumnCount())) returnValue=getValueAt(0,column).getClass();
            else returnValue=Object.class;
            return returnValue;
        // JTable uses this method to determine the default renderer/editor for each cell. If we didn't implement this method, then the last column would contain text ("true"/"false"), rather than a check box.
    //    public Class getColumnClass(int c) { return getValueAt(0,c).getClass(); }
          // Don't need to implement this method unless your table's editable.
          public boolean isCellEditable(int row,int col)
            //Note that the data/cell address is constant, no matter where the cell appears onscreen.
            if (col<0) return false;
            else return true;
          // Don't need to implement this method unless your table's data can change.
          public void setValueAt(Object value,int row,int col)
            String Execution_Dir=getClass().getProtectionDomain().getCodeSource().getLocation().toString();
            if (Debug) System.out.println("Execution_Dir="+Execution_Dir+"\nLast_Value="+Table_Grid_Cell_Renderer.Last_Value+"  Setting value at [ "+row+","+col+" ] to "+value+" (an instance of "+value.getClass()+")");
            if (Execution_Dir.toLowerCase().indexOf("c:/")!=-1 || value.getClass()==Boolean.class || !Use_Row_Colors) data[row][col]=value;
    //     else data[row][col]=(Table_Grid_CellRenderer.Last_Value==null)?value:value.toString().substring(Table_Grid_CellRenderer.Last_Value.toString().length());
            fireTableCellUpdated(row,col);
            if (Debug)
              System.out.println("New value of data :");
              printDebugData();
          private void printDebugData()
            int numRows=getRowCount();
            int numCols=getColumnCount();
            for (int i=0;i<numRows;i++)
              System.out.print("    row "+i+":");
              for (int j=0;j<numCols;j++) System.out.print("  "+data[i][j]);
              System.out.println();
            System.out.println("--------------------------------------------------------------------------");
        TableSorter sorter=new TableSorter(My_Model);
        Table=new JTable(sorter)
    //    Table=new JTable(My_Model)
          public static final long serialVersionUID=26362862L;
          public String getToolTipText(MouseEvent e)           // Implement table cell tool tips.
            Object Cell_Tip;
            String tip=null;
            java.awt.Point p=e.getPoint();
            int rowIndex=rowAtPoint(p);
            int colIndex=columnAtPoint(p);
            int realColumnIndex=convertColumnIndexToModel(colIndex);
            Cell_Tip=getValueAt(rowIndex,colIndex);
    //        if (realColumnIndex == 2)                         //Sport column
              tip=Cell_Tip.toString();
            else if (realColumnIndex == 4)                      //Veggie column
              TableModel model=getModel();
              String firstName=(String)model.getValueAt(rowIndex,0);
              String lastName=(String)model.getValueAt(rowIndex,1);
              Boolean veggie=(Boolean)model.getValueAt(rowIndex,4);
              if (Boolean.TRUE.equals(veggie)) tip=firstName+" "+lastName+" is a vegetarian";
              else tip=firstName+" "+lastName+" is not a vegetarian";
            else
              // You can omit this part if you know you don't have any renderers that supply their own tool tips.
              tip=super.getToolTipText(e);
            return tip;
    //    RowSorter<TableModel> sorter=new TableRowSorter<TableModel>(My_Model);
    //    Table.setRowSorter(sorter);
        Table.setSelectionBackground(this.Selection_Color);
        int Table_Height=Table.getRowHeight()*Row_Count;
        // sorter.addMouseListenerToHeaderInTable(Table);      // ADDED THIS
        sorter.setTableHeader(Table.getTableHeader());
        if (Table_Column_Names.length>20) Table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        if (Manage_Attachment) Table.setPreferredScrollableViewportSize(new Dimension(500,(Table_Height>850)?850:Table_Height));
        else Table.setPreferredScrollableViewportSize(new Dimension(1000,(Table_Height>850)?850:Table_Height));
        if (Use_Row_Colors) Table.setDefaultRenderer(Object.class,new Table_Grid_Cell_Renderer());
        //Create the scroll pane and add the table to it.
        scrollPane=new JScrollPane(Table);
        //Set up column sizes.
        initColumnSizes(Table,My_Model);
        //Add the scroll pane to this window.
        if (Show_External_Table)
          Table_Frame=new JFrame(Table_Name);
          Table_Frame.getContentPane().add(scrollPane);
          Table_Frame.addWindowListener(new WindowAdapter()
            public void windowActivated(WindowEvent e) { }
            public void windowClosed(WindowEvent e) { }
            public void windowClosing(WindowEvent e)  { System.exit(0); }
            public void windowDeactivated(WindowEvent e)  { }
            public void windowDeiconified(WindowEvent e)  { scrollPane.repaint(); }
            public void windowGainedFocus(WindowEvent e)  { scrollPane.repaint(); }
            public void windowIconified(WindowEvent e)  { }
            public void windowLostFocus(WindowEvent e)  { }
            public void windowOpening(WindowEvent e) { scrollPane.repaint(); }
            public void windowOpened(WindowEvent e)  { }
            public void windowResized(WindowEvent e) { scrollPane.repaint(); } 
            public void windowStateChanged(WindowEvent e) { scrollPane.repaint(); }
          Table_Frame.pack();
          Table_Frame.setBounds((Screen_Size.width-Table_Frame.getWidth())/2,(Screen_Size.height-Table_Frame.getHeight())/2,Table_Frame.getWidth(),Table_Frame.getHeight());
          Table_Frame.setVisible(true);
          if (Is_Child) Table_Frame.addComponentListener(new ComponentAdapter() { public void componentClosing(ComponentEvent e) { System.exit(0); } });
        else add(scrollPane);
      public Table_Panel(String File_Name) { this(File_Name,false,Row_Color_Style_Cyan_Gray,Preffered_Width,null,Default_Selection_Color,true); }
      public Table_Panel(String File_Name,int Row_Color_Style,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style,Preffered_Width,null,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,String Delimiter,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style_Cyan_Gray,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,int Preffered_Width,String Delimiter,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,int Row_Color_Style,int Preffered_Width,String Delimiter,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,boolean Show_External_Table,boolean In_Original_Order) { this(File_Name,Show_External_Table,Row_Color_Style,Preffered_Width,null,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,boolean Show_External_Table,String Delimiter,boolean In_Original_Order) { this(File_Name,Show_External_Table,Row_Color_Style,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,boolean Show_External_Table,int Row_Color_Style,int Preffered_Width,String Delimiter,Color Selection_Color,boolean In_Original_Order)
        String Table_Column_Names[],Column_Name_Line="";
        int Row_Count=0,Index=0;
        boolean Is_Child=false,Manage_Attachment=false;
        StringTokenizer ST;
        if (Delimiter==null) Delimiter=Default_Delimiter;
        if (new File(File_Name).exists())
          try
            String Line,Str=Tool_Lib.Read_File(File_Name).toString();
            ST=new StringTokenizer(Str,"\n");
            Line=ST.nextToken();
            Row_Count=ST.countTokens();
            Object[][] Table_Data=new Object[Row_Count][];
            if (Delimiter.equals(" ")) Line=Line.replaceAll(" {2,}"," ").trim();     // Replace multiple spaces with the delimiter space
            Table_Column_Names=Line.split(Delimiter);
            columnNames=Table_Column_Names;
            for (int i=0;i<Table_Column_Names.length;i++) Column_Name_Line+=Table_Column_Names[i]+"  ";
    //Out("Column_Name_Line [ "+Table_Column_Names.length+" ]="+Column_Name_Line);
            while (ST.hasMoreTokens())
              Line=ST.nextToken();
    //Out(Line);
              if (Delimiter.equals(" ")) Line=Line.replaceAll(" {2,}"," ").trim();   // Replace multiple spaces with the delimiter space
              if (Line.indexOf(Delimiter)!=-1) Table_Data[Index]=Line.split(Delimiter);
              else
                Table_Data[Index]=new Object[Table_Column_Names.length];
                Table_Data[Index][0]=Line;
                for (int i=1;i<Table_Column_Names.length;i++) Table_Data[Index]="";
    Index++;
    Line="";
    for (int i=0;i<Table_Data.length;i++)
    Line+="[ "+Table_Data[i].length+" ] ";
    for (int j=0;j<Table_Data[i].length;j++) Line+=Table_Data[i][j]+" ";
    Line+="\n";
    Out(Line);
    Table_Panel A_Table_Panel=new Table_Panel(File_Name,Table_Column_Names,Table_Data,Row_Count,Is_Child,Show_External_Table,Manage_Attachment,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order);
    Table=A_Table_Panel.Table;
    scrollPane=A_Table_Panel.scrollPane;
    Column_Width=A_Table_Panel.Column_Width;
    data=A_Table_Panel.data;
    catch (Exception e) { e.printStackTrace(); }
    public void setPreferredSize(Dimension A_Dimension) { scrollPane.setPreferredSize(A_Dimension); }
    // This method picks good column sizes. If all column heads are wider than the column's cells' contents, then you can just use column.sizeWidthToFit().
    void initColumnSizes(JTable table,TableModel model)
    TableColumn column=null;
    Component comp=null;
    int headerWidth=0,cellWidth=0;
    Object[] longValues=(data.length>0)?data[0]:null;
    TableCellRenderer headerRenderer=table.getTableHeader().getDefaultRenderer();
    if (data.length<1) return;
    for (int i=0;i<model.getColumnCount();i++)
    column=table.getColumnModel().getColumn(i);
    comp=headerRenderer.getTableCellRendererComponent(null,column.getHeaderValue(),false,false,0,0);
    headerWidth=comp.getPreferredSize().width;
    comp=table.getDefaultRenderer(model.getColumnClass(i)).
    getTableCellRendererComponent(table,longValues[i],false,false,0,i);
    cellWidth=comp.getPreferredSize().width;
    switch (Preffered_Width)
    case Max_Header_Cell_Width : column.setPreferredWidth(Math.max(headerWidth,cellWidth));break;
    case Header_Width : column.setPreferredWidth(headerWidth);break;
    case Cell_Width : column.setPreferredWidth(cellWidth);break;
    Column_Width[i]=column.getPreferredWidth();
    if (Debug) Out("Initializing width of column "+i+". "+"headerWidth="+headerWidth+"; cellWidth="+cellWidth+" Column_Width["+i+"]="+Column_Width[i]);
    // Detects a state change in any of the Lists. Resets the variable corresponding to the selected item in a particular List. Invokes changeFont with the currently selected fontname, style and size attributes.
    public void itemStateChanged(ItemEvent e)
    Out(e.toString());
    if (e.getStateChange() != ItemEvent.SELECTED) return;
    Object list=e.getSource();
    public static void Out(String message) { System.out.println(message); }
    // Create the GUI and show it. For thread safety, this method should be invoked from the event-dispatching thread.
    static void Create_And_Show_GUI()
    boolean Demo_External_Table=true;
    // boolean Demo_External_Table=false;
    final Table_Panel demo;
    String[] columnNames={"First Names","Last Names","Sport","Num of Years","Vegetarian"};
    Object[][] data={{"Mary","Campione","Snowboarding"+"[123456789]",new Integer(5),new Boolean(false)},
    {"Alison","Huml","Rowing"+":123456789]",new Integer(3),new Boolean(true)},
    {"Frank","Ni","Running"+":123456789", new Integer(12), new Boolean(false)},
    {"Kathy","Walrath","Chasing toddlers"+"<123456789>", new Integer(2), new Boolean(false)},
    {"Mark", "Andrews","Speed reading",new Integer(20),new Boolean(true)},
    {"Angela","Lih","Teaching high school",new Integer(36),new Boolean(false)} };
    // Row_Color_Style=Row_Color_Style_Default;
    // Row_Color_Style=Row_Color_Style_None;
    // Row_Color_Style=Row_Color_Style_Blue_Gray;
    Row_Color_Style=Row_Color_Style_Cyan_Gray;
    // Row_Color_Style=Row_Color_Style_Blue;
    // Row_Color_Style=Row_Color_Style_Gray;
    // Row_Color_Style=Row_Color_Style_Red_Green;
    // Row_Color_Style=Row_Color_Style_Green_Yellow;
    // Row_Color_Style=Row_Color_Style_Red_Yellow;
    Preffered_Width=Max_Header_Cell_Width;
    if (Demo_External_Table) demo=new Table_Panel("External Table Demo",columnNames,data,data.length,false,Demo_External_Table,false,Row_Color_Style,Max_Header_Cell_Width,Default_Selection_Color,true);
    else
    JFrame Table_Frame=new JFrame("Internal Table Demo");
    // demo=new Table_Panel(Nm_Lib.Dir_A_Test+"ELX.csv",false,Row_Color_Style,Preffered_Width,null);
    // demo=new Table_Panel(Nm_Lib.Dir_Stock_Data+"ABV_Data.txt",false,Row_Color_Style,Preffered_Width," ");
    demo=new Table_Panel("C:/Dir_Stock_Data/EOP.txt",",",false);
    // demo=new Table_Panel(Nm_Lib.Dir_Stock_Data+"ABV_Data.txt"," ",false);
    Table_Frame.getContentPane().add(demo.scrollPane);
    Table_Frame.addWindowListener(new WindowAdapter()
    public void windowActivated(WindowEvent e) { }
    public void windowClosed(WindowEvent e) { }
    public void windowClosing(WindowEvent e) { System.exit(0); }
    public void windowDeactivated(WindowEvent e) { }
    public void windowDeiconified(WindowEvent e) { demo.repaint(); }
    public void windowGainedFocus(WindowEvent e) { demo.repaint(); }
    public void windowIconified(WindowEvent e) { }
    public void windowLostFocus(WindowEvent e) { }
    public void windowOpening(WindowEvent e) { demo.repaint(); }
    public void windowOpened(WindowEvent e) { }
    public void windowResized(WindowEvent e) { demo.repaint(); }
    public void windowStateChanged(WindowEvent e) { demo.repaint(); }
    Table_Frame.pack();
    Table_Frame.setBounds((Screen_Size.width-Table_Frame.getWidth())/2,(Screen_Size.height-Table_Frame.getHeight())/2,Table_Frame.getWidth(),Table_Frame.getHeight());
    Table_Frame.setVisible(true);
    public static void main(String[] args)
    // Schedule a job for the event-dispatching thread : creating and showing this application's GUI.
    SwingUtilities.invokeLater(new Runnable() { public void run() { Create_And_Show_GUI(); } });
    * TableSorter is a decorator for TableModels; adding sorting functionality to a supplied TableModel. TableSorter does not store
    * or copy the data in its TableModel; instead it maintains a map from the row indexes of the view to the row indexes of the
    * model. As requests are made of the sorter (like getValueAt(row, col)) they are passed to the underlying model after the row numbers
    * have been translated via the internal mapping array. This way, the TableSorter appears to hold another copy of the table
    * with the rows in a different order.
    * <p/>
    * TableSorter registers itself as a listener to the underlying model, just as the JTable itself would. Events recieved from the model
    * are examined, sometimes manipulated (typically widened), and then passed on to the TableSorter's listeners (typically the JTable).
    * If a change to the model has invalidated the order of TableSorter's rows, a note of this is made and the sorter will resort the
    * rows the next time a value is requested.
    * <p/>
    * When the tableHeader property is set, either by using the setTableHeader() method or the two argument constructor, the table
    * header may be used as a complete UI for TableSorter. The default renderer of the tableHeader is decorated with a renderer
    * that indicates the sorting status of each column. In addition, a mouse listener is installed with the following behavior:
    * <ul>
    * <li>
    * Mouse-click: Clears the sorting status of all other columns and advances the sorting status of that column through three
    * values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to NOT_SORTED again).
    * <li>
    * SHIFT-mouse-click: Clears the sorting status of all other columns and cycles the sorting status of the column through the same
    * three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
    * <li>
    * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that the changes to the column do not cancel the statuses of columns
    * that are already sorting - giving a way to initiate a compound sort.
    * </ul>
    * <p/>
    * This is a long overdue rewrite of a class of the same name that first appeared in the swing table demos in 1997.
    * @author Philip Milne
    * @author Brendon McLean
    * @author Dan van Enckevort
    * @author Parwinder Sekhon
    * @version 2.0 02/27/04
    class TableSorter extends AbstractTableModel
    public static final long serialVersionUID=26362862L;
    protected TableModel tableModel;
    public static final int DESCENDING = -1;
    public static final int NOT_SORTED = 0;
    public static final int ASCENDING = 1;
    private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
    public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) o1).compareTo(o2); } };
    public static final Comparator LEXICAL_COMPARATOR = new Comparator() { public int compare(Object o1, Object o2) { return o1.toString().compareTo(o2.toString()); } };
    private Row[] viewToModel;
    private int[] modelToView;
    private JTableHeader tableHeader;
    private MouseListener mouseListener;
    private TableModelListener tableModelListener;
    private Map<Class,Comparator> columnComparators = new HashMap<Class,Comparator>();
    private List<Directive> sortingColumns = new ArrayList<Directive>();
    public TableSorter()
    this.mouseListener = new MouseHandler();
    this.tableModelListener = new TableModelHandler();
    public TableSorter(TableModel tableModel)
    this();
    setTableModel(tableModel);
    public TableSorter(TableModel tableModel, JTableHeader tableHeader)
    this();
    setTableHeader(tableHeader);
    setTableModel(tableModel);
    private void clearSortingState()
    viewToModel = null;
    modelToView = null;
    public TableModel getTableModel() { return tableModel; }
    public void setTableModel(TableModel tableModel)
    if (this.tableModel != null) { this.tableModel.removeTableModelListener(tableModelListener); }
    this.tableModel = tableModel;
    if (this.tableModel != null) { this.tableModel.addTableModelListener(tableModelListener); }
    clearSortingState();
    fireTableStructureChanged();
    public JTableHeader getTableHeader() { return tableHeader; }
    public void setTableHeader(JTableHeader tableHeader)
    if (this.tableHeader != null)
    this.tableHeader.removeMouseListener(mouseListener);
    TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
    if (defaultRenderer instanceof SortableHeaderRenderer) this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
    this.tableHeader = tableHeader;
    if (this.tableHeader != null)
    this.tableHeader.addMouseListener(mouseListener);
    this.tableHeader.setDefaultRenderer(
    new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));
    public boolean isSorting() { return sortingColumns.size() != 0; }
    private Directive getDirective(int column)
    for (int i = 0; i < sortingColumns.size(); i++)
    Directive directive = (Directive)sortingColumns.get(i);
    if (directive.column == column) { return directive; }
    return EMPTY_DIRECTIVE;
    public int getSortingStatus(int column) { return getDirective(column).direction; }
    private void sortingStatusChanged()
    clearSortingState();
    fireTableDataChanged();
    if (tableHeader != null) { tableHeader.repaint(); }
    public void setSortingStatus(int column, int status)
    Directive directive = getDirective(column);
    if (directive != EMPTY_DIRECTIVE) { sortingColumns.remove(directive); }
    if (status != NOT_SORTED) { sortingColumns.add(new Directive(column, status)); }
    sortingStatusChanged();
    protected Icon getHeaderRendererIcon(int column, int size)
    Directive directive = getDirective(column);
    if (directive == EMPTY_DIRECTIVE) { return null; }
    return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));
    private void cancelSorting()
    sortingColumns.clear();
    sortingStatusChanged();
    public void setColumnComparator(Class type, Comparator comparator)
    if (comparator == null) { columnComparators.remove(type); }
    else { columnComparators.put(type, comparator); }
    protected Comparator getComparator(int column)
    Class columnType = tableModel.getColumnClass(column);
    Comparator comparator = (Comparator) columnComparators.get(columnType);
    if (comparator != null) { return comparator; }
    if (Comparable.class.isAssignableFrom(columnType)) { return COMPARABLE_COMAPRATOR; }
    return LEXICAL_COMPARATOR;
    private Row[] getViewToModel()
    if (viewToModel == null)
    int tableModelRowCount = tableModel.getRowCount();
    viewToModel = new Row[tableModelRowCount];
    for (int row = 0; row < tableModelRowCount; row++) { viewToModel[row] = new Row(row); }
    if (isSorting()) { Arrays.sort(viewToModel); }
    return viewToModel;
    public int modelIndex(int viewIndex) { return getViewToModel()[viewIndex].modelIndex; }
    private int[] getModelToView()
    if (modelToView == null)
    int n = getViewToModel().length;
    modelToView = new int[n];
    for (int i = 0; i < n; i++) { modelToView[modelIndex(i)] = i; }
    return modelToView;
    // TableModel interface methods
    public int getRowCount() { return (tableModel == null) ? 0 : tableModel.getRowCount(); }
    public int getColumnCount() { return (tableModel == null) ? 0 : tableModel.getColumnCount(); }
    public String getColumnName(int column) { return tableModel.getColumnName(column); }
    public Class getColumnClass(int column) { return tableModel.getColumnClass(column); }
    public boolean isCellEditable(int row, int column) { return tableModel.isCellEditable(modelIndex(row), column); }
    public Object getValueAt(int row, int column) { return tableModel.getValueAt(modelIndex(row), column); }
    public void setValueAt(Object aValue, int row, int column) { tableModel.setValueAt(aValue, modelIndex(row), column); }
    // Helper classes
    private class Row implements Comparable
    private int modelIndex;
    public Row(int index) { this.modelIndex = index; }
    public int compareTo(Object o)
    int row1 = modelIndex;
    int row2 = ((Row) o).modelIndex;
    for (Iterator it = sortingColumns.iterator(); it.hasNext();)
    Directive directive = (Directive) it.next();
    int column = directive.column;
    Object o1 = tableModel.getValueAt(row1, column);
    Object o2 = tableModel.getValueAt(row2, column);
    int comparison = 0;
    // Define null less than everything, except null.

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    public class Table_Panel extends JPanel implements ItemListener
      public static final long serialVersionUID=26362862L;
      static final int Row_Color_Style_Default=-1,Row_Color_Style_None=0,Row_Color_Style_Blue_Gray=1,Row_Color_Style_Cyan_Gray=2,Row_Color_Style_Blue=3,
                       Row_Color_Style_Gray=4,Row_Color_Style_Red_Green=5,Row_Color_Style_Green_Yellow=6,Row_Color_Style_Red_Yellow=7,
                       Max_Header_Cell_Width=0,Header_Width=1,Cell_Width=2;
      static int Row_Color_Style=Row_Color_Style_Cyan_Gray,Preffered_Width=Header_Width;
    //  static int Row_Color_Style=Row_Color_Style_None,Preffered_Width=Header_Width;
    //boolean        Debug=true,
      boolean        Debug=false,
    //               Use_Row_Colors=true,
                     Use_Row_Colors=false;
      JFrame Table_Frame;
      TableModel My_Model;
      JScrollPane scrollPane=new JScrollPane();
      public JTable Table;
      static String columnNames[],Default_Delimiter=",";
      Object[][] data;
      static Dimension Screen_Size=Toolkit.getDefaultToolkit().getScreenSize();
      int Column_Width[];
      static Color Default_Selection_Color=new Color(250,135,200);
      Color Selection_Color=Default_Selection_Color;
      public Table_Panel(ResultSet RS,String Table_Name,boolean Show_External_Table,int Row_Color_Style,int Preffered_Width,boolean In_Original_Order)
        String Value,Table_Column_Names[]=null;
        Object[][] Table_Data=null;
        int Row_Count,Index=0;
        try
          if (RS==null) return;
          else
            RS.last();
            Row_Count=RS.getRow();
            RS.beforeFirst();
          ResultSetMetaData rsmd=RS.getMetaData();
          int Column_Count=rsmd.getColumnCount();
          Table_Column_Names=new String[Column_Count];
          Table_Data=new Object[Row_Count][Column_Count];
          for (int i=1;i<=Column_Count;i++) Table_Column_Names[i-1]=rsmd.getColumnLabel(i);            // Get column names
    //Out("Row_Count="+Row_Count+"  Column_Count="+Column_Count);
          while (RS.next())                                                                            // Get all rows
            for (int i=1;i<=Column_Count;i++)
              Value=RS.getString(i);
              Table_Data[Index][i-1]=(Value==null)?"null":Value;
            Index++;
    //      if (Test_Ct++>300) break;
        catch (Exception e) { e.printStackTrace(); }
        scrollPane=new Table_Panel(Table_Name,Table_Column_Names,Table_Data,Table_Data.length,false,Show_External_Table,false,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order).scrollPane;
      public Table_Panel(String[] Table_Column_Names,Object[][] Table_Data,Color Selection_Color,boolean In_Original_Order)
        this("",Table_Column_Names,Table_Data,Table_Data.length,false,false,false,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order);
      public Table_Panel(String Table_Name,String[] Table_Column_Names,Object[][] Table_Data,boolean Show_External_Table,Color Selection_Color,boolean In_Original_Order)
        this(Table_Name,Table_Column_Names,Table_Data,Table_Data.length,false,Show_External_Table,false,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order);
      public Table_Panel(String Table_Name,String[] Table_Column_Names,Object[][] Table_Data,int Row_Count,boolean Is_Child,boolean Show_External_Table,boolean Manage_Attachment,int Row_Color_Style,int Preffered_Width,Color Selection_Color,boolean In_Original_Order)
        columnNames=Table_Column_Names;
        if (In_Original_Order) data=Table_Data;
        else
          data=new Object[Table_Data.length][columnNames.length];
          for (int row=0;row<Table_Data.length;row++)
            data[row]=new Object[columnNames.length];
            for (int Column=0;Column<Table_Data[row].length;Column++) data[row][Column]=Table_Data[Table_Data.length-1-row][Column];
        Column_Width=new int[columnNames.length];
        this.Row_Color_Style=Row_Color_Style;
        Use_Row_Colors=(Row_Color_Style!=Row_Color_Style_None);
        this.Preffered_Width=Preffered_Width;
        if (Selection_Color!=null) this.Selection_Color=Selection_Color;
    //    Out("this.Selection_Color="+this.Selection_Color);
    //    TableModel My_Model=new DefaultTableModel(Table_Data,columnNames)
        TableModel My_Model=new DefaultTableModel(data,columnNames)
          public int getColumnCount() { return columnNames.length; }
          public int getRowCount() { return data.length; }
          public String getColumnName(int col) { return columnNames[col]; }
          public Object getValueAt(int row,int col)
    //      Out(row+","+col+"["+data[row][col]+"]   data.length="+data.length+"  data[0].length="+data[0].length);
            return (data[row][col]==null)?"":((data[row][col] instanceof Boolean)?data[row][col]:data[row][col].toString()); // Non-boolean values will have bgcolor
          public Class getColumnClass(int column)
            Class returnValue;
            if ((column>=0) && (column<getColumnCount())) returnValue=getValueAt(0,column).getClass();
            else returnValue=Object.class;
            return returnValue;
        // JTable uses this method to determine the default renderer/editor for each cell. If we didn't implement this method, then the last column would contain text ("true"/"false"), rather than a check box.
    //    public Class getColumnClass(int c) { return getValueAt(0,c).getClass(); }
          // Don't need to implement this method unless your table's editable.
          public boolean isCellEditable(int row,int col)
            //Note that the data/cell address is constant, no matter where the cell appears onscreen.
            if (col<0) return false;
            else return true;
          // Don't need to implement this method unless your table's data can change.
          public void setValueAt(Object value,int row,int col)
            String Execution_Dir=getClass().getProtectionDomain().getCodeSource().getLocation().toString();
            if (Debug) System.out.println("Execution_Dir="+Execution_Dir+"\nLast_Value="+Table_Grid_Cell_Renderer.Last_Value+"  Setting value at [ "+row+","+col+" ] to "+value+" (an instance of "+value.getClass()+")");
            if (Execution_Dir.toLowerCase().indexOf("c:/")!=-1 || value.getClass()==Boolean.class || !Use_Row_Colors) data[row][col]=value;
    //     else data[row][col]=(Table_Grid_CellRenderer.Last_Value==null)?value:value.toString().substring(Table_Grid_CellRenderer.Last_Value.toString().length());
            fireTableCellUpdated(row,col);
            if (Debug)
              System.out.println("New value of data :");
              printDebugData();
          private void printDebugData()
            int numRows=getRowCount();
            int numCols=getColumnCount();
            for (int i=0;i<numRows;i++)
              System.out.print("    row "+i+":");
              for (int j=0;j<numCols;j++) System.out.print("  "+data[i][j]);
              System.out.println();
            System.out.println("--------------------------------------------------------------------------");
        TableSorter sorter=new TableSorter(My_Model);
        Table=new JTable(sorter)
    //    Table=new JTable(My_Model)
          public static final long serialVersionUID=26362862L;
          public String getToolTipText(MouseEvent e)           // Implement table cell tool tips.
            Object Cell_Tip;
            String tip=null;
            java.awt.Point p=e.getPoint();
            int rowIndex=rowAtPoint(p);
            int colIndex=columnAtPoint(p);
            int realColumnIndex=convertColumnIndexToModel(colIndex);
            Cell_Tip=getValueAt(rowIndex,colIndex);
    //        if (realColumnIndex == 2)                         //Sport column
              tip=Cell_Tip.toString();
            else if (realColumnIndex == 4)                      //Veggie column
              TableModel model=getModel();
              String firstName=(String)model.getValueAt(rowIndex,0);
              String lastName=(String)model.getValueAt(rowIndex,1);
              Boolean veggie=(Boolean)model.getValueAt(rowIndex,4);
              if (Boolean.TRUE.equals(veggie)) tip=firstName+" "+lastName+" is a vegetarian";
              else tip=firstName+" "+lastName+" is not a vegetarian";
            else
              // You can omit this part if you know you don't have any renderers that supply their own tool tips.
              tip=super.getToolTipText(e);
            return tip;
    //    RowSorter<TableModel> sorter=new TableRowSorter<TableModel>(My_Model);
    //    Table.setRowSorter(sorter);
        Table.setSelectionBackground(this.Selection_Color);
        int Table_Height=Table.getRowHeight()*Row_Count;
        // sorter.addMouseListenerToHeaderInTable(Table);      // ADDED THIS
        sorter.setTableHeader(Table.getTableHeader());
        if (Table_Column_Names.length>20) Table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        if (Manage_Attachment) Table.setPreferredScrollableViewportSize(new Dimension(500,(Table_Height>850)?850:Table_Height));
        else Table.setPreferredScrollableViewportSize(new Dimension(1000,(Table_Height>850)?850:Table_Height));
        if (Use_Row_Colors) Table.setDefaultRenderer(Object.class,new Table_Grid_Cell_Renderer());
        //Create the scroll pane and add the table to it.
        scrollPane=new JScrollPane(Table);
        //Set up column sizes.
        initColumnSizes(Table,My_Model);
        //Add the scroll pane to this window.
        if (Show_External_Table)
          Table_Frame=new JFrame(Table_Name);
          Table_Frame.getContentPane().add(scrollPane);
          Table_Frame.addWindowListener(new WindowAdapter()
            public void windowActivated(WindowEvent e) { }
            public void windowClosed(WindowEvent e) { }
            public void windowClosing(WindowEvent e)  { System.exit(0); }
            public void windowDeactivated(WindowEvent e)  { }
            public void windowDeiconified(WindowEvent e)  { scrollPane.repaint(); }
            public void windowGainedFocus(WindowEvent e)  { scrollPane.repaint(); }
            public void windowIconified(WindowEvent e)  { }
            public void windowLostFocus(WindowEvent e)  { }
            public void windowOpening(WindowEvent e) { scrollPane.repaint(); }
            public void windowOpened(WindowEvent e)  { }
            public void windowResized(WindowEvent e) { scrollPane.repaint(); } 
            public void windowStateChanged(WindowEvent e) { scrollPane.repaint(); }
          Table_Frame.pack();
          Table_Frame.setBounds((Screen_Size.width-Table_Frame.getWidth())/2,(Screen_Size.height-Table_Frame.getHeight())/2,Table_Frame.getWidth(),Table_Frame.getHeight());
          Table_Frame.setVisible(true);
          if (Is_Child) Table_Frame.addComponentListener(new ComponentAdapter() { public void componentClosing(ComponentEvent e) { System.exit(0); } });
        else add(scrollPane);
      public Table_Panel(String File_Name) { this(File_Name,false,Row_Color_Style_Cyan_Gray,Preffered_Width,null,Default_Selection_Color,true); }
      public Table_Panel(String File_Name,int Row_Color_Style,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style,Preffered_Width,null,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,String Delimiter,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style_Cyan_Gray,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,int Preffered_Width,String Delimiter,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,int Row_Color_Style,int Preffered_Width,String Delimiter,boolean In_Original_Order) { this(File_Name,false,Row_Color_Style,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,boolean Show_External_Table,boolean In_Original_Order) { this(File_Name,Show_External_Table,Row_Color_Style,Preffered_Width,null,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,boolean Show_External_Table,String Delimiter,boolean In_Original_Order) { this(File_Name,Show_External_Table,Row_Color_Style,Preffered_Width,Delimiter,Default_Selection_Color,In_Original_Order); }
      public Table_Panel(String File_Name,boolean Show_External_Table,int Row_Color_Style,int Preffered_Width,String Delimiter,Color Selection_Color,boolean In_Original_Order)
        String Table_Column_Names[],Column_Name_Line="";
        int Row_Count=0,Index=0;
        boolean Is_Child=false,Manage_Attachment=false;
        StringTokenizer ST;
        if (Delimiter==null) Delimiter=Default_Delimiter;
        if (new File(File_Name).exists())
          try
            String Line,Str=Tool_Lib.Read_File(File_Name).toString();
            ST=new StringTokenizer(Str,"\n");
            Line=ST.nextToken();
            Row_Count=ST.countTokens();
            Object[][] Table_Data=new Object[Row_Count][];
            if (Delimiter.equals(" ")) Line=Line.replaceAll(" {2,}"," ").trim();     // Replace multiple spaces with the delimiter space
            Table_Column_Names=Line.split(Delimiter);
            columnNames=Table_Column_Names;
            for (int i=0;i<Table_Column_Names.length;i++) Column_Name_Line+=Table_Column_Names[i]+"  ";
    //Out("Column_Name_Line [ "+Table_Column_Names.length+" ]="+Column_Name_Line);
            while (ST.hasMoreTokens())
              Line=ST.nextToken();
    //Out(Line);
              if (Delimiter.equals(" ")) Line=Line.replaceAll(" {2,}"," ").trim();   // Replace multiple spaces with the delimiter space
              if (Line.indexOf(Delimiter)!=-1) Table_Data[Index]=Line.split(Delimiter);
              else
                Table_Data[Index]=new Object[Table_Column_Names.length];
                Table_Data[Index][0]=Line;
                for (int i=1;i<Table_Column_Names.length;i++) Table_Data[Index]="";
    Index++;
    Line="";
    for (int i=0;i<Table_Data.length;i++)
    Line+="[ "+Table_Data[i].length+" ] ";
    for (int j=0;j<Table_Data[i].length;j++) Line+=Table_Data[i][j]+" ";
    Line+="\n";
    Out(Line);
    Table_Panel A_Table_Panel=new Table_Panel(File_Name,Table_Column_Names,Table_Data,Row_Count,Is_Child,Show_External_Table,Manage_Attachment,Row_Color_Style,Preffered_Width,Selection_Color,In_Original_Order);
    Table=A_Table_Panel.Table;
    scrollPane=A_Table_Panel.scrollPane;
    Column_Width=A_Table_Panel.Column_Width;
    data=A_Table_Panel.data;
    catch (Exception e) { e.printStackTrace(); }
    public void setPreferredSize(Dimension A_Dimension) { scrollPane.setPreferredSize(A_Dimension); }
    // This method picks good column sizes. If all column heads are wider than the column's cells' contents, then you can just use column.sizeWidthToFit().
    void initColumnSizes(JTable table,TableModel model)
    TableColumn column=null;
    Component comp=null;
    int headerWidth=0,cellWidth=0;
    Object[] longValues=(data.length>0)?data[0]:null;
    TableCellRenderer headerRenderer=table.getTableHeader().getDefaultRenderer();
    if (data.length<1) return;
    for (int i=0;i<model.getColumnCount();i++)
    column=table.getColumnModel().getColumn(i);
    comp=headerRenderer.getTableCellRendererComponent(null,column.getHeaderValue(),false,false,0,0);
    headerWidth=comp.getPreferredSize().width;
    comp=table.getDefaultRenderer(model.getColumnClass(i)).
    getTableCellRendererComponent(table,longValues[i],false,false,0,i);
    cellWidth=comp.getPreferredSize().width;
    switch (Preffered_Width)
    case Max_Header_Cell_Width : column.setPreferredWidth(Math.max(headerWidth,cellWidth));break;
    case Header_Width : column.setPreferredWidth(headerWidth);break;
    case Cell_Width : column.setPreferredWidth(cellWidth);break;
    Column_Width[i]=column.getPreferredWidth();
    if (Debug) Out("Initializing width of column "+i+". "+"headerWidth="+headerWidth+"; cellWidth="+cellWidth+" Column_Width["+i+"]="+Column_Width[i]);
    // Detects a state change in any of the Lists. Resets the variable corresponding to the selected item in a particular List. Invokes changeFont with the currently selected fontname, style and size attributes.
    public void itemStateChanged(ItemEvent e)
    Out(e.toString());
    if (e.getStateChange() != ItemEvent.SELECTED) return;
    Object list=e.getSource();
    public static void Out(String message) { System.out.println(message); }
    // Create the GUI and show it. For thread safety, this method should be invoked from the event-dispatching thread.
    static void Create_And_Show_GUI()
    boolean Demo_External_Table=true;
    // boolean Demo_External_Table=false;
    final Table_Panel demo;
    String[] columnNames={"First Names","Last Names","Sport","Num of Years","Vegetarian"};
    Object[][] data={{"Mary","Campione","Snowboarding"+"[123456789]",new Integer(5),new Boolean(false)},
    {"Alison","Huml","Rowing"+":123456789]",new Integer(3),new Boolean(true)},
    {"Frank","Ni","Running"+":123456789", new Integer(12), new Boolean(false)},
    {"Kathy","Walrath","Chasing toddlers"+"<123456789>", new Integer(2), new Boolean(false)},
    {"Mark", "Andrews","Speed reading",new Integer(20),new Boolean(true)},
    {"Angela","Lih","Teaching high school",new Integer(36),new Boolean(false)} };
    // Row_Color_Style=Row_Color_Style_Default;
    // Row_Color_Style=Row_Color_Style_None;
    // Row_Color_Style=Row_Color_Style_Blue_Gray;
    Row_Color_Style=Row_Color_Style_Cyan_Gray;
    // Row_Color_Style=Row_Color_Style_Blue;
    // Row_Color_Style=Row_Color_Style_Gray;
    // Row_Color_Style=Row_Color_Style_Red_Green;
    // Row_Color_Style=Row_Color_Style_Green_Yellow;
    // Row_Color_Style=Row_Color_Style_Red_Yellow;
    Preffered_Width=Max_Header_Cell_Width;
    if (Demo_External_Table) demo=new Table_Panel("External Table Demo",columnNames,data,data.length,false,Demo_External_Table,false,Row_Color_Style,Max_Header_Cell_Width,Default_Selection_Color,true);
    else
    JFrame Table_Frame=new JFrame("Internal Table Demo");
    // demo=new Table_Panel(Nm_Lib.Dir_A_Test+"ELX.csv",false,Row_Color_Style,Preffered_Width,null);
    // demo=new Table_Panel(Nm_Lib.Dir_Stock_Data+"ABV_Data.txt",false,Row_Color_Style,Preffered_Width," ");
    demo=new Table_Panel("C:/Dir_Stock_Data/EOP.txt",",",false);
    // demo=new Table_Panel(Nm_Lib.Dir_Stock_Data+"ABV_Data.txt"," ",false);
    Table_Frame.getContentPane().add(demo.scrollPane);
    Table_Frame.addWindowListener(new WindowAdapter()
    public void windowActivated(WindowEvent e) { }
    public void windowClosed(WindowEvent e) { }
    public void windowClosing(WindowEvent e) { System.exit(0); }
    public void windowDeactivated(WindowEvent e) { }
    public void windowDeiconified(WindowEvent e) { demo.repaint(); }
    public void windowGainedFocus(WindowEvent e) { demo.repaint(); }
    public void windowIconified(WindowEvent e) { }
    public void windowLostFocus(WindowEvent e) { }
    public void windowOpening(WindowEvent e) { demo.repaint(); }
    public void windowOpened(WindowEvent e) { }
    public void windowResized(WindowEvent e) { demo.repaint(); }
    public void windowStateChanged(WindowEvent e) { demo.repaint(); }
    Table_Frame.pack();
    Table_Frame.setBounds((Screen_Size.width-Table_Frame.getWidth())/2,(Screen_Size.height-Table_Frame.getHeight())/2,Table_Frame.getWidth(),Table_Frame.getHeight());
    Table_Frame.setVisible(true);
    public static void main(String[] args)
    // Schedule a job for the event-dispatching thread : creating and showing this application's GUI.
    SwingUtilities.invokeLater(new Runnable() { public void run() { Create_And_Show_GUI(); } });
    * TableSorter is a decorator for TableModels; adding sorting functionality to a supplied TableModel. TableSorter does not store
    * or copy the data in its TableModel; instead it maintains a map from the row indexes of the view to the row indexes of the
    * model. As requests are made of the sorter (like getValueAt(row, col)) they are passed to the underlying model after the row numbers
    * have been translated via the internal mapping array. This way, the TableSorter appears to hold another copy of the table
    * with the rows in a different order.
    * <p/>
    * TableSorter registers itself as a listener to the underlying model, just as the JTable itself would. Events recieved from the model
    * are examined, sometimes manipulated (typically widened), and then passed on to the TableSorter's listeners (typically the JTable).
    * If a change to the model has invalidated the order of TableSorter's rows, a note of this is made and the sorter will resort the
    * rows the next time a value is requested.
    * <p/>
    * When the tableHeader property is set, either by using the setTableHeader() method or the two argument constructor, the table
    * header may be used as a complete UI for TableSorter. The default renderer of the tableHeader is decorated with a renderer
    * that indicates the sorting status of each column. In addition, a mouse listener is installed with the following behavior:
    * <ul>
    * <li>
    * Mouse-click: Clears the sorting status of all other columns and advances the sorting status of that column through three
    * values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to NOT_SORTED again).
    * <li>
    * SHIFT-mouse-click: Clears the sorting status of all other columns and cycles the sorting status of the column through the same
    * three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
    * <li>
    * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that the changes to the column do not cancel the statuses of columns
    * that are already sorting - giving a way to initiate a compound sort.
    * </ul>
    * <p/>
    * This is a long overdue rewrite of a class of the same name that first appeared in the swing table demos in 1997.
    * @author Philip Milne
    * @author Brendon McLean
    * @author Dan van Enckevort
    * @author Parwinder Sekhon
    * @version 2.0 02/27/04
    class TableSorter extends AbstractTableModel
    public static final long serialVersionUID=26362862L;
    protected TableModel tableModel;
    public static final int DESCENDING = -1;
    public static final int NOT_SORTED = 0;
    public static final int ASCENDING = 1;
    private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
    public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) o1).compareTo(o2); } };
    public static final Comparator LEXICAL_COMPARATOR = new Comparator() { public int compare(Object o1, Object o2) { return o1.toString().compareTo(o2.toString()); } };
    private Row[] viewToModel;
    private int[] modelToView;
    private JTableHeader tableHeader;
    private MouseListener mouseListener;
    private TableModelListener tableModelListener;
    private Map<Class,Comparator> columnComparators = new HashMap<Class,Comparator>();
    private List<Directive> sortingColumns = new ArrayList<Directive>();
    public TableSorter()
    this.mouseListener = new MouseHandler();
    this.tableModelListener = new TableModelHandler();
    public TableSorter(TableModel tableModel)
    this();
    setTableModel(tableModel);
    public TableSorter(TableModel tableModel, JTableHeader tableHeader)
    this();
    setTableHeader(tableHeader);
    setTableModel(tableModel);
    private void clearSortingState()
    viewToModel = null;
    modelToView = null;
    public TableModel getTableModel() { return tableModel; }
    public void setTableModel(TableModel tableModel)
    if (this.tableModel != null) { this.tableModel.removeTableModelListener(tableModelListener); }
    this.tableModel = tableModel;
    if (this.tableModel != null) { this.tableModel.addTableModelListener(tableModelListener); }
    clearSortingState();
    fireTableStructureChanged();
    public JTableHeader getTableHeader() { return tableHeader; }
    public void setTableHeader(JTableHeader tableHeader)
    if (this.tableHeader != null)
    this.tableHeader.removeMouseListener(mouseListener);
    TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
    if (defaultRenderer instanceof SortableHeaderRenderer) this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
    this.tableHeader = tableHeader;
    if (this.tableHeader != null)
    this.tableHeader.addMouseListener(mouseListener);
    this.tableHeader.setDefaultRenderer(
    new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));
    public boolean isSorting() { return sortingColumns.size() != 0; }
    private Directive getDirective(int column)
    for (int i = 0; i < sortingColumns.size(); i++)
    Directive directive = (Directive)sortingColumns.get(i);
    if (directive.column == column) { return directive; }
    return EMPTY_DIRECTIVE;
    public int getSortingStatus(int column) { return getDirective(column).direction; }
    private void sortingStatusChanged()
    clearSortingState();
    fireTableDataChanged();
    if (tableHeader != null) { tableHeader.repaint(); }
    public void setSortingStatus(int column, int status)
    Directive directive = getDirective(column);
    if (directive != EMPTY_DIRECTIVE) { sortingColumns.remove(directive); }
    if (status != NOT_SORTED) { sortingColumns.add(new Directive(column, status)); }
    sortingStatusChanged();
    protected Icon getHeaderRendererIcon(int column, int size)
    Directive directive = getDirective(column);
    if (directive == EMPTY_DIRECTIVE) { return null; }
    return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));
    private void cancelSorting()
    sortingColumns.clear();
    sortingStatusChanged();
    public void setColumnComparator(Class type, Comparator comparator)
    if (comparator == null) { columnComparators.remove(type); }
    else { columnComparators.put(type, comparator); }
    protected Comparator getComparator(int column)
    Class columnType = tableModel.getColumnClass(column);
    Comparator comparator = (Comparator) columnComparators.get(columnType);
    if (comparator != null) { return comparator; }
    if (Comparable.class.isAssignableFrom(columnType)) { return COMPARABLE_COMAPRATOR; }
    return LEXICAL_COMPARATOR;
    private Row[] getViewToModel()
    if (viewToModel == null)
    int tableModelRowCount = tableModel.getRowCount();
    viewToModel = new Row[tableModelRowCount];
    for (int row = 0; row < tableModelRowCount; row++) { viewToModel[row] = new Row(row); }
    if (isSorting()) { Arrays.sort(viewToModel); }
    return viewToModel;
    public int modelIndex(int viewIndex) { return getViewToModel()[viewIndex].modelIndex; }
    private int[] getModelToView()
    if (modelToView == null)
    int n = getViewToModel().length;
    modelToView = new int[n];
    for (int i = 0; i < n; i++) { modelToView[modelIndex(i)] = i; }
    return modelToView;
    // TableModel interface methods
    public int getRowCount() { return (tableModel == null) ? 0 : tableModel.getRowCount(); }
    public int getColumnCount() { return (tableModel == null) ? 0 : tableModel.getColumnCount(); }
    public String getColumnName(int column) { return tableModel.getColumnName(column); }
    public Class getColumnClass(int column) { return tableModel.getColumnClass(column); }
    public boolean isCellEditable(int row, int column) { return tableModel.isCellEditable(modelIndex(row), column); }
    public Object getValueAt(int row, int column) { return tableModel.getValueAt(modelIndex(row), column); }
    public void setValueAt(Object aValue, int row, int column) { tableModel.setValueAt(aValue, modelIndex(row), column); }
    // Helper classes
    private class Row implements Comparable
    private int modelIndex;
    public Row(int index) { this.modelIndex = index; }
    public int compareTo(Object o)
    int row1 = modelIndex;
    int row2 = ((Row) o).modelIndex;
    for (Iterator it = sortingColumns.iterator(); it.hasNext();)
    Directive directive = (Directive) it.next();
    int column = directive.column;
    Object o1 = tableModel.getValueAt(row1, column);
    Object o2 = tableModel.getValueAt(row2, column);
    int comparison = 0;
    // Define null less than everything, except null.
    if (o1 == null && o2 == null) { comparison = 0; }
    else if (o1 == null) { comparison = -1; }
    else if (o2 == null) { comparison = 1; }
    else { comparison = getComparator(column).compare(o1, o2); }
    if (comparison != 0) { return directive.direction == DESCENDING ? -comparison : comparison; }
    return 0;
    private class TableModelHandler implements TableModelListener
    public void tableChanged(TableModelEvent e)
    // If we're not sorting by anything

  • 4 basic java questions..

    ok so I already learned Java last year (in grade 11), but my teacher didn't really teach anything, we learnt everything by ourselves from the API... so theres a lot of things I actually don't understand, but for now I want to ask 4 basic questions:
    1. What does static mean?
    2. Why would u "final" a constant variable? ie. If you have a variable called SIZE which is set to 5, so if u want it to be a constant, just never change its value. But what does the keyword final do to it?
    3. What's super? I see it sometimes, and my teacher showed us in the applet exampls to use super.paint(g) or somethign like that for the paint method, but I never use that because I noticed it works fine without it..
    4. Whats a question mark? I saw a game that was made in java and it had a lot of places where it had a question mark , which was part of the syntax. For example,
    int j1 = i != 0 ? i - 1 : 199;
    OR
    JUMPVEL = (fSuperSlime) ? 65 : 31;
    I really don't understand these lines...
    feel free to answer any of these questions...

    wow cool...thanks.. that question mark thing is nice
    saves a few lines..
    now, about super, so u mean u can access the parent
    class's variables?Variables, methods, constructors, if the access level is such that it's allowed.
    This will be covered in any tutorial or text though.
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

  • Java problems-locking

    i have 10.6 and the latest download of java. I am trying to run Scottrader Streaming quotes and it locks up constantly/ Tech support suggest it is a java problem and i have a bad instalition of jave which i do not understand as software update installed it for me. the problem is that the java application will suddenly stop running/ any ideas? scottrade suffested reinstalling java. ig that is needed how do i unstall java?

    If Java functions at all, then it is not apt to be an issue with the Java installation. There's really no such thing as a "bad installation of Java". Java will run or it will crash. Lock-ups are generally the result of application errors or communication errors (e.g., it's waiting on a responsed from a server that never comes).
    You can reinstall Java using Pacifist and your restore DVD. I doubt that it will be worth your time, however.

  • Error Code 16 on Mac with Newly-Installed Yosemite (a Java problem?)

    Like many out there I am unable to use CS6 applications at all after an OS update to Yosemite (in my case from 10.8.5, on my 2012 iMac).  I get an Error 16 message, and a Java problem error message.
    I've read many posts about fixing this issue, including the Adobe gospel very specific to this problem—about changing the permissions in a couple of folders—, which I found here: https://helpx.adobe.com/x-productkb/policy-pricing/configuration-error-cs5.html   I did exactly as directed and saw no change in the problem. 
    I also read that the Java version necessary for CS6 products to run on Yosemite is a boondoggle in itself.  Java 6 is apparently necessary for CS6 products to run, but that version is insecure, and besides, it's old.   Java 8 Build 31 is the current and safe version but it apparently is incompatible with none but the most recently-updated Adobe products.  Several posts on Adobe's support pages suggest a hacky fix for this Java issue, which involves downloading and installing the latest Java version from Oracle, and then creating specifically-named empty folders on one's hard drive within a couple of obscure System/Library/Java folders:
    http://oliverdowling.com.au/2014/03/28/java-se-8-on-mac-os-x/
    https://forums.adobe.com/message/7193884
    I did this too, and again saw no change in the problem.
    Re-installing my CS6 suite has not worked, either.  I receive the same error code message when starting up any of the applications.  At this point I've been forced to go back to my previous operating system, since I am heavily reliant on CS6 to do my work each day. 
    I understand that many people are having this trouble after updating to Yosemite, and more than a few posts on these forums indicate this is true even for people like me who've followed Adobe's purported fix that I linked above.  Has anyone in userland or at Adobe found anything lately that could help here? 

    uninstall cs6 and clean (Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6).
    update your os, Java for OS X 2014-001
    then install cs6.

  • Installing 9.2.0.4.0 on EL4 - Can't start netca, JAVA problem!!!!

    Dear all,
    Please help with my Java problem. Thanks in advance.
    After successfully installed Oracle 9.2.0.4.0 on EL4, I tried to start netca but I received this error message:
    [oracle@localhost bin]$ ./netca: line 138: /u01/app/oracle/product/9.2.0.4.0/JRE/bin/jre: No such file or directory
    The JRE link at $ORACLE_HOME is as follows:
    lrwxrwxrwx 1 oracle oinstall 21 Oct 27 17:41 JRE -> /usr/java/jre1.6.0_03
    .bash_profile as follows:
    ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/product/9.2.0.4.0; export ORACLE_HOME
    ORACLE_TERM=xterm; export ORACLE_TERM
    PATH=$ORACLE_HOME/bin:$PATH; export PATH
    ORACLE_OWNER=oracle; export ORACLE_OWNER
    ORACLE_SID=OSIM; export ORACLE_SID
    LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib; export CLASSPATH
    LD_ASSUME_KERNEL=2.6.9; export LD_ASSUME_KERNEL
    What do you guys think my problem is?

    I managed to solve this one. For more information you can search the forum with much earlier dates, as far as 2002. I'm very outdated.
    In case you need the solution:
    I tried using java 1.3.1 provided together with the Oracle9iR2 installation Disks instead of 1.1.8.
    1. Delete the JRE link in $ORACLE_HOME
    2. Relink it to 1.3.1 directory
    3. create a jre symbolic link in the bin directory to the .java_wrapper
    4. create another jre symbolic link in the i386/nativethreads directory to the java file
    Good luck

  • Java problem [build 5]

    java problem
    Well my latest build of java stopped working after Tuesday's Microsoft updates. I cant believe those updates are connected as to why this java build 5 should have stop working like that as the Standard Edition, v 1.4.2_08 (J2SE)works fine
    Any ideas anyone as to why this should have happened
    thanks
    --

    Sending this back to the top.. I have seen on a couple other forums where people were having this problem, but no answers yet.

  • Berkeley DB master-slave replication basic java code example

    Hi,
    I am new user of berkeley db and I have limited knowledge of Java programming. Can someone help me with basic Java example code of how to do master-slave replication without elections.
    Thanx,
    Jani

    Hello,
    Please clarify a few points about your program:
    1. What platform and Berkeley DB version are you using?
    2. Are you planning on using the replication framework
    or base replication API for your application?
    3. When you say you want replication without elections,
    what exactly does that mean. For example, if you are using
    the replication framework elections are held transparently
    without any input from your application's code. In this case,
    DB will determine which environment is the master and which
    are replicas. Is that what you are thinking about or
    something else?
    Thanks,
    Sandra

Maybe you are looking for