GWT 2.7
How can I set inline text in GWT Button
Button b = new Button("Inline Text");
I don't want text on 2 lines into the button.
You can give the button a width:
button.setWidth("200px");
so that the button has enough space to display the text in one line.
Or you can add a stylesheet with:
button.addStyleName("myStyle");
and this stylesheets contains the line:
.myStyle { white-space: nowrap; }
This should work.
Uglier, but easier ;-) you could replace blanks in your string label with or :
Button b = new Button("Inline Text");
Related
I try to use a javafx TextFlow to view some styled text. The following code does not do any text styling.
public Node createText(String t,String cls){
Text ret = new Text(t);
ret.getStyleClass().add(cls);
return ret;
}
When I replace Text with Label it works properly, but things like \n obviously do not work anymore. How can I use the Text class with css classes?
EDIT: As requested a short example of my default.css
.defaultElementAttr{
-fx-text-fill:#48a711;
}
-fx-text-fill is a CSS property of Label but it is not a CSS property of Text.
If you want to change the color of a Text object with CSS, use the -fx-fill property:
.defaultElementAttr {
-fx-fill:#48a711;
}
I tried to develop ui table control with multi select option.
The label of each column is sap.m.Text:
But when i re size the column width, parts from the label text are hide:
It's all because of the "sapUiSizeCozy" class for the multi select option (the checkbox)
When i don't use this "sapUiSizeCozy" class the label text will be OK and wrapped, but, there will no be checkboxex:
I add this css class to the sap.m.Page control
Any help?
I need that the label will wrapped + the checkbox in each row
Thanks!
Edit:
Please see an example in:
Plunker
You can in view.xml file remove the:
class="sapUiSizeCozy"
And re size the Product Name" column to see that the column is wrapping
sapUiSizeCozy sets a fixed height to the table header. The label text is then verticaly centered by sapUiSizeCozy by setting lineheight to the height of the header.
This results in the effect that the label is wrapped but the second row is cut of by the fixed header height.
You can fix that with the following css (see Plunker):
<html:style>
.sapUiSizeCozy .sapUiTable .sapUiTableColCell>* span{
line-height: normal;
vertical-align: middle;
display: inline-block;
}
</html:style>
I need to use textarea in my program and I also need it to be read-only.
This is part of my main program where I create textArea:
final TextArea ta = new TextArea();
ta.setMaxSize(9*x, 7*x);
ta.setId("textarea");
ta.setTranslateX(x);
ta.setTranslateY(2*x);
ta.setDisable(true);
This is part of my css file:
#textarea {
-fx-font: 13px "Serif";
-fx-background-color: BEIGE;
}
If I delete the row: ta.setDisable(true); Css works like I want it to work. But after I set disable true, it just makes the textarea transparent, which makes the text really hard to read and the background color is not excatly what I want too.
Is there any other way to set text readonly? Or is there a way to use css after disable. I really need it to be TextArea not Label or any other type. Thank you in advance.
If you do not want the user to make changes to the textarea use the setEditable(boolean) method to false. The same method exists for most editable nodes in javafx(Textfield and PasswordField).
I'm working on one large site and currently all radio buttons look like this:
In my View I have this code:
#Html.RadioButton("new", "new", false, new { #onclick = "New()", #id = "new", #class="radio-button" }) Some Text
And CSS for radio button:
.radio-button label {
width:5px;
}
That width doesn't change anything. How can I remove all that space around radio button and have text near radio button? I was looking in that generated CSS Site.css but I can't find where it's defined to be like that.
Thank you!
Are you definig input width in somewhere else? Its not semantical ,but try
margin:0;
padding:0;
width:5px!important;
If it works, try to "inspect element" with Developer Tools(chrome) to see if it hav any inheritance
I am treating a spark TextArea as text input(by setting heightInLines="1"). The TextArea is part of an mxml component and I want to resize the component when the text is changed.
I haven't been able to use textArea.measureaText(textArea.text) to get line metrics and use it. I get this error "Parameter antiAliasType must be non-null."
Is there any way to get the width of a TextArea which it is going to consume at runtime for a particular string or a particular TextFlow?
A little ugly but works for me:
var uiText:UItextField = new UITextField();
// if you have custom text style on the TextArea then set it the same of this uitextfield
uiText.setTextFormat("bla bla bla");
uiText.text = "This is the text that I want the size for";
var textW:Number = uiText.textWidth;
var textH:Number = uiText.textHeight;
// then we need to consider also the border of the text area and the paddings
// try read the padding values and border sizes using getStyle(...)
myTextArea.width = textW+2*borderW+paddingL+paddingR;
myTextArea.height = textH+2*borderH+paddingT+paddingB;
That should be all