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 6 of 8 FirstFirst ... 45678 LastLast
Results 126 to 150 of 192

Thread: drag and drop word to match image

  1. #126
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    Change the constructor in the class that needs to receive the String to be accepted.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    what do i change dragdropexample to?

    i only have class do i need another?
    Last edited by stresstedout; March 4th, 2014 at 01:41 AM.

  3. #128
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    What are those int values used for? Why are they in the testing program's constructor?


    Think about what the program is supposed to do: Allow the user to drag a String from one component to another component where the String will either be accepted or rejected. When the target component is built using a constructor the String that it will use to determine acceptance must be passed to it and saved so it can be used to test with when the user drags and drops a String onto it.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    dragContents? DropTargetTextArea

    is one them correct??
    Last edited by stresstedout; February 27th, 2014 at 09:41 PM.

  5. #130
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    How many classes are in the program?
    Forget the testing class that builds the frame that has the components added to it for the GUI.

    From the other classes,
    which class has the source of the dragged String.
    which class is the target where the String is dragged to where it is either accepted or rejected

    Both of the above classes need to have a String passed to their constructor.
    The source class to define the String to drag
    The target class to define the String that is to be accepted
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    which class has the source of the dragged String. answer DraggableLabel
    which class is the target where the String is dragged to where it is either accepted or rejected answer DropTargetTextArea

  7. #132
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    Ok, now write the constructors for those two classes to take a String and save it for use.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    they currently look like this
    Last edited by stresstedout; March 4th, 2014 at 01:41 AM.

  9. #134
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    Then you need to change the one that does not take a String so that it does.
    If you don't understand my answer, don't ignore it, ask a question.

  10. #135
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    What is that code posted for?

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

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

    Default Re: drag and drop word to match image

    i dont understand how to do this or why the drop target need the string?

    --- Update ---

    i have up until march 3 2014 to complete this, i know it takes me time to understand what i am doing but please help me i need to fix this and get the exception working where the drop target decides which string to take. PLEASE HELP ME
    Last edited by stresstedout; February 28th, 2014 at 12:03 AM.

  12. #137
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    why the drop target need the string
    If it doesn't need a String, then write the program without a String.

    the drop target decides which string to take
    Where will the String the drop target will use for that come from?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    it will come from the draggablelabel class right?

  14. #139
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    What String will be used by the DropTargetTextArea object to compare against the String from the DraggableLabel objects?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    the strings need to assigned.. i have delted that from the method.

  16. #141
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    the strings need to assigned
    Where do the Strings come from?
    In the final program, there can be many drop targets. Each will have a different String. How will each of those drop targets get the Strings they need?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    isit by doing what u said.. passing the strings through the constructor?

  18. #143
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    Yes, that is how I would do it.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    please can you start me off on how to allow this to take the string for this piece of code.
    Last edited by stresstedout; March 4th, 2014 at 01:42 AM.

  20. #145
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    That is invalid code. There should not be any "s
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    i have updated it

  22. #147
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    Does it compile and execute without errors now?
    Does it work like you want?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    Quote Originally Posted by Norm View Post
    Does it compile and execute without errors now?
    Does it work like you want?


    No because I dont know how to add the string bit.
    Please can you help m with that. Refer to post #114

  24. #149
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: drag and drop word to match image

    See post#133 for an example of a constructor that takes a String as argument.

    Refer to post #114
    This is post#114
    Don't be in a hurry to move the testing code into the main program. It will be easier to work out the techniques in the test program.
    What is your question about post #114?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: drag and drop word to match image

    Ive seen that and I understand iy but im just confused on how to implement it with code.

    Do I need to delete any part of the code in post #114 or do I add to it??

Page 6 of 8 FirstFirst ... 45678 LastLast

Similar Threads

  1. Drag and Drop in JTrees
    By helloworld922 in forum Java Swing Tutorials
    Replies: 4
    Last Post: March 21st, 2014, 11:16 AM
  2. [SOLVED] Drag and drop in MVC
    By Alice in forum Object Oriented Programming
    Replies: 9
    Last Post: December 9th, 2010, 10:16 PM
  3. Drag and Drop in JTrees
    By helloworld922 in forum Java Code Snippets and Tutorials
    Replies: 2
    Last Post: February 20th, 2010, 03:52 PM
  4. Drag and Drop in JTrees
    By helloworld922 in forum AWT / Java Swing
    Replies: 2
    Last Post: January 19th, 2010, 11:51 PM
  5. 'MouseUp' Drag and Drop Events
    By copeg in forum AWT / Java Swing
    Replies: 0
    Last Post: November 10th, 2009, 07:21 PM