• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why I cannot Move my JLabel after I add SetToolTipText()??

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends:
I met a tough problem that I debugged for few days but cannot solve it.
after I add SetToolTipText I cannot Move my JLabel , what is wrong here??
see code below, here label1 cannot move.
If somebody can throw some lights, that will be wonderful,
so far no progress.

 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For some additional information you can check out the evaluation section of this:
Bug ID: 4413412 Mouse Events intercepted by Tooltip
 
Michelle Wang
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much, it really works!! good weekends!!
 
Michelle Wang
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for both super stars' great feed back.
I tried to cooperate my following code into your great code so that I can do:
[1]. setToolTipText
[2]. make JLabel DnD
and also
[3]. Make JLabel border resizeable, ie I can drag JLabel border and can resize it, I tried but fail several times, here I can DnD and resize, but cannot setToolTipText at same time, it fails.
It is Craig's great code before, see below:
Can gurus help some more??

Thanks


[ July 15, 2007: Message edited by: girl sunny ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you read the evaluation section of the bug report cited in reply 1 you will understand
why the addition of toolTipText calls on the child components consumes the MouseEvents which
should be reported in the mouse methods of the ComponentMover class. In the DnDJLabelsRx
class of reply 1 there is a MouseInputAdapter which overrides each mouse method found in the
ComponentMover nested class. This extra MouseInputAdapter is added to each child component
of the enclosing class (DnDJLabelsRx) for the purpose of receiving mouse input and re–
dispatching the (converted) MouseEvents to the parent/host class (DnDJLabelsRx).

So in your Resizing class you will need to do the same thing. Add a MouseInputAdapter to
each child component to receive/re–dispatch the MouseEvents that the ComponentMover class is
monitoring; there are four of these methods that this extra MouseInputAdapter must override
for this.
You might want to either change the class names or run this in a separate folder to avoid
name clashing and/or old class files. It seems to work okay as–is.
edit: fix typo and remove one sentence.
[ July 16, 2007: Message edited by: Craig Wood ]
 
Michelle Wang
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks so much for this so valuable advice
 
Michelle Wang
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sir:
Based on your wonderful code, I create another programs, both DnDJLabelsRx.java
DnDJLabelsRxOuter.java;

here they are very similiar, but DnDJLabelsRx.java calls DnDJLabelsRxOuter.java,

here, I can see all setToolTipText available,
but I met a problem:

I can move label2, label3, label4; but I cannot freely move label1 unless I press any child label in label1.

I hope
[1].when I click any child label in label1, this child label pressed will be dragged and dropped but its parent JPanel/JLabel=label1 not move, all other its siblings keep unchanged.

[2].when I click any blank space in label1 instead any of child labels in label1, I can only freely move/drag and drop whole label1(ie JPanel inside) but I cannot move any of its child labels

so far I cannot do that, can guru help??
Really thanks

1. main program:




2. called program:


[ July 18, 2007: Message edited by: girl sunny ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most of the work for this was shown in DraggingAGroup in (reply 6 of) your previous thread
How to group these JLabels?
 
Michelle Wang
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Craig, your excellent code gave me very valuable message,
My case is more general, for example,
Grandparent JPanel GParent has children JLabel Parent_A, Parent_B, Parent_C;
ParentA has children JLabels Child_A, Child_B, Child_C;
Child_A has GrandChild_A,GrandChild_B,GrandChild_C etc;
this family tree is unlimited;

How can I use a very simple way to pass dispatcher from bottom to any level of its ancestors??
ie, GrandChild_A can pass its dispatcher to not only Child_A, but also can pass its dispatcher to Parent_A, GrandChild_A etc so that in the top level or any levels above GrandChild_A, I can access and DnD the GrandChild_A and any other labels with easy, and I can DnD/move any JLabel in any level at my will after I setToolTipText for all JLabels. not like this case only two levels but so complicated.

Here my posted code(actually is Craig's great code) looks like more close to the requirements of my project.
Can guru help implement this more general idea??
Thanks
[ July 20, 2007: Message edited by: girl sunny ]
 
Michelle Wang
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my case is a little bit more complicated, it requires to pass/dispatch mouseMotionListener and mosueListener to not only its own parent, but its all possible ancestors, how to solve this more general problem??
really need help.
thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic