Sorry, I can not see the red line from here.under red line
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.
Sorry, I can not see the red line from here.under red line
If you don't understand my answer, don't ignore it, ask a question.
guess u cant help then, thanks anyways
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.
if i was to leave the drop point as a textarea can i still do the logic bit???
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.
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?
You should be able to fix a compiler error.
If you don't understand my answer, don't ignore it, ask a question.
is it even possible to have a drop point as a label???
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.
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!
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
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.
i have done it doesnt work.. thats what i thought i could do originally but obviously not.
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.it doesnt work
You can not test code that does not compile.
If you don't understand my answer, don't ignore it, ask a question.
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.
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.
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.
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.
okay yea i have that working now. So now how do i get it to accept the drop if it matches the 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.
do i need to make a key for images or somthing ?
do u have an example which may help me do the string bit?
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?how do i get it to accept the drop if it matches the image?
If you don't understand my answer, don't ignore it, ask a question.
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.
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.