Results 1 to 3 of 3

Thread: A Java related question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Nyxos's Avatar when in doubt, doubt.
    Join Date
    Oct 2009
    Location
    Somewhere over the rainbow (aka France)
    Posts
    4,227

    Default A Java related question

    I have this computer project where I need to recognize letters and signatures to identify someone.

    I have 2 questions about Jpanels :

    first, how do I erase the drawing that is in the Jpanel so that another drawing can be made by over (if the guy did a mistake and wants to correct). I need it to go blank again and delete all points that might be there.



    second, how do I tell if there is something drawn in a Jpanel ? So that the user doesn't validate without having drawn something.

    I might have some other questions later, but right now those are the only pressing matters.

    And yes, I am a noob.

    Thanks a lot.

    Nyx.
    Patronized by Hader.


  2. #2
    english tyrant's Avatar Domesticus
    Join Date
    Dec 2006
    Location
    Colchester
    Posts
    2,112

    Default Re: A Java related question

    Googled: "Clearing a Jpanel"
    Result: http://www.coderanch.com/t/345317/GU...ore-repainting

    JPanel panel = new JPanel();
    //remove all components in panel.
    panel.removeAll();
    // refresh the panel.
    panel.updateUI();

  3. #3
    Nyxos's Avatar when in doubt, doubt.
    Join Date
    Oct 2009
    Location
    Somewhere over the rainbow (aka France)
    Posts
    4,227

    Default Re: A Java related question

    Quote Originally Posted by english tyrant View Post
    Googled: "Clearing a Jpanel"
    Result: http://www.coderanch.com/t/345317/GU...ore-repainting

    thanks ! I had the removeAll part but not the updateUI lol I hate programming ...

    On a related matter I'm not sure it empties the table where the points are, it seems to do so since I'm not having errors or such and the number of points I get seems reasonable but I want to make sure there isn't a dumb way to empty a table, like table = null;

    And for those of you that might think I can't use google or ask my teacher, I'd like to say that every time my teacher has helped she broke half the program, and that google.fr is crap

    + rep btw for having a better google than I
    Patronized by Hader.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •