Resizing Figure [message #110593] |
Tue, 06 January 2004 09:37  |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Hi Friends,
My Figure contains one Label. The text of the label
should be editable. I like to resize my figure with respect to the text
of the Label. How can i do this?.
Regards,
David Danie.
|
|
|
|
|
|
|
|
Re: Resizing Figure [message #110991 is a reply to message #110792] |
Fri, 09 January 2004 10:14   |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Randy Hudson wrote:
> This sounds like what is described in our article. Use a ToolbarLayout.
>
> "David Danie" <david_danie@hotmail.com> wrote in message
> news:btije6$acf$1@eclipse.org...
>
>>Randy Hudson wrote:
>>
>>>You have a figure which contains one label. I guess my first question
>
> would
>
>>>be what does your figure do? Why not just use label?
>>>
>>>If you do need to wrap one figure inside another, using draw2d's
>
> StackLayout
>
>>>will allow the outer figure to return a correct preferred size based on
>
> its
>
>>>insets and the inner figure's preferred size. Label already calculate
>
> its
>
>>>preferred size correctly to accomodate the text and/or icon.
>>>
>>>The final piece would be what is containing "My Figure"? If you put it
>>>inside and XYLayout, and give it a width and height == "-1", it will be
>>>auto-sized to its preferred size. (And stack layout will size the label
>>>inside the wrapper figure).
>>>
>>>Hope this helps
>>>
>>>"David Danie" <david_danie@hotmail.com> wrote in message
>>>news:bteh67$mkj$1@eclipse.org...
>>>
>>>
>>>>Hi Friends,
>>>> My Figure contains one Label. The text of the label
>>>>should be editable. I like to resize my figure with respect to the text
>>>>of the Label. How can i do this?.
>>>>
>>>>Regards,
>>>>David Danie.
>>>>
>>>
>>>
>>>
>>Hi Randy,
>> My Figure have two compartments. the top level compartment
>>contains only one label. the other one contains multiple labels(i like
>>to add labels dynamically).
>>
>>thanks
>>David Danie.
>>
>
>
>
Everything is working except the alignment. In my Figure i write this code,
{
XYLayout outerlayout = new XYLayout();
setLayoutManager(outerlayout);
Figure top = new Figure();
outerlayout.setConstraint(top, new Rectangle(5, 5, -1, -1));
ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
layout.setSpacing(20);
top.setLayoutManager(layout);
Label nameFigure = new Label();
nameFigure.setText("XYZ");
top.add(nameFigure);
add(top);
setOpaque(true);
}
The Label "XYZ" is always displayed in left corner. But i want to be
displayed in Center. What is wrong in my code.
thanks
David Danie.
|
|
|
Re: Resizing Figure [message #111004 is a reply to message #110991] |
Fri, 09 January 2004 12:49   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
I didn't try running your code. Sometimes it helps to put LineBorders on
things to see exactly where they are. If the label is wider than it needs
to be, you can have it center its text/icon using setLabelAlignment(int).
"David Danie" <david_danie@hotmail.com> wrote in message
news:btmge6$ojf$1@eclipse.org...
> Randy Hudson wrote:
> > This sounds like what is described in our article. Use a ToolbarLayout.
> >
> > "David Danie" <david_danie@hotmail.com> wrote in message
> > news:btije6$acf$1@eclipse.org...
> >
> >>Randy Hudson wrote:
> >>
> >>>You have a figure which contains one label. I guess my first question
> >
> > would
> >
> >>>be what does your figure do? Why not just use label?
> >>>
> >>>If you do need to wrap one figure inside another, using draw2d's
> >
> > StackLayout
> >
> >>>will allow the outer figure to return a correct preferred size based on
> >
> > its
> >
> >>>insets and the inner figure's preferred size. Label already calculate
> >
> > its
> >
> >>>preferred size correctly to accomodate the text and/or icon.
> >>>
> >>>The final piece would be what is containing "My Figure"? If you put it
> >>>inside and XYLayout, and give it a width and height == "-1", it will be
> >>>auto-sized to its preferred size. (And stack layout will size the label
> >>>inside the wrapper figure).
> >>>
> >>>Hope this helps
> >>>
> >>>"David Danie" <david_danie@hotmail.com> wrote in message
> >>>news:bteh67$mkj$1@eclipse.org...
> >>>
> >>>
> >>>>Hi Friends,
> >>>> My Figure contains one Label. The text of the label
> >>>>should be editable. I like to resize my figure with respect to the
text
> >>>>of the Label. How can i do this?.
> >>>>
> >>>>Regards,
> >>>>David Danie.
> >>>>
> >>>
> >>>
> >>>
> >>Hi Randy,
> >> My Figure have two compartments. the top level compartment
> >>contains only one label. the other one contains multiple labels(i like
> >>to add labels dynamically).
> >>
> >>thanks
> >>David Danie.
> >>
> >
> >
> >
>
> Everything is working except the alignment. In my Figure i write this
code,
>
> {
> XYLayout outerlayout = new XYLayout();
> setLayoutManager(outerlayout);
> Figure top = new Figure();
> outerlayout.setConstraint(top, new Rectangle(5, 5, -1, -1));
> ToolbarLayout layout = new ToolbarLayout();
> layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
> layout.setSpacing(20);
> top.setLayoutManager(layout);
> Label nameFigure = new Label();
> nameFigure.setText("XYZ");
> top.add(nameFigure);
> add(top);
> setOpaque(true);
> }
>
> The Label "XYZ" is always displayed in left corner. But i want to be
> displayed in Center. What is wrong in my code.
>
> thanks
> David Danie.
>
|
|
|
Re: Resizing Figure [message #111039 is a reply to message #111004] |
Sat, 10 January 2004 00:19   |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Randy Hudson wrote:
> I didn't try running your code. Sometimes it helps to put LineBorders on
> things to see exactly where they are. If the label is wider than it needs
> to be, you can have it center its text/icon using setLabelAlignment(int).
>
> "David Danie" <david_danie@hotmail.com> wrote in message
> news:btmge6$ojf$1@eclipse.org...
>
>>Randy Hudson wrote:
>>
>>>This sounds like what is described in our article. Use a ToolbarLayout.
>>>
>>>"David Danie" <david_danie@hotmail.com> wrote in message
>>>news:btije6$acf$1@eclipse.org...
>>>
>>>
>>>>Randy Hudson wrote:
>>>>
>>>>
>>>>>You have a figure which contains one label. I guess my first question
>>>
>>>would
>>>
>>>
>>>>>be what does your figure do? Why not just use label?
>>>>>
>>>>>If you do need to wrap one figure inside another, using draw2d's
>>>
>>>StackLayout
>>>
>>>
>>>>>will allow the outer figure to return a correct preferred size based on
>>>
>>>its
>>>
>>>
>>>>>insets and the inner figure's preferred size. Label already calculate
>>>
>>>its
>>>
>>>
>>>>>preferred size correctly to accomodate the text and/or icon.
>>>>>
>>>>>The final piece would be what is containing "My Figure"? If you put it
>>>>>inside and XYLayout, and give it a width and height == "-1", it will be
>>>>>auto-sized to its preferred size. (And stack layout will size the label
>>>>>inside the wrapper figure).
>>>>>
>>>>>Hope this helps
>>>>>
>>>>>"David Danie" <david_danie@hotmail.com> wrote in message
>>>>>news:bteh67$mkj$1@eclipse.org...
>>>>>
>>>>>
>>>>>
>>>>>>Hi Friends,
>>>>>> My Figure contains one Label. The text of the label
>>>>>>should be editable. I like to resize my figure with respect to the
>
> text
>
>>>>>>of the Label. How can i do this?.
>>>>>>
>>>>>>Regards,
>>>>>>David Danie.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>Hi Randy,
>>>> My Figure have two compartments. the top level compartment
>>>>contains only one label. the other one contains multiple labels(i like
>>>>to add labels dynamically).
>>>>
>>>>thanks
>>>>David Danie.
>>>>
>>>
>>>
>>>
>>Everything is working except the alignment. In my Figure i write this
>
> code,
>
>>{
>>XYLayout outerlayout = new XYLayout();
>>setLayoutManager(outerlayout);
>>Figure top = new Figure();
>>outerlayout.setConstraint(top, new Rectangle(5, 5, -1, -1));
>>ToolbarLayout layout = new ToolbarLayout();
>>layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
>>layout.setSpacing(20);
>>top.setLayoutManager(layout);
>>Label nameFigure = new Label();
>>nameFigure.setText("XYZ");
>>top.add(nameFigure);
>>add(top);
>>setOpaque(true);
>>}
>>
>>The Label "XYZ" is always displayed in left corner. But i want to be
>>displayed in Center. What is wrong in my code.
>>
>>thanks
>>David Danie.
>>
>
>
>
I tried setLabelAlignment(int) method also. but i get the same result.
Thanks
David Danie.
|
|
|
Re: Resizing Figure [message #111293 is a reply to message #111039] |
Tue, 13 January 2004 17:29  |
Eclipse User |
|
|
|
> >>Everything is working except the alignment. In my Figure i write this
> >
> > code,
> >
> >>{
> >>XYLayout outerlayout = new XYLayout();
> >>setLayoutManager(outerlayout);
> >>Figure top = new Figure();
> >>outerlayout.setConstraint(top, new Rectangle(5, 5, -1, -1));
> >>ToolbarLayout layout = new ToolbarLayout();
> >>layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
> >>layout.setSpacing(20);
> >>top.setLayoutManager(layout);
> >>Label nameFigure = new Label();
> >>nameFigure.setText("XYZ");
> >>top.add(nameFigure);
> >>add(top);
> >>setOpaque(true);
> >>}
> >>
> >>The Label "XYZ" is always displayed in left corner. But i want to be
> >>displayed in Center. What is wrong in my code.
> >>
> >>thanks
> >>David Danie.
> >>
> >
> >
> >
>
> I tried setLabelAlignment(int) method also. but i get the same result.
I had this same problem a few days ago and resorted to using a StackLayout
within the containing figure, but that worked for me because I only had a
single label within the containing figure.
Sean.
|
|
|
Powered by
FUDForum. Page generated in 0.22782 seconds