Reputation: 139
I'm trying to make a Vaadin panel caption center-aligned.
Panel panel = new Panel("Summary");
panel.setSizeUndefined();
addComponent(panel);
How do I make it so "Summary" is in the center-top of the panel? Note: It's already at the top, but is default at top-left.
Bonus question: How do I make it so it's scrollable when I make the window smaller?
Upvotes: 1
Views: 980
Reputation: 4634
This will make your content scrollable and center your title. You can also do the same thing by adding a style to the panel using addStyleName
public class MyWindow extends Window
{
private String longText = "halloween halloween halloween halloween "
+ "halloween halloween halloween halloween halloween halloween "
+ "halloween halloween halloween halloween halloween halloween halloween halloween "
+ "halloween halloween halloween halloween halloween halloween halloween";
public MyWindow()
{
Panel panel = new Panel("<center>Summary</center>");
panel.setSizeFull();
panel.setContent(new Label(longText));
setContent(panel);
}
}
Upvotes: 2