Finalize method, please, help

I'm using jdk 1.4.2.08
I have redefined the finalize method in my classes and simply i put a system.out
just to see if vm calls for it or not.
For some classes I see the messages in output console, for others not.
The curious thing is that I use two profiles tools that allows to force garbage
collector (pushing a toolbar button); after that I push the button the instance counts for ALL objects goes to zero.
Teorically all instances of my classes has been destroyed;
in other words both two profilers tells me that there are no dirty
references (or memory leak)
.... BUT.....
no messages (for some classes) in output console are shown.
Any ideas?
Thanks.

OK, I know that, but I force the GC using the profiler
and after this the profiler shows in his monitor that all
instance count of my classes is zero.
But, for some of my classes, I dont't see in putput console
the message given by a System.out placed in Finalized custom
method.
If this that is strange: for profiler all instances has been destroyed
by GC, but java seems that does not calls finalized method......

Similar Messages

  • Calling a method   ---please help

    Hi everyone, I'm new to the forums, and completely new to java,. I've been searching for hours (online and in books) on how to call a method while passing parameters. I still haven't figured it out. I'm sure it's really easy, but I need some help.
    This program is for evaluating the quadratic formula. I can't seem to return x1 and x2 from lines 73 and 78 (labeled in code) from method quad to lines 39, 40, and 46. It will compile and run, but it will not display x1 and/or x2.
    Please help, and thanks in advance.
    Am I even close?
    import java.util.*;
    import java.lang.*;
    import javax.swing.JOptionPane;
        public class test
          static Scanner console = new Scanner(System.in);
           public static void main(String[] args)
            //Declare variables
            double a = 0;
            double b = 0;
            double c = 0;
            double d = 0;
             //Asking the user for input
            inputA = JOptionPane.showInputDialog(null, "enter number for x^2");
            inputB = JOptionPane.showInputDialog(null, "enter number for x";
            inputC = JOptionPane.showInputDialog(null, "enter number for constant");
            //Parsing string  to double
            a = Double.parseDouble(inputA);
            b = Double.parseDouble(inputB);
            c = Double.parseDouble(inputC);
            //calculating discriminant
            d = (Math.pow(b,2) - (4 * a * c));
             //Checking to see if the discriminant is less than zero - has two imaginary roots
             if (d < 0)
                   JOptionPane.showMessageDialog(null, "There are two imaginary roots.");
                }//end checking to see if the discriminant is less than zero - has two imaginary roots
         //calling method quad
                if (d > 0)
         quad(a, b, c, 1);                              //line 39
         quad(a, b, c, 2);                              //line 40
                                JOptionPane.showMessageDialog(null, "There are two real roots. They are root 1 = "
                                               + x1 + " , and root 2 = " + x2 + ".");
                else if (d == 0)
                          quad(a, b, c, 1);                             //line 46
                                 JOptionPane.showMessageDialog(null, "There is a single (repeated) root.  It is " + x1);
             //starting method quad
         public static double quad (double a, double b, double c, int n)
             double d = 0;                         //value for d - discriminant
             double x1 = 0;                         //value for x - solving for x
             double x2 = 0;                         //value for -x - solving for negative x
               //Checking if discriminant equals zero or is larger than zero
             if (d == 0)
                     n = 1;
             else
                     n = 2;
               //Checking if n equals zero
             if (n == 1)
                     x1 = ((-b) + (Math.sqrt((Math.pow(b,2))-(4 * a* c))) / (2 * a));
                     return x1;                          //line 73
             else
                     x2 = ((-b) - (Math.sqrt((Math.pow(b,2))-(4 * a* c))) / (2 * a));
                     return x2;                         //line 78
         }//end method quad

    Man, you guys/gals are great! You notice everything...I sure appreciate all the help so far. I've updated a few things, but I still can't get x1 in the method to pass the right input to line 39. For instance, if I set a=2, b=4, and c=-30, then x1 should = 3 and x2 should =-5, but both keep showing -5. They are always equal for some reason, even when they are not supposed to be.
    I see what you were saying with d always equalling zero. I was looking in the main where it doesn't always = zero, but in the method it was always set to zero. Thanks...good eye!
    num1 = quad(a, b, c, 1);                              //line 39
    num2 = quad(a, b, c, 2);                              //line 40
    JOptionPane.showMessageDialog(null, "There are two real roots. They are root 1 = "+ num1 + " , and root 2 = " + num2 + ".");I also added this to the method so d won't always = zero
    d = (Math.pow(b,2) - (4 * a * c));I also have all of the variables declared at the top, but I forgot to copy and paste all of them and I updated the System.exit(0) to close the JOptionPane along with extra } 's to close the program correctly.
    Again, thanks a bunch.

  • I have problem in repeint method please help me

    my screen blinks badly when i use repaint method
    if i use update it only updates the page not erase prevois
    what i can do iam in very trouble please help me

    my screen blinks badly when i use repaint method
    if i use update it only updates the page not erase
    prevois
    what i can do iam in very trouble please help meAre there any lengthy calculations being done in the paint() function? This can delay the repaint() after the update() function clears the screen area and make flicer bad. Mover any code possible out of paint() and have it done before update() is called.

  • Pbroblems with Synchronized methods --- please help

    ** One Thread calls a synchronized method using an object (obj1) of a Class (Class name - meth_class) and occupies the monitor of that particular object (obj1). Then no other Thread can call that particular synchronized method or any other synchronized method of the object (obj1) of a Class (Class name - meth_class). **
              IF THE ABOVE DEFINITION IS TRUE PLEASE HELP ME OUT WITH THE FOLLOWING:
    Please go through the code below:-
    class meth_class
              volatile boolean valueset=false;
              int var;
              synchronized int get()
                        if (!valueset)
                                  try
                                            wait();
                                  catch (InterruptedException e)
                                            System.out.println("Consumer interrupted");
                        System.out.println("Get - " + var);
                        valueset=false;
                        notify();
                        return var;
              synchronized void put(int x)
                        if (valueset)
                                  try
                                            wait();
                                  catch (InterruptedException e)
                                            System.out.println("Producer interrupted");
                        this.var=x;
                        System.out.println("Put - " + var);
                        valueset=true;
                        notify();
    class producer implements Runnable
              meth_class obj;
              Thread thrd;
              producer(meth_class x)
                        obj=x;
                        thrd=new Thread(this, "Producer");
                        thrd.start();
              public void run()
                        int var=0;
                        while(true)
                                  obj.put(var++);
    class consumer implements Runnable
              meth_class obj;
              Thread thrd;
              consumer(meth_class x)
                        obj=x;
                        thrd=new Thread(this, "Consumer");
                        thrd.start();
              public void run()
                        while(true)
                                  obj.get();
    class main_thrd
              public static void main(String args[])
                        meth_class obj=new meth_class();
                        new producer(obj);
                        new consumer(obj);
                        System.out.println("Press Control-C to stop");
    My Questions are:
    1.     class main_thrd creates two objects as ?new producer(obj)? and ?new consumer(obj)?. Now both these objects creates 2 threads and try to call two different Synchronized methods of same CLASS ? ?meth_class? through a single object by the name of ?obj? created in class main_thrd. Now as ?new producer(obj)? object is created first in the class main_thrd, the Thread created by it enters the monitor of object (obj) and locks it. Then as per the rule the Thread created by ?new consumer(obj)? object never gets to occupy the monitor of the object (obj) because Producer is in an infinite loop. BUT THEN WHY WE HAVE ? GET - ** ? VALUES PRINTED IN THE OUTPUT.
    Please any one help me out,
    (THANKS FOR ALL YOUR HELP)

    Now as ?new producer(obj)? object is called first in the class main_thrd, the Thread created by it enters the monitor of object (obj) and locks it.Though new producer(obj) is called first, it is not necessary that the thread created by it gets the lock of object(obj) first. This is false
    assumption.
    Next, even if we assumed that it gets the lock of given object first,
    while(true)
        obj.put(var++);
    }The lock of Object(obj) is released when the obj.put(var++) returns and any one can get hold of lock of the Object(obj) at that instant.
    In fact, next time obj.put(var++) is called, it will have to wait until it can get lock of the given object.

  • Helper methods, please help

    So far, I've only been used to having classes with one main method.
    But now I want to have a class with a main method plus helper classes. In my main class I show a list, and the user chooses options 1-4 or whatever. Then I have a switch as follows
      switch(choice)
                case '1' : Option1();break;
                case '2' : Option2();break;
                case '3' : Option3();break;
                case '4' : Option4();break;
                //default: System.out.print("Enter a number from 1-5");
            }Now I need to set up my method, called Option1, Option2, etc. after the main method.
    But how should i do them. public?, static? void?
    I need to be able to access an object which is constructed in the main method form the helper methods, how can I do this?
    Cheers

    Static means that it a method that belongs to the class instead of the instance of the class. Static methods (or variables) can be thought of as common to all the instances. Static variables are good places to put constants that will be used by all instances or counters to keep track of instances. For example, if you had a class that created automobiles, you might have a static counter to keep track of the total made. Likewise with static methods. There is only one method shared by all. In the automobile example, you would probably increment the counter via a static method. And, as stated in an earlier response, a static method (such as main) can only access other static methods.
    You would make a helper method private so that you don't violate encapsulation. In this context, it means that no one else sees the implementation details of the method or request execution of te method without your knowledge.

  • I gt problem in createImage method, Please Help Me!

    This part of code is from Ticker.Class:
    public void createParams()
         {//tickerTape.x = 900;
              //tickerTape.y = 40;
              int width = getSize().width;
              //System.out.println("getSize().width "+getSize().width);
              int height = getSize().height;
              lastS.width = width;
              lastS.height = height;
              System.out.println("width"+width);
              //System.out.println("width: " + width + " height: " + height);
              tickerTape.createParamsgr();
              Font font = tickerTape.getDefaultFont();
              this.setFont(font);
              FontMetrics metrics = getFontMetrics(font);
              metrics = getFontMetrics(font);
              int k = getFontMetrics(font).getHeight();
              //tickerTape.cParams();
              //tickerTape.createParams1(lastS);
              //setSize(tickerTape.cParamsHeight(),tickerTape.cParamsWidth());
         //     messageY = tickerTape.cParamsY();
              messageX = width;
              messageY = (height - k >> 1) + metrics.getAscent();
                   image = createImage(getSize().width,getSize().height);
                   tickerTape.initImage(image);
                   //gr=image.getGraphics();
         public  void paint(Graphics g)
          update(g);
         public synchronized void update(Graphics g)
              //gr.clearRect(0, 0, d.getSize().width, d.getSize().height);
              //gr.setColor(bgCo);
              //gr.drawRect(0, 0, d.getSize().width - 1, d.getSize().height - 1);
              //gr.fillRect(0, 0, d.getSize().width, d.getSize().height);
              //g.drawImage(image, 0, 0, this);
              if (Ticker.LOADING_DATA) {
                   System.out.println("Refreshing data. Please wait....");
                   return;
              try {
                   if(image==null)
                   image = createImage(getSize().width, getSize().height);
                   tickerTape.initImage(image);
                   //if (tickerTape.cParamsHeight() != lastS.height|| tickerTape.cParamsWidth() != lastS.width)
                   if (getSize().height != lastS.height|| getSize().width != lastS.width)
                   createParams();
                   if (tickerTape.getDisplayItems().size() > 0) {
                        //System.out.print("lastS.width: " + lastS.width + " lastS.height: " + lastS.height + "\n");
                        tickerTape.setBackground(lastS,bgCo,messageX,messageY);
                        if (display_URL) {
                             int k = mouseX;
                              //System.out.println("k=" + k + " messageX=" + messageX);
                             if (k > messageX) {
                                  //System.out.println("(k > messageX) is true!!");
                                  //System.out.println("messageCount----> " + messageCount);
                                  messageCount = tickerTape.displayItemsCnt;
                                  k -= messageX;
                                  switch (this.mouseEvent) {
                                  case TickerTape.SCROLL_LEFT:
                                       break;
                                  case TickerTape.SCROLL_RIGHT:
                                       // for (int i1 = 0; i1 <= messageCount - 1; i1++)
                                       // i += ((Integer) msgsW.elementAt(i1)).intValue();
                                       // if (k >= i)
                                       // continue;
                                       // messageIndex = i1;
                                       // break;
                                       // break;
                                  if (this.mouseEvent == MOUSE_CLICK) {
                                       // showStatus((String)
                                       // msgsURL.elementAt(messageIndex));
                        //Font itemFont = null;
                        //FontMetrics fontMetrics = null;
                        //Color textColor = null;
                        //Vector msgs = tickerTape.getDisplayItems();
                                  switch (tickerTape.getScrollDirection()) {
                                  case TickerTape.SCROLL_LEFT:
                                       tickerTape.moveLeft(messageX,messageY);
                                       g.drawImage(image, 0, 0, this);
                                       break;
                                  case TickerTape.SCROLL_RIGHT:
                                       tickerTape.moveRight(messageX,messageY,ItemToDisplay);
                                       g.drawImage(image, 0, 0, this);
                                       break;
                                  case TickerTape.SCROLL_UP:
                                  case TickerTape.SCROLL_DOWN:
                                       tickerTape.moveDown(messageX,messageY);
                                       g.drawImage(image, 0, 0, this);
                                       //g.drawImage(image, 0, 0, this);
                                       break;
                   }     else {
                             image = createImage(getSize().width, getSize().height);
                             tickerTape.initImage(image);
                             //gr=image.getGraphics();
                             tickerTape.setBackground(lastS,bgCo,messageX,messageY);
                             g.drawImage(image, 0, 0, this);
              } catch (Exception e) {
                   e.printStackTrace();
         }This part of code from TickerTape.Class:
    public void createParamsgr(){
              if (gr != null)
                   gr.finalize();
              if (image != null)
                   image = null;
         public void initImage(Image image){
              gr = image.getGraphics();
         }This code already runable. But my question is Why when I decide to move the createImage method into the method of initImage in TickerTape.class, then it come out the error with nullpointer, why like that? is it im make any wrong thing? Or any solution for me to make it correct. Thanks and appreciate!

    hi, thanks for your reply.
    let me briefly explain to you,
    now, you try to look at the createParams() method and update(Graphics g) method int Ticker.class, inside there also got
    image = createImage(getSize().width, getSize().height);
    tickerTape.initImage(image);
    So, now I want to move the code:
    image = createImage(getSize().width, getSize().height);
    into the TickerTape.class but dont Why come out the error with:
    java.lang.NullPointerException
         at TickerTape.initImage(TickerTape.java:90)
         at Ticker.update(Ticker.java:503)
         at sun.awt.RepaintArea.updateComponent(RepaintArea.java:239)
         at sun.awt.RepaintArea.paint(RepaintArea.java:216)
         at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)
         at java.awt.Component.dispatchEventImpl(Component.java:4031)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    but it doesnt work!
    Is it I put wrong thing or I forgot to put any important code?

  • Problem with JSObject.getWindow() method - Please Help

    I have a small Apllet that has a button that calls a Javascript function in the opening window, to close the window in which it is loaded.
    The Applet window is a PopUp window from one of my application's window. First time I start my application and load that Applet the button works fine. It calls the Javascript method and the Method closes the window using the window.close() method.
    But now if I open the applet window again and click on the button to close the windows, it hangs. I put in trace statements and saw that it hangs on JSObject.getWindow() window.
    I am using JDK Plugin 1.2.2, testing in IE 6.0 with no microsoft JVM.
    Please, if somebody could give me some clue about why this would happen, I will really appreciate that. I have been stuck into this problem for last three days.

    Hello,
    I have the same problem as you have had. I am using a Flash GUI to control a Java 1.4.2_04 applet via JavaScript. The Java applet appears on 50 html pages within a web-based training. It works fine on IE 6.0 and NS 7.1 when I view only one of the applet pages. But when I turn e.g. from the 10th to the 11th page, the browser crashes due to a fatal exeption in vbscript.dll (IE) or xpconnect.dll (NS). Sometimes I can view 50 or more pages without problems, but the browser crashes far too often. (When I use the applet's own GUI to control it, I can view it on as many pages as I want without any problems).
    5 times per second Flash calls a JavaScript function, which calls a Java function, which returns a value (indicating the state of the applet), which JavaScript uses to set a Flash variable. Java never calls a JavaScript function. On IE I used VB Script to enable Flash to JavaScript communication.
    Is liveconnect buggy? Have you found a solution of the problem?

  • Bitmap Painting Methods: Please Help Urgent!!!

    I have created a real-time trend graphing component using the model/ui approach. The graph has independant data models for the x and y axis'. The graph updates its view based on a timer, every second (I have it set to that for testing). Upon a timer event new data is added to the graphs data model and needs to be represented on the graph. Everything is working great and I have implemented a "full-redraw" painting scenario. The only thing I have left to do is implement a fast-update drawing function. Since I am new to Java, I need some help with this.
    the x-axis of the graph represents time (a range 0 - 10 minutes) 0 = now, 10 = 10 minutes ago, with an update every second, there are 600 points to graph along the x-axis.
    I am thinking the proper way to approach this problem would be to capture the current rectangle (graphy area) and shift it over the appropriate pixels, my next job would be to draw only the new data. My problem is I dont know how to do this, as well, I would need to clip the appropriate amount of pixels on the other side of captured image. Any Suggestions?

    Yeah, you can do it. I think you'll have to find a fast way to access the image at the pixel level though. In Java, it won't be that easy, as you don't have access to the video card like you do in DirectDraw, that I know of anyway. If writing to a byte array is faster, you can try that. Use a BufferedImage, and do bufferedImage.setRGB(int x, int y) to modify only the certain pixels you care about.

  • Problem with the replaceAll method - please help

    When the source String contains some special characters like ' ? ' , ' ) ' , or ' ( ' etc, the replaceAll function doesn't has any effect on the source String.
    for example
    String k="images/mainpage7(sm)_01.jpg";
    String h=k.replaceAll("images/mainpage7(sm)_01.jpg","JoinNowBox_01.jpg");
    System.out.println(k);
    System.out.println(h);
    output:
    images/mainpage7(sm)_01.jpg
    images/mainpage7(sm)_01.jpg
    Can anybody tell me what to do?
    Thanks in advance
    Hristos Floros - Greece

    But what if I don�t know the values of all Strings?
    String a="images/mainpage7(sm)_01.jpg";
    String b="images/mainpage7(sm)_01.jpg";
    String c="images/mainpage7(sm)_01.jpg";
    String d=a.replaceAll(b,c);
    System.out.println(a);
    System.out.println(d);

  • Please help getString()

    hi,
    this might sound like a question that shouln't have been asked but
    i'm new to java, studied it for a few months (haven't learnt any kind of programming languages before )and been assigned to do a project, tried my best at it but got stuck on this GetString() method
    what's wrong with this code
    i tried to compile it but came up with errors
    cannot find symbol
    symbol : method getString()
    location: class java.lang.String
    stm.setString(4,strdate.getString());
    cannot find symbol
    symbol : method strtimegetString()
    location: class javaproject
    stm.setString(5, strtimegetString());
    2 errors
    here's the code
    //javaproject.java
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.sql.*;
    public class javaproject extends JApplet implements ActionListener,Runnable
    JPanel panel; JLabel lname, lcode,lterm,ltime,ldate;
    JTextField tfname , tfcode;
    JButton bttsaved, bttcancel, bttclose;
    JComboBox cbterm;     
    String term[] ={"Semester A","Semester B","Semester C","Semester D"};
    String strdate, strtime ;
    Thread time;
    GregorianCalendar calendar;
    public void init()
         panel = new JPanel();
         lcode = new JLabel ("Code : ");
         lname = new JLabel("Name : ");
         lterm = new JLabel("Term : ");
         ltime = new JLabel();
         ldate = new JLabel();
         tfcode = new JTextField(20);
         tfname = new JTextField(20);
         cbterm = new JComboBox(term);
    bttsaved = new JButton(" Saved ");
    bttcancel = new JButton(" Cancel ");
    bttclose = new JButton(" Close ");
         calendar = new GregorianCalendar();
         time =new Thread(this);
         time.start();
         display();
         panel.add(ldate); panel.add(ltime);
         panel.add(lcode); panel.add(tfcode);
         panel.add(lname); panel.add(tfname);
         panel.add(lterm); panel.add(cbterm);
         panel.add(bttsaved); panel.add(bttcancel); panel.add(bttclose);
         getContentPane().add(panel);
         bttsaved.addActionListener(this);
         bttcancel.addActionListener(this);
         bttclose.addActionListener(this);
    public void run()
         for(;;)
         calendar = new GregorianCalendar();
              strtime = calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)
              +":"+calendar.get(Calendar.SECOND);
              ltime.setText(strtime);
              try
              time.sleep(1000);
              catch(InterruptedException e)
              showStatus("ThreadInterrupted");          
    public void display()
         strdate = calendar.get(Calendar.DATE) + "/" + (calendar.get(Calendar.MONTH)+1) + "/"+calendar.get(Calendar.YEAR);
         ldate.setText(strdate);
    public void actionPerformed(ActionEvent evt)
         if(evt.getSource() == bttcancel )
         tfcode.setText(" ");
         tfname.setText(" ");
         showStatus(" ..... Please enter new information ..... ");
         if(evt.getSource() == bttclose )
         System.exit(0);          
         if(evt.getSource() ==bttsaved )
         try
              String blankcode = tfcode.getText();
              if(blankcode.length() == 0)
                   showStatus("Student's code cannot be empty");
                   return;          
              String blankname = tfname.getText();
              if(blankname.length() == 0)
                   showStatus("..... Student's name cannot be empty ......");
              return;
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection con;
              con = DriverManager.getConnection("jdbc:odbc:kayteej","sa", null);
              PreparedStatement stm;
              stm = con.prepareStatement("insert into Students values(?,?,?)");
              stm.setString(1,tfcode.getText());     
              stm.setString(2,tfname.getText());
              stm.setString(3,(String)cbterm.getSelectedItem());
              stm.setString(4,strdate.getString());
              stm.setString(5, strtimegetString());
              stm.executeUpdate();     
              showStatus("..... Please enter new information ..... ");
              JOptionPane.showMessageDialog(null, "Data Saved","Congrats!!",1);
         catch(Exception err)
              showStatus("Error occured while interacting with sql");
    //<Applet code="javaproject.class" width=800 height=600></applet>
    should i use the getString method or is it possible to use other type of methods. please help I'm really stuck
    Thank you in advance

    So when you run it, the code throws an exception? Then there's something wrong with your code, or with your setup.
    The exception's stack trace contains useful information which would help you (or us) figure out just what is wrong. Hopefully you have a catch-block that calls the printStackTrace() method of the exception.

  • Images in jar file, Please help!!

    Hello,
    This is my code, I am trying to add images to buttons in ToolBar. The code along with images works if I say "java ABC", but dont work(images dont appear) when I jar the files. I have tried all the possible methods, Please help me.
              new2 = new JButton(new ImageIcon("images/new.gif"));
              /*try{
              ClassLoader loader=getClass().getClassLoader();
              URL fileLocation=loader.getResource("./images/new.gif");
              Image img=Toolkit.getDefaultToolkit().getImage(fileLocation);
              new2 = new JButton(new ImageIcon(img));
              }catch(Exception e) { e.printStackTrace(); }*/
              //new2 = new JButton(new ImageIcon(ClassLoader.getSystemResource("images/new.gif")));
              //new2 = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("./images/new.gif"))));
              //ImageIcon oo = new ImageIcon();
              //new2 = new JButton(oo.setImage(getClass().getResource("images/new.gif")));
                   new2.setToolTipText("New");
    Thanks
    James

    Hello,
    The code is too big to post, I am adding the code that is required to get changed, please see it
              open2 = new JButton(new ImageIcon("images/open.gif"));
                   open2.setToolTipText("Open");
                   open2.addActionListener(this);
                   open2.addMouseListener(new MouseAdapter()
                        public void mouseEntered(MouseEvent me)
                             status.setText("Opens a file");
                        public void mouseExited(MouseEvent me)
                             status.setText("open");
    Thanks
    James

  • Help needed in overriding the finalize() method!

    Hi
    I need some help in overwriting the finalize() method.
    I have a program, but at certain points, i would like to "kill" a particular object.
    I figured that the only way to do that is to make that object's class override the finalize method, and call it when i need to kill the object.
    Once that is done, i would call the garbage collector gc() to hopefully dispose of it.
    Please assist me?
    Thanks
    Regards

    To, as you put it, kill an object, just null it. This
    will be an indication for the garbage collector to
    collect the object. In the finalizer, you marely null
    all fields in the class. Like this:
    public class DummyClass
    String string = "This is a string";
    Object object = new Boolean(true);
    public void finalize() throws Throwable
    super.finalize();
    string = null;
    object = null;
    public static void main(String[] args)
    //Create a new object, i.e allocate an
    te an instance.
    DummyClass cls = new DummyClass();
    //Null the reference
    cls = null;
    This is a pointless exercise. If an object is being finalized, then all the references it contains are about to cease being relevant anyway, so there's no purpose to be served in setting them to null.
    All that clearing a reference to an object does is to clear the reference. Whether the object is subsequently finalized depends on whether the object has become unreachable.
    Directly calling finalize is permitted, but doesn't usually serve any purpose. In particular, it does not cause the object to be released. Further, calling the finalize method does not consitute finalization of the object. Finalization occurs when the method is called as a consequence of a garbage collector action.
    If a variable contains a reference to an object (say a table), and you want a new table instead, then create a new table object, and assign its reference to the variable. Assuming that the variable was the only place that the old table's reference was stored, the old table will, sooner or later, get finalized and collected.
    Sylvia.

  • Can't download anything from app store or itunes. everytime i try to install an app i get "there is abilling problem with a previous purchase. please update ur payment method". i have recently changed my address and visa debit card. please help

    can't download anything from app store or itunes. everytime i try to install an app i get this error "there is a billing problem with a previous purchase. please update ur payment method". i have recently changed my visa debit card and home adress and when i make these changes i still get the same error.
    will u please help me out?

    Are you listing the billing address for the card correctly? The address in the iTunes/MAS account must match the address on your bill exactly.

  • HT2729 i have been trying to copy videos from my pc to ipad but it is not working .. i have tried the "drag and drop method and even add files to library but to no avail please help

    please help me regarding moving videos from pc to ipad .. i have ipad 2 wih ios5 and windows xp.. ihave tried add files to library and drag and drop method but they are not working.. what should i do

    Are you trying to add videos to itunes or to your ipad from itunes.
    Your question is very confusing.

  • I have a ipod touch 2nd generation 8gb 4.2.1 im new to itunes i made a itunes account but it says i need a payment method is there anyway i can use my paypal if not is there a way to not have to use a payment method for itunes store please help ty

    i have a ipod touch 2nd generation 8gb 4.2.1 im new to itunes i made a itunes account but it says i need a payment method is there anyway i can use my paypal if not is there a way to not have to use a payment method for itunes store please help ty

    Create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    Using those instructions you may also be able to select PayPal if that is allowed in your country.

Maybe you are looking for

  • Use Time Machine HD as regular external HD?

    Is it possible to convert the backups.backupdb folder on an external HD I've been using for Time Machine into a regular folder? Or to otherwise move around and delete files within the backups.backupdb folder on the Time Machine HD? My old Macbook Pro

  • TextEdit - Save preset for Find & Replace?

    Hey, all! Quick question... is there any way to save a preset for a Find & Replace function in the native TextEdit app in Mac OS?  I do a routine F&R using a long "Insert Pattern" (I haven't had time to learn Regular Expressions yet in order to use a

  • Is it possible to append a string on canvas without calling repaint() ??

    Hi..experts I am new to J2ME programming. i want to append characters on canvas one by one. is it possible to append a string to another that is allready drawn without repainting all canvas. please help me. Thanks a lot

  • How to Re-Sign a PKCS7 ?

    Hello I want to re-sign a pkcs7 I tryed to merge 2 PKCS7 with each signature how can I do the job ? *1/read the info in the PKCS7 allready signed (its a detached signature)* signedData = new CMSSignedData( new CMSProcessableFile(file), new BufferedIn

  • Turn Off my TC every night

    I used to have a linksys router and i turned off every night before i went to bed, now i just got a 2TB TC and i dont know if i would damge the device if i do the same, so Should i leave it on all the time? or how often can i turn it off? Thanks in u