Author |
Message |
31/03/2008 11:04:05
|
hilka
Power User
Joined: 23/11/2007 09:00:08
Messages: 191
Offline
|
Hello,
is it possible to have some multiline text with buttons? We have the problem that our button texts can constist of several words. At the moment, longer texts are just cut off. Would be nice if there is some auto-wrapping functionality.
Tobias
|
|
|
31/03/2008 13:09:35
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5519
Offline
|
Hi Tobias,
this is possible: you can pass an HTML text to the button's TEXT attribute. It MUST start with "<html>" and MUST end with "</html>". In between you can use "<br>".
Well, I would have preferred a simple "\n", but this is not supported by JButton...
Björn
PS: please do not maintin the HTML text in the layout editor's attribute section... it will translate "<" and ">" into "<" and ">"... But you can pass from your code (expression) or from a resource file...
|
Björn Müller, CaptainCasa GmbH |
|
|
14/05/2008 17:58:52
|
kretzler
Power User
Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline
|
Hello Björn,
this solution works fine if I add the line break automaticly.
Our problem is that we have several languages like english, russian or arabia so the translater would be overstrained to transalte a literal like ...
<html><div align=center>Berichte und Export</div></html>
We have also the problem that we cant wrap automaticly because we dont know where to add a line break. If we had only to transalte english and german we could say we wrap after 12 signs but 12 russian signs can be much longer.
Any idea how to handle this problem?
Thanks,
Ralph
|
|
|
26/05/2008 09:50:08
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5519
Offline
|
From today on there is a new icon: ICONSEPTEXT, which explicitly has the feature to hold a multi-line text below the image of the icon.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
26/05/2008 11:20:16
|
kretzler
Power User
Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline
|
Hello Björn,
I checked the example of the new icon in the demo workplace and tried to adapt it to add it programmaticly.
This code works fine
BUTTONComponentTag bt = new BUTTONComponentTag();
bt.setActionListener("#{d.workplace.onExecuteButton}");
AssignID.assign(bt);
bt.setText(m_bean.replaceLiteral(command.getTextId()));
bt.setTooltip(m_bean.replaceLiteral(command.getTextId()));
bt.setImage("../" + command.getImage());
BaseComponent btn = bt.createBaseComponent();
res.put(btn, command);
r.getChildren().add(btn);
This code doesent work. (I cant see text and the actionListener isnt working too.)
ICONSEPTEXTComponentTag bt = new ICONSEPTEXTComponentTag();
bt.setActionListener("#{d.workplace.onExecuteButton}");
AssignID.assign(bt);
bt.setText(m_bean.replaceLiteral(command.getTextId()));
bt.setTooltip(m_bean.replaceLiteral(command.getTextId()));
bt.setImage("../" + command.getImage());
BaseComponent btn = bt.createBaseComponent();
res.put(btn, command);
r.getChildren().add(btn);
Any idea?
Thanks,
Ralph
|
|
|
26/05/2008 13:07:52
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5519
Offline
|
...not yet. I just checked the static and dynamic ICONSEPTEXT creation, no problem. Hmmm....?!
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
|