Dragging JLabels on JPanels afterwards [message #108037] |
Sat, 24 September 2005 12:12  |
Eclipse User |
|
|
|
Originally posted by: mail.jens-presser.de
Hi,
first i have to say, VE ist a really great tool. Saved me much time so
far :)
But here is one problem.
I create a Java Project
I create a Visual class, JFrame
I create a JLabel in the ContentPane of the JFrame
After that I create a JPanel in the ContentPane of JFrame.
Then i want to drag the JLabel onto the JPanel, but i cant.
I create a JButton, JTextField (and some other Components).
These Components can be dragged onto the JPanel afterwards.
So, it works with every Component I've checked, but not with JLabel.
I also tried this with JLabel and other Containers like SplitPanes etc.
Same thing. JLabel is not draggable while other Components are.
I tried several ways. In the Design View, in the JavaBeans View and so
on. In every way only JLabel cannot be dragged onto the JPanel.
My question:
Is it on purpose that you cannot drag JLabels onto Containers
afterwards? Perhaps there is an option to turn this off, which i don't find?
I hope you can help me :)
Thanks and greetings,
jghost
|
|
|
|
|
Re: Dragging JLabels on JPanels afterwards [message #108496 is a reply to message #108395] |
Fri, 30 September 2005 05:35   |
Eclipse User |
|
|
|
Originally posted by: mail.jens-presser.de
Rich Kulp wrote:
> This is because JLabel's are treated differently. Since JLabels are
> rarely needed outside of where they are created, the pattern is used
> where there is no separate get method for each JLabel. Instead they are
> created right where they are needed. We were complaints of so many get
> methods for labels being generated.
>
> The unfortunate side effect of this is since there is no get method for
> them they can't be moved. Moving them would require ripping the code out
> of one method and putting into a different method. Currently with
> getters for each child a move is simple. You just use the get method
> somewhere else. No moving of physical code.
>
> We will eventually fix this so that the code will be moved to a new
> method. But for now you can use cut/paste to do a move. Select the
> JLabel and do a cut, then do a paste and move the loaded cursor to where
> you want it to go.
>
> asdf wrote:
>
>> I've the same Problems and for me its a bug,
>> why Visual Editor should forbit the developer to drag JLabels from one
>> Panel to other Panel.
>
>
Ah, ok.
Thanks for the explanation, now I understand why it works that way :)
My suggestion would be, that you have an option to switch, if you want
to have Getters created or not, and a short explanation that if you let
VE create them, that you can drag the JLabels.
I think that way users have the choice of a trade-off.
* Dragging but many Getters
* No Getters for JLabels, but no dragging.
Here's another one, I found out what happens with the Getters.
For every Component I select from the Palette with the Components, there
is a Getter generated. For example when I select JTextField and then
create it on a JPanel it creates a Getter. Now, when I do that a second
time (choose a JTextField from the palette), there is a second Getter
generated.
Wouldn't it be useful to have just one Get Method for each Component
used? these Get Methods do the "new Component(...)" thing, and therefore
you need only one of them. I guess it should be possible to inspect the
class, find out if there is already a Getter for a particular Component
and in that case just use that one instead of creating new ones.
The drawback would be that you can't put in Componentspecific code into
these Getters, if you want to. The code in such a Getter would be run
everytime a Component of this specific type is created.
But perhaps it's possible to create an option for that, too?
These are just some spontaneous ideas in that way. Perhaps we can
discuss them? :)
greetings
jghost
|
|
|
Re: Dragging JLabels on JPanels afterwards [message #108524 is a reply to message #108496] |
Fri, 30 September 2005 10:14  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
That's more like a factory method. Our getters are actually to create
and initialize one specific instance. A different component, even though
of the same class, typically requires a different initialization. We
couldn't use the same initialization on each.
Factory methods are different in that each time called they create a new
guy that is customized the same way. At this time we don't support
factory methods.
--
Thanks,
Rich Kulp
|
|
|
|
Re: Dragging JLabels on JPanels afterwards [message #610888 is a reply to message #108379] |
Thu, 29 September 2005 14:34  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
This is because JLabel's are treated differently. Since JLabels are
rarely needed outside of where they are created, the pattern is used
where there is no separate get method for each JLabel. Instead they are
created right where they are needed. We were complaints of so many get
methods for labels being generated.
The unfortunate side effect of this is since there is no get method for
them they can't be moved. Moving them would require ripping the code out
of one method and putting into a different method. Currently with
getters for each child a move is simple. You just use the get method
somewhere else. No moving of physical code.
We will eventually fix this so that the code will be moved to a new
method. But for now you can use cut/paste to do a move. Select the
JLabel and do a cut, then do a paste and move the loaded cursor to where
you want it to go.
asdf wrote:
> I've the same Problems and for me its a bug,
> why Visual Editor should forbit the developer to drag JLabels from one Panel to other Panel.
--
Thanks,
Rich Kulp
|
|
|
Re: Dragging JLabels on JPanels afterwards [message #610895 is a reply to message #108395] |
Fri, 30 September 2005 05:35  |
Eclipse User |
|
|
|
Originally posted by: mail.jens-presser.de
Rich Kulp wrote:
> This is because JLabel's are treated differently. Since JLabels are
> rarely needed outside of where they are created, the pattern is used
> where there is no separate get method for each JLabel. Instead they are
> created right where they are needed. We were complaints of so many get
> methods for labels being generated.
>
> The unfortunate side effect of this is since there is no get method for
> them they can't be moved. Moving them would require ripping the code out
> of one method and putting into a different method. Currently with
> getters for each child a move is simple. You just use the get method
> somewhere else. No moving of physical code.
>
> We will eventually fix this so that the code will be moved to a new
> method. But for now you can use cut/paste to do a move. Select the
> JLabel and do a cut, then do a paste and move the loaded cursor to where
> you want it to go.
>
> asdf wrote:
>
>> I've the same Problems and for me its a bug,
>> why Visual Editor should forbit the developer to drag JLabels from one
>> Panel to other Panel.
>
>
Ah, ok.
Thanks for the explanation, now I understand why it works that way :)
My suggestion would be, that you have an option to switch, if you want
to have Getters created or not, and a short explanation that if you let
VE create them, that you can drag the JLabels.
I think that way users have the choice of a trade-off.
* Dragging but many Getters
* No Getters for JLabels, but no dragging.
Here's another one, I found out what happens with the Getters.
For every Component I select from the Palette with the Components, there
is a Getter generated. For example when I select JTextField and then
create it on a JPanel it creates a Getter. Now, when I do that a second
time (choose a JTextField from the palette), there is a second Getter
generated.
Wouldn't it be useful to have just one Get Method for each Component
used? these Get Methods do the "new Component(...)" thing, and therefore
you need only one of them. I guess it should be possible to inspect the
class, find out if there is already a Getter for a particular Component
and in that case just use that one instead of creating new ones.
The drawback would be that you can't put in Componentspecific code into
these Getters, if you want to. The code in such a Getter would be run
everytime a Component of this specific type is created.
But perhaps it's possible to create an option for that, too?
These are just some spontaneous ideas in that way. Perhaps we can
discuss them? :)
greetings
jghost
|
|
|
Re: Dragging JLabels on JPanels afterwards [message #610897 is a reply to message #108496] |
Fri, 30 September 2005 10:14  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
That's more like a factory method. Our getters are actually to create
and initialize one specific instance. A different component, even though
of the same class, typically requires a different initialization. We
couldn't use the same initialization on each.
Factory methods are different in that each time called they create a new
guy that is customized the same way. At this time we don't support
factory methods.
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.07037 seconds