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 2 of 8 FirstFirst 1234 ... LastLast
Results 26 to 50 of 192

Thread: drag and drop word to match image

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

    Default Re: drag and drop word to match image

    under red line
    Sorry, I can not see the red line from here.
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    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

    guess u cant help then, thanks anyways

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

    Default Re: drag and drop word to match image

    Try using the javac compiler to get some good error messages that you can copy and paste here. Your IDE does not give good compiler error messages.
    If you don't understand my answer, don't ignore it, ask a question.

  4. #29
    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

    if i was to leave the drop point as a textarea can i still do the logic bit???

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

    Default Re: drag and drop word to match image

    You need to find and fix the error. You should not ignore it.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #31
    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 error is only there if cus im trying to change the drop textarea to a drop label..

    if i leave it as textarea i can move forward with the logic cus time is not on my side. will i be able to do the logic with the drop being textarea?

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

    Default Re: drag and drop word to match image

    You should be able to fix a compiler error.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #33
    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

    is it even possible to have a drop point as a label???

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

    Default Re: drag and drop word to match image

    Yes, I think any component can be a drop point (with the proper coding)
    If you don't understand my answer, don't ignore it, ask a question.

  10. #35
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: drag and drop word to match image

    It appears that you didn't have this drag and drop thing as wired as you originally thought, and I can't see that you've made any progress in this thread. To move forward, I suggest you post some code, describe the problems you're having with errors or descriptions of what is not working well, etc. Short study programs that take small steps from which to learn are more useful for discovery, practice, and sharing of new skills with others than a large project that has lots of moving parts, all of which may be in various stages of maturity.

    As always, keep coding and good luck!

  11. #36
    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 learnt drag and drop with textfield, not label to label so that is why i thought i just needed to change the code around but its not as easy as i thought. doing some research so when i'm done i will post somthing, but it seems to me as though you cannot do a label to label

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

    Default Re: drag and drop word to match image

    Try changing the code in post#11 by replacing the text field with a label.
    If you don't understand my answer, don't ignore it, ask a question.

  13. #38
    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 done it doesnt work.. thats what i thought i could do originally but obviously not.

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

    Default Re: drag and drop word to match image

    it doesnt work
    It doesn't work because it has syntax errors and will not compile. You need to find and fix the errors in the program so that it compiles without errors.
    You can not test code that does not compile.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #40
    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 oredi tried to do do the but this code wont let me add the JLabel

    the error is

    DropTargetJLabel is abstract; cannot be instantiated
    Last edited by stresstedout; March 4th, 2014 at 01:36 AM.

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

    Default Re: drag and drop word to match image

    Try making a few, simple changes to the code in post#11. There isn't any code like what you posted in #40 from post#11.
    If you don't understand my answer, don't ignore it, ask a question.

  17. #42
    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

    there is i hve tried to change this but i cannot

    --- Update ---

    [/COLOR]i have done a whole days of worth of research and i don't think that a label can be a drop target... if anyones any different please can you help me

    --- Update ---

    I don't really have to add a JLabel it can be a textfield too but the thing is i dont know how make it so it the Textfield only accepts the jlabel if it matches the image.

    --- Update ---



    --- Update ---

    Last edited by stresstedout; March 4th, 2014 at 01:36 AM.

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

    Default Re: drag and drop word to match image

    Did you try making the one change to post#11: change the class that extends TextArea to extend Label?
    If you don't understand my answer, don't ignore it, ask a question.

  19. #44
    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

    okay yea i have that working now. So now how do i get it to accept the drop if it matches the image?

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

    Default Re: drag and drop word to match image

    The drop target component needs a String that can be compared to the dragged String.

    For testing change the simple program you have working to have a String associated with the drop target so that it can accept one of the Strings from the drag source labels and reject the other.
    If you don't understand my answer, don't ignore it, ask a question.

  21. #46
    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

    do i need to make a key for images or somthing ?

    do u have an example which may help me do the string bit?

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

    Default Re: drag and drop word to match image

    Sorry, I don't know what you mean by "key".

    What is the "string bit"? I assume that you know how to define a constructor for a class that takes a String as argument and that you know how to call that constructor and pass it a String.

    how do i get it to accept the drop if it matches the image?
    What does that mean? How will the code determine if there is a match?
    If you don't understand my answer, don't ignore it, ask a question.

  23. #48
    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
    Sorry, I don't know what you mean by "key".

    What is the "string bit"? I assume that you know how to define a constructor for a class that takes a String as argument and that you know how to call that constructor and pass it a String.

    What does that mean? How will the code determine if there is a match?
    yes

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

    Default Re: drag and drop word to match image

    Start by making a small change to the code from post#11. Change it so that the drop target only accepts a drop from one of the two drag sources and rejects a drag from the other source.
    If you don't understand my answer, don't ignore it, ask a question.

  25. #50
    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

    can i get an example of some sort please to help me to do this Change it so that the drop target only accepts a drop from one of the two drag sources and rejects a drag from the other source.

Page 2 of 8 FirstFirst 1234 ... 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