Re: HowTo questions
Ross Wetmore <[email protected]>
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Gerald
A little more progress, a few more deadends ...
Gerald Bauer wrote:
>>1) Caption alignment
>> I have a caption in a Groupbox. It is always
>>left
>>justified and nothing in the style or attributes
>>seems
>>to have any effect on this. How do I get it
>>centered.
>
> It's not yet supported. You might wantto add the
> missing code yourself using CSS properties, for
> example.
Something like this seems to do the trick.
GroupBoxPeer.java:
...
if( captionDef != null )
{
String caption = captionDef.getLabel();
+ int justify = TitledBorder.DEFAULT_JUSTIFICATION;
+ int position = TitledBorder.DEFAULT_POSITION;
+
+ switch ( captionDef.getAlign(-1) )
+ {
+ case SwingConstants.LEFT:
+ justify = TitledBorder.LEFT;
+ break;
+ case SwingConstants.CENTER:
+ justify = TitledBorder.CENTER;
+ break;
+ case SwingConstants.RIGHT:
+ justify = TitledBorder.RIGHT;
+ break;
+ // fallthrough for default case
+ }
+
+ switch ( captionDef.getVerticalAlign(-1) )
+ {
+ case SwingConstants.TOP:
+ position = TitledBorder.TOP;
+ break;
+ case SwingConstants.BOTTOM:
+ position = TitledBorder.BOTTOM;
+ break;
+ // fallthrough for default case
+ }
+
border = BorderFactory.createTitledBorder(
- innerBorder, caption );
+ innerBorder, caption, justify, position );
}
>
>>2) Center an image
>> I have a groupbox in which a number of items
>>are
>>laid out vertically, one of which is an image but it
>>is not the widest element. It is always left
>>justified. Even putting it inside an hbox surrounded
>>by spacers will not move it from the left edge.
>> What trick am I missing?
>
> I guess you're not missing any because it's not yet
> supported. Again you're more than welcome to add the
> the missing code yourself.
But why won't it work within an hbox? I can see a
problem with image having incomplete tags, but putting
flexible spacers on either side of it should not be
affected by this, no?
>>3) Multiline labels
>> I appear to have done something because the
>>label
>>takes up varying space. But there is no text visible
>>in the featureless label pane.
>> What do I need to do to actually see a
>>multiline
>>label? What is needed to have it understand html
>>tags?
>
> For use of multiline labels you need to use (x)html
> tags inside the label's content instead of a value
> attribute. Example:
>
> <label>
> <html>
> First para<br/>
> Second para
> </html>
> </label>
>
> This should work properly.
Nope, still get blank panes for labels. No errors,
no obvious differences with any examples.
>>4) Tabpanel orientation
>> I have a nice set of tabs across the top of a
>>tabpanel viewing area. But I want the tabs across
>>the
>>bottom. I reordered the tabpanels and tabs blocks
>>and
>>looked for alignment attributes, but so far nothing
>>seems to work or lead to a solution.
>
> It's not yet supported.
Adding these lines to TabBoxPeer almost makes it
except that for some reason it doesn't understand
core attributes, aka the Css tags like Caption
does even though the DTD says it should (however
I'm starting to believe the DTD is a smokescreen
as most of its syntax appears to be hardcoded in
various layers rather than it defining the DOM
actions and flow).
There is probably another layer that needs some
more implementation below this, or a bug in the Def
hierarchy since the boxes seem to eventually work
their way down to a simple XulTag and that seems to
be all that CaptionDef needed.
+ int position = SwingConstants.TOP;
+ // this line will show the desired effect
+ // position = SwingConstants.BOTTOM;
+
+ switch ( def.getAlign(-1) )
+ {
+ case SwingConstants.LEFT:
+ position = SwingConstants.LEFT;
+ break;
+ case SwingConstants.RIGHT:
+ position = SwingConstants.RIGHT;
+ break;
+ // fallthrough for default case
+ }
+
+ switch ( def.getVerticalAlign(-1) )
+ {
+ case SwingConstants.TOP:
+ position = SwingConstants.TOP;
+ break;
+ case SwingConstants.BOTTOM:
+ position = SwingConstants.BOTTOM;
+ break;
+ // fallthrough for default case
+ }
- _tab = new JTabbedPane();
+ _tab = new JTabbedPane(position);
>>5) Menuitem links
>> I have a menubar with a dropdown list of
>>menuitems.
>>I would like to have the menuitem action link to or
>>cause the same effect as clicking on one of the tabs
>>in the tabpanel. How can this be done?
>
> I'm not sure what you mean. You can use the command
> attribute to execute actions whenever the user clicks
> on the menuitem and the href attribute to show web
> documents.
I mean when I click on the menuitem, it works the same
as clicking on a tab, it raises the tabbed pane.
There is no obvious command the tabs execute to
select their panel that the menuitem can also point at.
Also, menuitems appear to have "key"s and not
"command"s, right?
I also cannot find where Css.Property elements are
defined. All the various tag values seem to work down
to these, but they are not obviously documented and
this seems to be the ultimate place where the syntax
is really defined for some things.
Cheers,
RossW
=====
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en