Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 3 of 3 FirstFirst 123
Results 51 to 67 of 67

Thread: accept only assigned label dnd

  1. #51
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    what am i doing wrong ?
    Last edited by stresstedout; March 30th, 2014 at 06:20 PM.

  2. #52
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

    what am i doing wrong ?
    Please explain.
    What is wrong? If you get error messages, copy the full text and paste it here
    If you don't understand my answer, don't ignore it, ask a question.

  3. #53
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    is this correct in regards to post#50?
    Last edited by stresstedout; March 30th, 2014 at 06:20 PM.

  4. #54
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

    NO. It was partly correct in post#29

          this.droplabel = "moon";    // this value lost on the next line
          this.droplabel = "mouse";   //  THIS destroys what was saved above
    Also the droplabel arg passed to the constructor is not used.


    I don't know how you can code like this. These are absolute beginner's mistakes.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #55
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    now im really confused.

  6. #56
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

    The program should pass the String to be accepted to the constructor like was done in post#29.

    now im really confused.
    Yes, I think you are. This program continues to be past what your knowledge is capable of.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #57
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    yea u right im not best otherwise i wont be looking for help. but im sure i will understand it may take some time but im nearly there so can you help me or not?

  8. #58
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

    Look at post#29. Copy how it passed a String to the constructor for one instance of the class.
    If you want different drop targets that use different Strings, use the new statement like in post#29 to make new instances of the drop target each with its own String.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #59
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    is this correct? plain how i made a different drop target with its own string?
    Last edited by stresstedout; March 30th, 2014 at 06:20 PM.

  10. #60
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

    NO. There is no need for an array for a single value. Just save the String in a class level variable.

    Where is string2 defined? You should compile the code before you post it so you can also post any error messages that the compiler writes.

    how i made a different drop target with its own string
    Use the new statement to create different instances:
    DropT dt1 = new DropT("string1");   // one drop target with its own String: string1
    DropT dt2 = new DropT("secondString");  // another drop target with its own String: secondString
    If you don't understand my answer, don't ignore it, ask a question.

  11. #61
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    i have this error:
    these are lines of code
    Last edited by stresstedout; March 30th, 2014 at 06:20 PM.

  12. #62
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

     public DropTargetTextArea(String string1, String string2) {
    Please explain what string2 is supposed to be used for.

    BTW string1 and string2 are poor names for variables. Variable names should describe the values that the variable holds.
    What is in string1 and in string2?
    If you don't understand my answer, don't ignore it, ask a question.

  13. #63
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    public DropTargetTextArea(String moon) {

    sorry i forgot to take out string 2

    so its:

    is this correct?
    Last edited by stresstedout; March 30th, 2014 at 06:19 PM.

  14. #64
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

    sorry i forgot to take out string 2
    That was a big waste of time.

    Why is the arg named: moon? That is a strange name for a variable.

    What are these lines of code for?
                DropTarget dt1 = new DropTarget("moon");
                DropTarget dt2 = new DropTarget("");
    Do they compile without errors?
    If you don't understand my answer, don't ignore it, ask a question.

  15. #65
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    no i just ran it has errors

  16. #66
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: accept only assigned label dnd

    OK, I'm done for tonight. Back tomorrow.
    If you don't understand my answer, don't ignore it, ask a question.

  17. #67
    Member
    Join Date
    Jan 2014
    Posts
    209
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: accept only assigned label dnd

    bye

    --- Update ---

    CAN ANYONE ELSE HELP ME??????????????????

    --- Update ---

    Quote Originally Posted by stresstedout View Post
    bye

    --- Update ---

    CAN ANYONE ELSE HELP ME??????????????????
    Norm please can help me understand on how to finish this? I really am stuck. It will take time to understand.

Page 3 of 3 FirstFirst 123

Similar Threads

  1. How to not accept empty jfield?
    By myexternall11 in forum Java Theory & Questions
    Replies: 1
    Last Post: February 20th, 2012, 04:38 AM
  2. [SOLVED] Need help with updating label
    By Neacel in forum AWT / Java Swing
    Replies: 5
    Last Post: January 22nd, 2012, 02:38 PM
  3. JTree DnD Problem
    By hafunui in forum AWT / Java Swing
    Replies: 3
    Last Post: August 12th, 2011, 10:33 PM
  4. Label not showing up.
    By joshft91 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 1st, 2011, 03:36 PM
  5. Dropping to graphic element dragged from JList
    By tua1 in forum AWT / Java Swing
    Replies: 1
    Last Post: November 29th, 2008, 08:22 AM