PDA

View Full Version : How to make button text bold?



x4444
20 Oct 2009, 9:27 AM
The easiest solution?

of course the code below make no effect on button text, so how to set style to underneath html <button>?
button.setStyleAttribute("fontWeight", "bold");



<table id="x-auto-2" class="x-btn-wrap x-btn" cellspacing="0"
cellpadding="0" border="0" style="font-weight: bold; width: auto;">
<tbody>
<tr>
<td class="x-btn-left"><i> </i></td>
<td class="x-btn-center"><em unselectable="on">
<button class="x-btn-text" type="button" tabindex="0">Search</button>
</em>
</td>
<td class="x-btn-right"></td>
</tr>
</tbody>
</table>

x4444
20 Oct 2009, 9:10 PM
final Button updBtn = new Button("Update");
updBtn.addListener(Events.Render, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
Element e = (Element) updBtn.getElement().getFirstChildElement().getFirstChildElement().getFirstChildElement().getNextSiblingElement().getFirstChildElement().getFirstChildElement();
DOM.setStyleAttribute(e, "fontWeight", "bold");
};
});

sven
22 Oct 2009, 1:27 AM
I would to it with css.



btn.addStyleName("mybtn");

.mybtn button {
font-weight: bold;
}

x4444
22 Oct 2009, 7:09 AM
Thank. that's really cool. I need to gain more CSS knowledge.