Pointer to a class?

I have a class Dictionary
public class Dictionary
private HashMap<String, ArrayList<String>> dictionary;
private HashMap<String, ArrayList<Details>> synset;
public Dictionary()
dictionary = new HashMap<String, ArrayList<String>>();
synset = new HashMap<String, ArrayList<Details>>();
//some methods
and a class Details
public class Details
private String word;
private String type;
private String meaning;
private String w_num;
private String sense_num;
private String tag_count;
private ArrayList<String> hyponyms;
private ArrayList<String> meronyms;
public Details(String word, String type, String meaning, String w_num, String sense_num, String tag_count)
this.word = word;
this.type = type;
this.meaning = meaning;
this.w_num = w_num;
this.sense_num = sense_num;
this.tag_count = tag_count;
hyponyms = new ArrayList<String>();
meronyms = new ArrayList<String>();
The dictionary class reads a file and creates Details objects. I have a method which allows me to enter a word into the dictionary HashMap which gives an id. I can put this into the synset HashMap to retrieve it's detail object. This can is passed to the Details class where a toString() method prints the details. A detail object has two array lists, hyponyms and meronyms (related words) which give an id.
What I want to do is pass the hyponym and meronym id's back to the synset HashMap in the dictionary class and retrieve the details. It is possible by using a pointer to the synset hashmap in the Detail constructer but I don't think the Detail class should be able to access the HashMaps at this level. I want a pointer to the dictionary class itself so I can access the HashMaps using defined accessor methods. Can anyone suggest how to do this?

warnerja wrote:
georgemc wrote:
Details details = new Details(dictionary); // note that Details must have a constructor that takes a Dictionary... or the Details class could provide a property which can be set thru means other than via a constructor. georgemc was giving you an example, but I just want the OP to know in case it isn't clear, that this is not the only way.
Details could have a method named "setDictionary" which accepts a Dictionary object, and you pass yours to it, and it keeps a reference so that it can invoke the methods when it needs to.Absolutely. In fact, if you envisage changing dictionaries at runtime, you would be well advised to provide this setter method. If a Details object must have a Dictionary to do its work, I'd still pass it in via a constructor, but there aren't any rules around this

Similar Messages

  • Can I pass a pointer to a class?

    Is there a way to copy a pointer of a data class ?
    I have an event with a Student class (studentid, lastname, firstname) and I want to pass the address of the original student in the event, so that the eventListener can modify the original Student.
    How can this be done?
    The custom event  has a  var student:Student ;
    when I create a new event:
    var myEvent:StudentEvent = new StudentEvent('clicked');
    myEvent.student = clickedStudent;
    then myEvent.student is a copy of clickedStudent,
    I want them to be the same object.
    thanks,
    steve

    then myEvent.student is a copy of clickedStudent,
    No it's not. It's a copy of the reference to the student.
    I want them to be the same object.
    They are.
    clickedStudent is a pointer to the object, not the object itself.

  • Hibernate oneToOne points to same class

    Hi , sorry for posting this here but i think the calahary desert gets more traffic than the hibernate forums , i have a problem with a hiberante entity that points to same type class entity that i can't seem to get hibernate to work with
    public class User implements Serializable{
    private User referer;
    @Id
    @NotNull
    @Column(name="username")
    public String getUserName() {return userName;}
    public void setUserName(String userName) {this.userName = userName;}
    @NotNull
    @OneToOne
    @PrimaryKeyJoinColumn
    public User getReferer() {return referer;}
    public void setReferer(User referer) {this.referer = referer;}
    }i've tried other ways like mappedby="userName" etc.. but it keeps rejecting it any idea why ?

    Kernel_77 wrote:
    Duffy i think you a bit on the extreme saying that a hibernate annotation has got nothing to do with hibernate isn't completly true No, I said that the problem seems to have little to do with Hibernate and everything to do with a lack of understanding of relational databases and foreign key relationships.
    ofcourse hibernate mirrors rational relathionship that's the whole idea in it and the JPA .Yes, I get it. You're misunderstanding me.
    DB wise the FK is defined to username which is the PK and i still think you are not correct ,i read hibernate's manual again and mapped by refers to the way in which the relathionship on the other side (where each annotation is defined)
    is MappedBy . Nope, I'd say you're the one that's wrong and Hibernate seems to agree with me.
    the problem here is how to define the relation on the "other side" username when both are in the same class .You still haven't posted the table, so I'll try to make something up to show you how it's done. I'll post it as soon as I can.
    %

  • What is the point of an abstract class?

    ok lets say there was a subclass that inhereited another subclass...like a class Person, a class Student, and a class GraduateStudent; why would i want to make the class person abstract and have a abstract void display(); in it if i want to override that method in the subclasses lower on the inheritance tree? Wouldn't it do the same thing to just make a normal class Person and just not have a void display...and the other 2 over ride it anyways so i seriously dont see what the point of abstract classes are

    ok lets say there was a subclass that inhereited
    another subclass...like a class Person, a class
    Student, and a class GraduateStudent; why would i
    want to make the class person abstract and have a
    abstract void display(); Because all Persons are required to be able to display(), but there's no reasonable common default behavior for display() that you can put in the base class.
    Abstract methods say, "Everything of this type must be able to do this, but it's up to the individual implementations to figure out *how* to do it."
    in it if i want to override
    that method in the subclasses lower on the
    inheritance tree? Wouldn't it do the same thing to
    just make a normal class Person and just not have a
    void display..Then you couldn't do this: Person p = getAPersonThatMightBeAStudentOrWhateverWeDoNotKnowWhat();
    p.display();or this:
    void doPersonStuff(Person p) {
      p.display();
    Person s1 = new Student();
    Student s2 = new Student();
    Person t1 = new Teacher();
    Teacher t2 = new Teacher();
    doPersonStuff(s1);
    doPersonStuff(s2);
    doPersonStuff(t1);
    doPersonStuf(t2);
    .and the other 2 over ride it anyways
    so i seriously dont see what the point of abstract
    classes areI hope you do now.
    Message was edited by:
    jverd

  • How to use one variable for 2 datatype inside class

    Dear all
    i have create 2 class GDI and OGL need use use in M_VIEW as per condition
    in the class M_VIEW (example below)
    #define M_FLAG 1
    class GDI {public: int z;};
    class OGL{public: double z;};
    // in class M_VIEWi need to use GDI or OGL as per user condition
    class M_VIEW{
    public:
    #if (M_FLAG == 1)
    GID UseThis;
    #else
    OGL UseThis;
    #endif
    this is work but it always it take OGL. of if i change condition it take GDI only. but i need to use it runtime as per user choice.
    how to switch GDI to OGL, and OGL to GDI on runtime ;
    is that possible to change M_FLAG  value on run time or is there any other way to achieve it.
    i have try with polymorphism also. switch is ok but all function does not work with dll. when call function on mouse move or some other event it take base class virtual function. it doesn't goes to derived class function. don't know why?
    base class function like this and does not have any variable. all function are virtual.
    virtual void MoveLine(POINT pt1, POINT pt2){};
    virtual void DrawLine(POINT pt1, POINT pt2){};
    please help.
    Thanks in Advance.

    Well, #define, and #if are compile time only constructs.  Technically they are processed before you program is compiled (that is why they are called preprocessor directives).  If you need to support both flavors at runtime you will need a different
    approach.
    Inheritance/polymorphism could be a good approach here, but I don't really understand what you are trying to do well enough to say for sure.  Based on guesses about what you want, here are some thoughts.
    class GDI {public: int z;};
    class OGL{public: double z;};
    class M_VIEW_BASE {
    virtual void MoveLine(POINT pt1, POINT pt2) = 0;
    virtual void DrawLine(POINT pt1, POINT pt2) = 0;
    class M_VIEW_GDI {
    GDI UseThis;
    void MoveLine(POINT pt1, POINT pt2) override {}
    void DrawLine(POINT pt1, POINT pt2) override {}
    class M_VIEW_OGL {
    OGL UseThis;
    void MoveLine(POINT pt1, POINT pt2) override {}
    void DrawLine(POINT pt1, POINT pt2) override {}
    std::unique_ptr<M_VIEW_BASE> drawBase;
    enum DrawMode { DrawGdi, DrawOgl };
    extern "C" __declspec(dllexport) void Init(DrawMode whichMode) {
    if (drawMode == DragGdi) {
    drawBase.reset(new M_VIEW_GDI);
    } else if (drawMode == DrawOgl) {
    drawBase.reset(new M_VIEW_OGL);
    } else {
    throw std::runtime_exception("whoops");
    extern "C" __declspec(dllexport) void MoveLine(POINT pt1, POINT pt2) {
    drawBase->MoveLine(pt1, pt2);
    extern "C" __declspec(dllexport) void DrawLine(POINT pt1, POINT pt2) {
    drawBase->DrawLine(pt1, pt2);

  • Error with instance variable and constructor of base class

    I am getting the error on the following statement "protected Point apoint" of by base class. What is causing this problem? See my code:
    package Shapes;
    public abstract class Shapes
         protected Point apoint; / ****error at this line****/
         public void move(double xdelta, double ydelta)
              apoint.x += xdelta;
              apoint.y += ydelta;
    public abstract void distance();
    public abstract void show();
    public String toString()
    return "\nThe starting point is at coordinates ("+x+","+y+")";
    package Shapes;
    public class Lines extends Shapes
    protected Point start;
    protected Point end;
         protected double x;
         protected double y;
         double delta;
         public Lines( final Point apoint, final Point bpoint)
    start.x = apoint.x;
              start.y = apoint.y;
              end.x = bpoint.x;
              end.y = bpoint.y;
    public Lines(double xstart, double ystart, double xend, double yend)
    this.xstart = xstart;
              this.ystart = ystart;
              this.xend = xend;
              this.yend = yend;
         public Lines(double x, double y)
              this.x = x;
              this.y = y;
                   public void distance(final Lines start, final Lines end)
                        delta = abs(Math.sqrt (super.x - start.x) * (super.x - end.x) +
                        (super.y - start.y) * (super.y - end.y));
                   Lines move(Point start, double delta)
                        end.x += delta;
                        end.y += delta;
                        return new Point(end);
    public Lines show()
    g.drawLine( start.x, start.y, end.x, end.y);
    public String toString()
    return super.toString()+ "\n moved distance is("
                   + start + ") : (" + end + ")"
                   +" \n to position(" + start + " ) : (" + end + ")";
    package Shapes;
    public class Rectangle extends Lines
         double delta;
    public Rectangle (Point top_lft_pt, Point bottom_rght_pt)
    super(top_lft_pt, bottom_rght_pt);
    public Rectangle(double x_top_lft, double y_top_lft, double x_bottom_rght, double y_bottom_rght)
    super(x_top_lft, y_top_lft, x_bottom_rght, y_bottom_rght);
         public Rectantgle is_it_diagonal()
              if(top_lft.x > bottom_rght.x && bottom_rght.x < top_lft.x)
                   System.out.println("Point are Not Diagonal");
                   public void distance(double delta)
                        delta = abs(Math.sqrt (top_lft.x - bottom_rght.x) * (top_lft.x - botton_rght.x) +
                        (top_lft.y - bottom_rght.y) * (top_lft.y - bottom_rght.y));
                   public Rectangle move(final Point top_lft_pt, double delta)
                        bottom_rght.x += delta;
                        bottom_rght.y += delta;
                        return new Point(bottom_rght_pt);
                   public void get_top_rght_coords()
                        Point top_rght = new Point();
                        top_rght.x = bottom_rght.x;
                        top_rght.y = top_lft.y;
                   public void get_bottom_left_coords()
                        Point bottom_lft = new Point();
                        bottom_lft.x = top_lft.x;
                        bottom_lft.y = bottom_rght.y;
         public Rectangle show()
                        g.drawLine(top_lft.x, top_lft.y, top_rght_x, top_rght_y);
                        g.drawLine(bottom_lft.x, bottom_lft.y, bottom_rght.x, bottom_rght.y);
                        g.drawLine(top_lft.x, top_lft.y, bottom_lft.x, bottom_lft.y);
                        g.drawLine(top_rght.x, top_rght.y, bottom_rght.x, bottom_rght.y);
    package Shapes;
    public class Circles extends Lines
    protected double radius;
         public double delta;
         protected Point center;
    public Circles(double x, double y, double radians)
    super(x, y);
              radius = radians;
         public Circles(Point acenter)
              center.x = acenter.x;
              center.y = acenter.y;
    public void distance()
    delta = abs(Math.sqrt(super.x - x) * (super.x - x) + (super.y - y) * (super.y -y));
         public Circles move(final Point Circles, double delta)
              return new Point(Circles);
    public void show()
    g.drawOval(Circles.x, Circles.y, radius, radius);
    package Shapes;
    import java .math .*;
    import java.util .Random ;
    public class ShapesDriver
    Shapes[] aShape = new Shapes[10];
    static double range = 101.0;
    static Random r1 = new Random();
    public static void main(String [] args)
    double[][] coords = new double[10][10];
    double[] radians = new double [10];
    Shapes anyShape = {
    new Circles(radians),
    new Lines(coords),
    new Rectangle(coords)
    Shapes aShape; /***error at this line***/
              for(int i = 1; i <= coords.length; i++)
    for(int j = 1; j <= coords.length; j++)
                                                      coords[i][j] = r1.nextDouble () * range;
                                                      radians[j] = r1.nextDouble () * range;
    aShape[i] = anyShape[r1.nextInt(aShape.length)];
    System.exit(1);

    Thanks for your help with this problem. Now I have another problem that I am having a hard time figuring out. My program is using inheritance and polymorphism. I trying to use only one version of methods in the superclass points which extends the shapes class which is the abstract superclass vs. repeating the implementation of the methods (move, show, etc.) in each of the subclasses. The error I am getting is this "declare the class abstract, or implement abstract member 'Point Shapes.move()'. As you see, move is declared abstract and of type point in the Shapes superclass and it's behavior is implemented in the subclass Points extending Shapes. The other subclasses, circle, rectangle and lines will invoke the move method from Points and return a new point object. Why I am I getting the error to declare or implement move when the implementation is in Point?
    Below is code, please help?
    import java .awt .Point ;
    public class ShapesDriver
         public static void main(String args[])
              int count = 0;
              int choice;
              Point start = null;
              Point end = null;
              System.out .println(" 1 i am here");
              start = new Point((int)(Math.random()* 10.0), (int)(Math.random()* 10.0));
              end = new Point((int)(Math.random()* 10.0), (int)(Math.random()* 10.0));
         System.out .println(" 2 i am here");     
         System.out.println (start);
         System.out.println(end);                         
         for(int i = 0; i <= count; i++)
              System.out .println(" 3 i am here");
              choice = (int)(4.0 * Math.random());
              System.out .println(" 4 i am here");
              System.out.println (choice);     
         switch(choice)
              case 0: //Lines
              System.out .println(" 5 i am here");
              Lines apoint = new Lines((int)(Math.random()* 10.0), (int)(Math.random()* 10.0),
                                  (int)(Math.random()* 10.0), (int)(Math.random()* 10.0));
              Point coords = new Point((int)(Math.random()* 10.0),
                             (int)(Math.random()* 10.0));
              new Point((int)(Math.random()* 10.0),
                             (int)(Math.random()* 10.0));
              break;
              case 1: //Circles
              System.out .println(" 6 i am here");
              Circles center = new Circles((double)(Math.random()* 10.0),
              (double)(Math.random()* 10.0), (double)(Math.random()* 10.0),
              (double)(Math.random()* 10.0),(double)(Math.random()* 10.0));
              Circles centerpt = new Circles((int)(Math.random()* 10.0),
              (int)(Math.random()* 10.0), (int)(Math.random()* 10.0),
              (int)(Math.random()* 10.0), (double)(Math.random()* 10.0));
         break;
              case 2: //Rectangles
         System.out .println(" 7 i am here");
              Rectangle top_lft_pt = new Rectangle ((double)(Math.random()* 10.0),
                             (double)(Math.random()* 10.0), (double)(Math.random()* 10.0),
                             (double)(Math.random()* 10.0), (double)(Math.random()* 10.0),
                             (double)(Math.random()* 10.0));
              Rectangle bottom_rgt_pt = new Rectangle ((double)(Math.random()* 10.0),
                   (double)(Math.random()* 10.0), (int)(Math.random()* 10.0),
                             (int)(Math.random()* 10.0), (int)(Math.random()* 10.0),
                             (int)(Math.random()* 10.0));
         break;
         default:
         System.out .println(" 9 i am here");
         System.out.println("\nInvalid shape choice =" + choice);
         System.exit(0);
         break;
         try
                   System.in.read();
                   catch(java.io.IOException ioe)
    import java .awt .Point ;
    public abstract class Shapes
         private String shape;
         public Shapes(String ashape)
              shape = new String(ashape);
         public abstract Point move();
         public double distance()
              return 0.0;
         public abstract void show();
         public String toString()
              return "\nThis shape is a" + shape;
    import java .awt .Point ;
    public class Rectangle extends Points
         protected Point top_lft;
         protected Point top_rgt;
         protected Point bottom_lft;
         protected double top_lft_x;
         protected double top_lft_y;
         protected double bottom_rgt_x;
         protected double bottom_rgt_y;
         protected Point bottom_rgt;
         protected double delta = 0;
         protected String shape = "Rectangle";
         public Rectangle(double x, double y, double top_lft_x,
                             double top_lft_y, double bottom_rgt_x,
                             double bottom_rgt_y)
              super(x, y);
              top_lft_x = top_lft_x;
              top_lft_y = top_lft_y;
              bottom_rgt_x = bottom_rgt_x;
              bottom_rgt_y = bottom_rgt_y;
         public Rectangle( double x, double y, Point bottom_rgt, Point top_lft)
              super(x, y);
              bottom_rgt_x = bottom_rgt.x;
              bottom_rgt_y = bottom_rgt.y;
              top_lft_x = top_lft.x;
              top_lft_y = top_lft.y;
         public String toString()
              return super.toString() + " coordinates top left= " + top_lft_x + "," + top_lft_y + "and bottom right" +
                   bottom_rgt_x + "," + bottom_rgt_y + ")";
         public void is_it_diagonal()
              if(top_lft_x < bottom_rgt_x && bottom_rgt_x > top_lft_x)
                   System.out.println("Points are Not Diagonal");
              public double distance()
                   distance ();
                   return delta;
              public Point move(Point top_lft)
                   move();
                   bottom_rgt_x += delta;
                   bottom_rgt_y += delta;
                   return top_lft;
              public void get_other_coords()
                   top_rgt.x = bottom_rgt.x;
              top_rgt.y = top_lft.y;
                   bottom_lft.x = top_lft.x;
                   bottom_lft.y = bottom_rgt.y;
              public void show()
                   super.show();
                   System.out.println("new coords are :");
                   System.out .println ("(" + top_lft_x + "," + top_lft_y + ")");
                   System.out .println ("top right(" + top_rgt + ")");
                   System.out .println ("(" + bottom_rgt_x + "," + bottom_rgt_y + ")");
                   System.out .println ("bottom right(" + bottom_rgt + ")");
    import java .awt .Point ;
    public class Points extends Shapes
         protected double delta = 0.0;
         protected double x;
         protected double y;
         protected String ashape = "Points";
         public Points( double x, double y)
              super("Points");
              x = x;
              y = y;
         public Points( Point start)
              super("Points");
              x = start.x;
              y = start.y;          
         public String toString()
              return super.toString() + "References coordinates(" + x + y + ")";
         public double distance(double x1, double y1 )
              return delta =(Math.sqrt(x - x1) * (x - x1) + (y - y1) *
              (y - y1));
         public Point move(Point pts)
              pts.x += delta;
              pts.y += delta;
              return pts;
         public void show()
              System.out.println("This shape is a" + ashape + "(" +
                                  "(" + x+ "," + y + ")");
    import java .awt .Point ;
    public class Lines extends Points
         double delta = 0;
         protected double x;
         protected double y;
         protected String ashape = "Lines";
         public Lines( double x1, double y1, double x, double y)
              super(x1,y1);
              x = x;
              y = y;
         public Lines(Point start, Point end)
              super(start);
              x = end.x;
              y = end.y;
         public String toString(Point end)
              return super.toString() + "line points = (" + x + "," + y +
                   "(" + end + ")";
         public double distance()
              distance ();
              return delta;
         public Point move(Point lines)
              move ();
              return lines;
         public void show()
              System.out.println("This shape is a" + ashape + "(" +
                                  "(" + x + "," + y + ")");
    import java .awt .Point ;
    public class Circles extends Points
    protected double radius;
    protected double xcenter;
    protected double ycenter;
    protected String ashape = "Circle";
         public Circles( double x, double y, double cx, double cy, double radians)
              super(x, y);
              xcenter = cx;
              ycenter = cy;
              radius = radians;
         public Circles( Point acenter, Point ref, double radians)
              super(ref);
              xcenter = acenter.x;
              ycenter = acenter.y;
              radius = radians;
         public String toString(Point ref)
              return super.toString() + " reference points (" +
                   ref + ")" +
                   "center coordinates (" + xcenter + "," + ycenter + ")";
              public double distance(Point ref)
                   return (Math.sqrt(ref.x - xcenter) * (ref.x - xcenter)
                             + (ref.y - ycenter) *
              (ref.y - ycenter));
              public Point move(Point center)
                   move();
                   return center;
              public void show()
                   System.out.println("This shape is a" + ashape + "(" +
                                  "(" + xcenter + "," + ycenter + ")");

  • Reading files from within helper classes

    From within a servlet, I can get the servlet context to get a path to the "web" directory of my project and easily access properties files for my project. If I create another package in my project to hold helper classes that perform some specific function and want to create and/or read from a properties file, I get a path to the bin directory of my servlet container:
    Servlet Path: D:\Documents and Settings\Josh\My Documents\Josh\Projects\ServletSandBox\build\web\
    Helper Class File Path: D:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\test
    I'd like to develop my helper packages as reusable APIs, so they're not tied directly to my project or to a servlet in general, but I'd like the properties files to stay somewhere in my project folder, preferably in the WEB-INF directory with the servlet's own specific properties file.
    I can't figure out the best way to handle this. I wanted to just be able to pass the helper class a String if somebody wanted to specify a filename other than the default filename. Does it make sense to specify a file URL instead? Is there any other way to get the calling servlet's context path without having to pass in a variable?
    Thanks

    It seems that the helper API shouldn't need to be given a path to its own config file. I would like to have code that will load the file regardless of whether or not its in a stand alone java app or a servlet. Whenever the helper API is jarred up and imported into my servlet, it can't find the config file unless it's in the "D:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\test" directory. OR, if I use the current thread to get the loader, it will locate it in the "classes" folder, which is the only solution I can come up with that will let me write code to load the file that will work, regardless of its implementation.
    The "project" folder I'm talking about is just the NetBeans "project" folder for the servlet, or the "ServetSandBox" folder in my example. I guess that doesn't really matter in the context of the servlet though.
    So is using the current thread the appropriate way to do this? When you say that code will work if I put the resource in the WEB-INF directory, that seems to only be true if I try to load it from the servlet itself, not the helper class. The helper class doesn't find the resource in the WEB-INF directory.
    Also, I would like to be able to write the default values to a new config file if one doesn't exist. How in the heck do I get a pointer to the "classes" folder, or any other folder that I can also read from using the classloader, so I can write to a new file?

  • Error-- Referencing classes from project 1 in project 2 using libraries option

    Using JDev 9.0.3
    I'm struggling with an error that's occuring that I know should not be...
    I have two projects (SessionUtils & TradingSumStruts).
    SessionUtils has 4 java files all of which have a package name of: com.arca.sessionutils.
    TradingSumStruts has 3 java files all of which have a package name of: com.arca.tradingsum.
    One of the java files in TradingSumStruts imports a class from SessionUtils
    import com.arca.sessionutils.SessionUtil;
    In TradingSumStruts project I have created a new user library and called it: SessionUtilsLib. This lib points to the classes directory of SessionUtils, and the src directory of SessionUtils in the same workspace.
    I've shut down the oc4j server, deleted any existing class files for the above two projects, and recompiled both projects. When I run the app, I get the following error:
    java.lang.NoClassDefFoundError: com/arca/sessionutils/SessionUtil
         void com.arca.tradingsum.TradingSumInfo.<init>(javax.servlet.http.HttpServletRequest)
              TradingSumInfo.java:67
    when I attempt to call SessionUtil.xxxMethod().
    I have double and triple checked my spelling, my library entries, my class files, and even re-booted my machine.
    ANY ideas would be greatly appreciated!
    -Teri
    [email protected]

    Don't use libraries for this. Define a project dependency for your project using the project properties dialog. This will automatically include your project classes without hardcoding the path into a library.

  • Problem in accessing database using a java class

    Hy Folks,
    I have written a class to retrive data from data base and compiled it.when I said java QueryExample, I am getting the following error message.It is as below.
    E:\>java QueryExample
    Loading JDBC Driver -> oracle.jdbc.driver.OracleDriver
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at QueryExample.<init>(QueryExample.java:37)
    at QueryExample.main(QueryExample.java:129)
    Creating Statement...
    Exception in thread "main" java.lang.NullPointerException
    at QueryExample.performQuery(QueryExample.java:70)
    at QueryExample.main(QueryExample.java:130)
    Now my question is can I run a jdbc program with out using any application server or webserver.
    If I can , what are all the packeages I have to down load, and how to set their classpath.
    Regards,
    Olive.

    My basic doubght is can we write a class like this.Here I give the sample code that I am using,,,, and using Oracle9i for Windows release 2 (9.2) .
    // QueryExample.java
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    * The following class provides an example of using JDBC to perform a simple
    * query from an Oracle database.
    public class QueryExample {
    final static String driverClass = "oracle.jdbc.driver.OracleDriver";
    final static String connectionURL = "jdbc:oracle:thin:@localhost:1521:O920NT";
    final static String userID = "scott";
    final static String userPassword = "tiger";
    Connection con = null;
    * Construct a QueryExample object. This constructor will create an Oracle
    * database connection.
    public QueryExample() {
    try {
    System.out.print(" Loading JDBC Driver -> " + driverClass + "\n");
    Class.forName(driverClass).newInstance();
    System.out.print(" Connecting to -> " + connectionURL + "\n");
    this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
    System.out.print(" Connected as -> " + userID + "\n");
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (InstantiationException e) {
    e.printStackTrace();
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    * Method to perform a simply query from the "emp" table.
    public void performQuery() {
    Statement stmt = null;
    ResultSet rset = null;
    String queryString = "SELECT name, date_of_hire, monthly_salary " +
    "FROM emp " +
    "ORDER BY name";
    try {
    System.out.print(" Creating Statement...\n");
    stmt = con.createStatement ();
    System.out.print(" Opening ResultsSet...\n");
    rset = stmt.executeQuery(queryString);
    int counter = 0;
    while (rset.next()) {
    System.out.println();
    System.out.println(" Row [" + ++counter + "]");
    System.out.println(" ---------------------");
    System.out.println(" Name -> " + rset.getString(1));
    System.out.println(" Date of Hire -> " + rset.getString(2));
    System.out.println(" Monthly Salary -> " + rset.getFloat(3));
    System.out.println();
    System.out.print(" Closing ResultSet...\n");
    rset.close();
    System.out.print(" Closing Statement...\n");
    stmt.close();
    } catch (SQLException e) {
    e.printStackTrace();
    * Close down Oracle connection.
    public void closeConnection() {
    try {
    System.out.print(" Closing Connection...\n");
    con.close();
    } catch (SQLException e) {
    e.printStackTrace();
    * Sole entry point to the class and application.
    * @param args Array of String arguments.
    * @exception java.lang.InterruptedException
    * Thrown from the Thread class.
    public static void main(String[] args)
    throws java.lang.InterruptedException {
    QueryExample qe = new QueryExample();
    qe.performQuery();
    qe.closeConnection();
    }

  • How to set the class path?-

    my forlder is :C:\Documents and Settings\india
    jdk is in:C:\Program Files\Java\jdk1.5.0_11\bin
    can any body can help me to create a classpath for my folder?

    An alternative - as stated in reply 2 in your other thread on this topic: http://forum.java.sun.com/thread.jspa?threadID=5170470 - is not to set the CLASSPATH environment variable at all. Use the -classpath switch instead.
    As the documentation linked to in that reply points out: "The class search path (more commonly known by the shorter name, "class path") can be set using either the -classpath option when calling a JDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value."
    As always, the documentation is worth reading; the available command line options worth using.

  • Overidding a method defined in a Final class via an interface.

    Hi,
    Is it possible to override methods of a final class
    which has implemented methods of an interface.
    interface A{
         void method1();     
    public final class FinalityA implements A{
         public void method1(){
              // Code
    }Now,I would like to override the functionality of
    method1() defined in class FinalityA.
    I cannot subclass FinalityA as this class is final.
    // Invalid.
    class Myclass extends FinalityA{
    }Is it possible to override the functionality defined in method1()
    Please suggest

    You can do:
    public class MyClass implements A {
       private final FinalityA _wrapee;
       public MyClass(FinalityA wrapped) {
           _wrapee = wrapped;
      public void method1() {
           .. do some special processing
          _wrapee.method1();
           .. do some more stuff
            }If you want to get really clever you can do stuff with java.lang.reflect.Proxy that allows you to automatically pass on calls to interface methods (this kind of thing is increasingly used for stuff like transaction management).
    What you can't do is to fiddle with the code of the method if called from a reference to FinalityA rather than a reference to the interface. The whole point of final classes and methods is to prevent that.

  • Dynamic class unloading

    i need to re-load / update some dynamically loaded classes. the error code i get when i try
    to load a new version without "unloading" old version:
    Exception in thread "main" java.lang.LinkageError: loader (instance of MyClassLoader): attempted duplicate class definition for name: "net/aaa/bbb/ccc/MyClassName"
    at java.lang.ClassLoader.defineClass1(Native Method)
    i reviewed this page:
    http://blog.taragana.com/index.php/archive/how-to-unload-java-class/
    but it has the phrase:
    After you are done with the class you need to release all references to the class ...
    i do not understand what this means with regards to how reflection works.
    a class cannot know all the objects that it created. but objects have handles their class.
    so what then do you do? create a collection of all objects for no reason other to identify
    the handles pointing to the class object that needs reloading to null ?
    for sure that starting a new jvm can resolve this.
    so this is my technique:
    send message over network to server that causes the server to:
    (1) start a second jvm that is a twin.
    (2) exit, and still have the twin jvm running.
    i have tried something like this:
    machine #1:
    Socket sok = new Socket("192.168.0.2", 5432);
    ObjectOutputStream oos = new ObjectOutputStream(sok.getOutputStream());
    oos.writeObject("/tmp/reboot.exe");
    machine #2:
    Socket sok = serverSocket.accept();
    ObjectInputStream ois = new ObjectInputStream(sok.getInputStream());
    Sting cmd = (String) ois.readObject();
    Runtime rt = Runtime.getRuntime();
    rt.exec(cmd);
    rt.exit(0);*# cat /tmp/reboot.exe*
    +/usr/bin/java Server &+
    note that my executing: */usr/bin/java Server &* works correctly when i type from shell.
    i don't get errors.
    rather, the first jvm exits, and the twin does not seem to start.
    the security risks are a non-issue for me. thanks.
    Edited by: kappa9h on Feb 26, 2008 2:24 AM

    ok. i don't have it working just yet, but the understanding i work in is that a class's
    namespace is not the package name alone. in reality, it is:
    ( net.kappa9h.test.MyClass ) + (class loader)
    in so doing, i can have, in the same jvm , two objects that are instances of :
    net.kappa9h.test.MyClass
    but have different internal logic.
    note:
    i always use same interface.
    and do not need an instance of the original net.kappa9h.test.MyClass to exist at same
    time as updated version of net.kappa9h.test.MyClass .
    note:
    with regard to original response. thank you for this. however, i cannot use timer method. i need to
    allow clients to signal servers to flush their dynamically loaded classes (that are cached), and re-load a newer version from a class server.
    and i don't need to carry state. so i could just start a twin and then commit hara-kiri.
    EDIT: One can not even say c r a p?? What the hell?i don't understand, but i hope i do not post something wrong in original post.
    thanks for assisting in this confounding problem.

  • Dynamic class reloading in modular web application

    Hi.
    My web application has these requirements:
    A. Functional modularization (like plug-ins). Modules will be simple jars containing application logic classes: dto beans, business logic services, dao (jpa), framework stuff (Struts2), etc...
    B. At runtime and without restarting the application "class loading" must be aware of classes inside new, changed and removed modules.
    C. Some of these jars will be outside the web application folder (WEB-INF/lib), possibly outside the container itself too.
    My question:
    1. Can I achieve all or some of my requirements with a Java web application?
    2. How should I manage the modules?
    3. Do I need some special web container feature (maybe osgi)?
    4. Can I use a custom class loader in my application?
    The architecture objectives are:
    I. Provide scalability.
    II. Efficient development process (independent deployment and no application restart required).
    III. Better production support (no application restart required for changes).
    More on the architecture:
    a). Functional scalability, meaning this that my application may functionally grow up to an indeterminate number of small functional modules.
    b). Modules will be developed, deployed and maintained independently so the application discovers and loads classes on demand.
    c). Avoid a big .war file containing all the small modules because a small change in one module would involves deploying all the other modules (possibly hundreds o even thousands of them) and restarting the application.
    d). Above point involves dynamic class reloading.
    I guess this is addressed by OSGI (looks like heavy to deal with), Jigsaw (still under development) and maybe others. I think the key point is the class loader. I will develop a custom class loader but maybe you have some advice for me before starting to develop.
    Thanks and regards.

    Classes maintained by the container should not be loaded by an application. You want the container to read those classes and react accordingly. Most of those classes are read when the container starts up a container restart will be required. Trying to leverage another container within a container does not sound like it will be worth (if you can get it to work).
    Perhaps you should state the problem that you are trying to solve with these modules so that others may suggest more feasible solutions to achieve your target goals.

  • Importing classes in Jsdk 1.4.2

    Hi,
    I have two swing applications that run perfectly well when compiled and run. But then I am trying to include these two programs as two tabbed panes in a third program.
    I try to import classes from the other two programs using a simple import statement. But when I compile it the compiler return an error statement.
    I tried putting a package line in both the programs and tried importing it as a package in the third one and it says invalid package name.
    Can anybody help.
    Thanks in advance.

    OK here is the code. This is a example code from the book Java2 from scratch
    First file
    PortfoilioTotalsPanel.java
    // Import the packages used by this class
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    // PortfolioTotalsPanel Class
    public class PortfolioTotalsPanel extends JPanel
    // Define the dark green color
    public final static Color darkGreen = new Color( 0, 150, 40 );
    // Create our labels
    JLabel lblDollarChange = new JLabel( "Dollar Change:", JLabel.CENTER );
    JLabel lblPercentChange = new JLabel( "Percent Change:", JLabel.CENTER );
    // Constructor
    public PortfolioTotalsPanel()
    // Set the layout manager
    setLayout( new GridLayout( 2, 1 ) );
    // Add the labels to the JPanel
    add( lblDollarChange );
    add( lblPercentChange );
    // setDollarChange( fDollarChange )
    // Set the Dollar Change label to the dollar amount in fDollarChange
    public void setDollarChange( Float fDollarChange )
    // Set color based off of value
    if( fDollarChange.floatValue() > 0 )
    // Green for positive
    lblDollarChange.setForeground( darkGreen );
    else if( fDollarChange.floatValue() < 0 )
    // Red for negative
    lblDollarChange.setForeground( Color.red );
    else
    // Black for no change
    lblDollarChange.setForeground( Color.black );
    // Set the label text
    lblDollarChange.setText( "Dollar Change: $" + fDollarChange.toString() );
    // setPercentChange( fPercentChange )
    // Set the Percent Change label to the percent in fDollarChange
    public void setPercentChange( Float fPercentChange )
    // Set color based off of value
    if( fPercentChange.floatValue() > 0 )
    // Green for positive
    lblPercentChange.setForeground( darkGreen );
    else if( fPercentChange.floatValue() < 0 )
    // Red for negative
    lblPercentChange.setForeground( Color.red );
    else
    // Black for no change
    lblPercentChange.setForeground( Color.black );
    // Set the label text
    lblPercentChange.setText( "Percent Change: " + fPercentChange.toString() + "%" );
    // Main application entry point into this class
    public static void main( String[] args )
    // Create a JFrame object
    JFrame frame = new JFrame( "Portfolio Totals" );
    // Create an PortfolioTotalsPanel Object
    PortfolioTotalsPanel app = new PortfolioTotalsPanel();
    // Set the values of the labels
    app.setDollarChange( new Float( "-150.50" ) );
    app.setPercentChange( new Float( "15" ) );
    // Add our PortfolioTotalsPanel Object to the JFrame
    frame.getContentPane().add( app, BorderLayout.CENTER );
    // Resize our JFrame
    frame.setSize( 600, 100 );
    // Make our JFrame visible
    frame.setVisible( true );
    // Create a window listener to close our application when we
    // close our application
    frame.addWindowListener
         new WindowAdapter()
    public void windowClosing( WindowEvent e )
    System.exit( 0 );
    Second Program
    // ===========================================================================
    // File: StockTablePanel.java
    // Description: Sample file for Java 2 From Scratch
    // ===========================================================================
    // Import the libraries this application will use
    import javax.swing.JTable;
    import javax.swing.table.*;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import java.awt.*;
    import java.awt.event.*;
    // Main application class: StockTablePanel
    public class StockTablePanel extends JPanel
    // Create a new Stock Table Model object
    StockTableModel stockTableModel = new StockTableModel();
    // Create a new JTable and associate it with the StockTableModel
    JTable stockTable = new JTable( stockTableModel );
    // Constructor
    public StockTablePanel()
    // Set the size of the table
    stockTable.setPreferredScrollableViewportSize( new Dimension(620, 350) );
    // Set the column widths for the table
    TableColumn column = null;
    for (int i = 0; i < 5; i++)
    column = stockTable.getColumnModel().getColumn( i );
    column.setPreferredWidth( stockTableModel.getColumnWidth( i ) );
    // Create a scroll pane and add the stock table to it
    JScrollPane scrollPane = new JScrollPane( stockTable );
    // Add the scroll pane to our panel
    add( scrollPane, BorderLayout.CENTER );
    // float getDollarChange()
    // Computes the total dollar change for the current portfolio
    public float getDollarChange()
    // Create a variable to hold the total change for all stocks
    float fTotal = 0;
    // Loop through all rows in the table
    for( int i=0; i<stockTable.getRowCount(); i++ )
    // Retrieve the dollar change for this stock
    Float f = ( Float )stockTable.getValueAt( i, 10 );
    // Add that value to our total
    fTotal = fTotal + f.floatValue();
    // Return the total value
    return fTotal;
    // float getPercentChange()
    // Computes the total percentage change for the current portfolio
    public float getPercentChange()
    // Create a couple variables to hold the total the user spent
    // on the stocks and the current value of those stocks
    float fMoneySpent = 0;
    float fMoneyWorth = 0;
    // Loop through all rows in the table
    for( int i=0; i<stockTable.getRowCount(); i++ )
    // Extract some pertinent information for the computations
    Float fLastSale = ( Float )stockTable.getValueAt( i, 2 );
    Float fNumberOfShares = ( Float )stockTable.getValueAt( i, 6 );
    Float fPricePaidPerShare = ( Float )stockTable.getValueAt( i, 7 );
    // Add the amount of money the user spent on this stock
    // to the total spent
    fMoneySpent += fNumberOfShares.floatValue() * fPricePaidPerShare.floatValue();
    // Add the value of this stock to the total value of the
    // stock
    fMoneyWorth += fNumberOfShares.floatValue() * fLastSale.floatValue();
    // Compute the percentage change:
    // TotalValue/TotalSpent * 100% - 100%
    float fPercentChange = ( (fMoneyWorth / fMoneySpent) * 100 ) - 100;
    // Return the percentage change
    return fPercentChange;
    // Main entry point into the StockTableApplication class
    public static void main( String[] args )
    // Create a frame to hold us and set its title
    JFrame frame = new JFrame( "StockTablePanel Application" );
    // Create an instance of our stock table panel
    StockTablePanel stockTablePanel = new StockTablePanel();
    // Add our tab panel to the frame
    frame.getContentPane().add( stockTablePanel, BorderLayout.CENTER );
    // Resize the frame
    frame.setSize(640, 480);
    // Make the windows visible
    frame.setVisible( true );
    // Set up a window listener to close the application window as soon as
    // the application window closes
    frame.addWindowListener
         new WindowAdapter()
    public void windowClosing( WindowEvent e )
    System.exit( 0 );
    // Table Model Class - holds all of our row and column information
    class StockTableModel extends AbstractTableModel
    // Create the columns for the table
    final String[] strArrayColumnNames =
    "Sym",
    "Company Name",
    "Last",
    "Hi",
    "Lo",
    "Vol",
    "#Shares",
    "$Shares",
    "Total",
    "%Change",
    "$Change"
    // Create the rows for the table - hard coded for now!!
    final Object[][] obArrayData =
    // Row One
    "SAMS", // Symbol
    "Sams Publishing", // Company Name
    new Float( 10 ), // Last Sale
    new Float( 12 ), // High
    new Float( 8 ), // Low
    new Double( 2000000 ), // Volume
    new Float( 100 ), // Number of Shares Owned
    new Float( 7.5 ), // Purchase price per share
    new Float( 1000 ), // Total Holdings
    new Float( 33 ), // Percent change (increase!)
    new Float( 250 ) // Dollar change
    // Row Two
    "Good", // Symbol
    "Good Company", // Company Name
    new Float( 50 ), // Last Sale
    new Float( 52 ), // High
    new Float( 45 ), // Low
    new Double( 4000000 ), // Volume
    new Float( 100 ), // Number of Shares Owned
    new Float( 30 ), // Purchase price per share
    new Float( 5000 ), // Total Holdings
    new Float( 33 ), // Percent change (increase!)
    new Float( 250 ) // Dollar change
    // Row Three
    "BAD", // Symbol
    "Bad Company", // Company Name
    new Float( 20 ), // Last Sale
    new Float( 22 ), // High
    new Float( 18 ), // Low
    new Double( 2000000 ), // Volume
    new Float( 500 ), // Number of Shares Owned
    new Float( 50 ), // Purchase price per share
    new Float( 10000 ), // Total Holdings
    new Float( -60 ), // Percent change (increase!)
    new Float( -25000 ) // Dollar change
    // Return the number of columns in the table
    public int getColumnCount()
    return strArrayColumnNames.length;
    // Return the number of rows in the table
    public int getRowCount()
    return obArrayData.length;
    // Get the column name from the strArrayColumnNames array for the "col"-th
    // item
    public String getColumnName( int col )
    return strArrayColumnNames[col];
    // Return the value, in the form of an Object, from the obArrayData object
    // array at position (row, col)
    public Object getValueAt( int row, int col )
         // We will compute columns 8, 9, and 10, so if the column number is
         // below eight, we can just return it without computing or retrieving
         // anything.
         if( col < 8 )
         return obArrayData[row][col];
         // Retrive the necessary values from the object array to compute all
         // of the remaining columns
         Float fLastSale = ( Float )obArrayData[row][2];
         Float fNumberOfShares = ( Float )obArrayData[row][6];
         Float fPurchasePrice = ( Float )obArrayData[row][7];
         switch( col )
         // Total Holdings = Last Sale(2) * Number of Shares Owned(6)
         case 8:
         // Build a new Float object with the product of the two
         Float fTotal = new Float
         // Note, these have to be converted to type "float" to
         // perform the multiplication
         fLastSale.floatValue() * fNumberOfShares.floatValue()
         // Return the result
         return( fTotal );
         // Percent change =
         // (Last Sale Price (2) / Purchase Price (7)) * 100% - 100 %
         case 9:
         Float fPercentChange = new Float
         ((fLastSale.floatValue() / fPurchasePrice.floatValue ()) * 100) - 100
         return fPercentChange;
         // Dollar Change =
         // LastSale*NumberOfShares - PurchasePrice * NumberOfShares
         case 10:
         Float fDollarChange = new Float
         ( fLastSale.floatValue() * fNumberOfShares.floatValue() )
         ( fPurchasePrice.floatValue() * fNumberOfShares.floatValue() )
         return fDollarChange;
         // We have included every case so far, but in case we add another
         // column and forget about it, let's just return its value
         default:
         return obArrayData[row][col];
    // Return the class type, in the form of a Class, for the c-th column in
    // the first (0-th indexed) element of the obArrayData object array
    public Class getColumnClass( int c )
    return getValueAt(0, c).getClass();
    // Return true if the "col"-th column of the table is editable, false
    // otherwise. The following columns are editable:
    // Cell Description
    // 0 Symbol
         // 6 Number of Shares Owned
         // 7 Purchase Price per Share
    public boolean isCellEditable(int row, int col)
         // Check the column number
         if( col == 0 || col == 6 || col == 7 )
         return true;
         else
         return false;
    // Set the value of the (row, col) element of the obArrayData to value
    public void setValueAt(Object value, int row, int col)
         // Symbol
         if( col == 0 )
         // We need a string value - we can convert any
         // value to a string, so just assign it
         obArrayData[row][col] = value;
         // Number of Shares owned
         else if( col == 6 )
         // We need a number - either float or int
         obArrayData[row][col] = new Float( getNumberString( value.toString() ) );
         // Purchase Price per share
         else if( col == 7 )
         // We need a float
         obArrayData[row][col] = new Float( getNumberString( value.toString() ) );
         // Cell is not editable
         else
         return;
         // Notify our parent of the change
         fireTableCellUpdated(row, col);
    // String getNumberString( String str )
    // Read through str and return a new string with the numbers and decimal
    // points contained in str
    public String getNumberString( String str )
    // Get str as a character array
    char[] strSource = str.toCharArray();
    // Create a buffer to copy the results into
    char[] strNumbers = new char[strSource.length];
    int nNumbersIndex = 0;
    // Boolean to ensure we only have one decimal value
    // in our number
    boolean bFoundDecimal = false;
    // Loop through all values of str
    for( int i=0; i<strSource.length; i++ )
    // Check for a digit or decimal point
    if( Character.isDigit( strSource[i] ) )
    strNumbers[nNumbersIndex++] = strSource;
    else if( strSource[i] == '.' && !bFoundDecimal )
    // Append the character to the String
    strNumbers[nNumbersIndex++] = strSource[i];
    // Note that we found the decimal value
    bFoundDecimal = true;
    // Build a new string to return to our caller
    String strReturn = new String( strNumbers, 0, nNumbersIndex );
    // Return our string
    return strReturn;
    // Return the column width of the column at index nCol
    public int getColumnWidth( int nCol )
    switch( nCol )
    case 0:
    case 2:
    case 3:
    case 4:
    case 6:
    case 7:
    case 9:
    return 50;
    case 1:
    return 125;
    default:
    return 75;
    Third one that imports the previous two programs Classes
    // Import the packages used by this class
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    // Import our other components
    import StockTablePanel;
    import PortfolioTotalsPanel;
    // StockTableTabPanel
    public class StockTableTabPanel extends JPanel implements TableModelListener
    // Create our panels
    StockTablePanel stockTablePanel = new StockTablePanel();
    PortfolioTotalsPanel portfolioTotalsPanel = new PortfolioTotalsPanel();
    // Constructor
    public StockTableTabPanel()
    // Set our layout
    setLayout( new BorderLayout() );
    // Initialize the portfolio panel
    updatePortfolioTotals();
    // Add the child panels to our JPanel
    add( stockTablePanel );
    add( portfolioTotalsPanel, BorderLayout.SOUTH );
    // Add our class as a table model listener for the stock table
    // model so that we can update the portfolio totals panel
    // whenever the table changes.
    stockTablePanel.stockTableModel.addTableModelListener( this );
    // TableModelListener: tableChanged
    public void tableChanged(TableModelEvent e)
    // Make sure it is our table that changed
    if( e.getSource() == stockTablePanel.stockTableModel )
    // Call our method to update the portfolio totals
    updatePortfolioTotals();
    // public updatePortfolioTotals
    // Updates the portfolio totals panel labels based off of the values
    // in the stockTablePanel
    public void updatePortfolioTotals()
    // Get the values from the stockTablePanel and send them
    // to the portfolioTotalsPanel
    portfolioTotalsPanel.setDollarChange( new Float( stockTablePanel.getDollarChange() ) );
    portfolioTotalsPanel.setPercentChange( new Float( stockTablePanel.getPercentChange() ) );
    // Main application entry point into this class
    public static void main( String[] args )
    // Create a JFrame object
    JFrame frame = new JFrame( "Stock Table Tab" );
    // Create an StockTableTabPanel Object
    StockTableTabPanel app = new StockTableTabPanel();
    // Add our StockTableTabPanel Object to the JFrame
    frame.getContentPane().add( app, BorderLayout.CENTER );
    // Resize our JFrame
    frame.setSize( 640, 440 );
    // Make our JFrame visible
    frame.setVisible( true );
    // Create a window listener to close our application when we
    // close our application
    frame.addWindowListener
         new WindowAdapter()
    public void windowClosing( WindowEvent e )
    System.exit( 0 );

  • Assign Valuation Class to Company Code

    Hi Gurus...
    Quick Question: we are migrating from R3 to ECC 6. One of Treasury Management config points is Valuation Class definition. R3 used to have a config point in IMG called Assign Valuation Class to Company Code/Transaction Type. But I cannot find same in ECC6. Even CTRL-F does not help. Did it get moved and renamed?
    Thanks,
    JS

    Hi,
    Don't know the IMG path but what you can try:
    1. Go to the required IMG transaction in R/3 and look up the table / view (click on a field in the IMG transaction / push F1 / click icon Technical Information)
    2. In ECC 6 go to transaction SM30, fill in the table / view name from step 1
    3. Click icon Customizing
    4. In pop-up click Continue w/o Specifying Project
    5. An overview appears with IMG config points where the specified table / view is maintained. Choose the appropiate one by double clicking.
    Prerequisite is the existence of an IMG activity exists for object maintenance.
    Regards,
    Andre

Maybe you are looking for

  • Disk Utilty - what is difference between single volume and single partition

    In Disk Utility I can, should I wish, format a drive by using Erase to create a single volume. Also in Disk Utility, I have the option to use Partition to create one (or more) partition. What is the difference between a volume and a single partition?

  • Can't register QT Pro in SL

    I bought a Mac Mini after my Dual G5 radiator sprung a leak, and I'm moving apps over. I have a registration number for QT 7 Pro. I loaded QT 7 from the SL disk into the Utilities folder, and am trying to get it to register, per Apple Articles HT3820

  • Monitor will not turn on

    After years of good service, my monitor will not turn on when I turn on the MacPro. 

  • Needed: Programmer font with great Unicode coverage

    Subject line says it all: I need a font that: 1) is excellent for source code files (especially Java, obviously) 2) has glyphs for most Unicode characters (specifically, the first 65,536 ones, that is the [Basic Multilingual Plane|http://en.wikipedia

  • Compact Storage

    I'm trying to run the Compact Storage utility in order to reclaim space since I've hit the Oracle XE size limit. I clicked the Compact Storage link, and the page displayed "A job to compact storage has been submitted" but nothing appears to have actu