Hello
I’m building my first vaadin application. I love it so far, but I have one problem.
Panel is not full screen. How do I change it to full screen view?
package com.example.mywebpage;
import com.vaadin.Application;
import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.SplitPanel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Window;
public class MywebpageApplication extends Application {
/**
*
*/
/**
*
*/
@Override
public void init() {
Window mainWindow = new Window("Matej Pikovnik | Java developer");
mainWindow.addComponent(mainUI());
setMainWindow(mainWindow);
}
public Component mainUI() {
HorizontalLayout hLayout = new HorizontalLayout();
hLayout.setSizeFull();
TabSheet tSheet = new TabSheet();
tSheet.setHeight(100, Sizeable.UNITS_PERCENTAGE);
tSheet.setWidth(100, Sizeable.UNITS_PERCENTAGE);
tSheet.addTab(AboutMe()).setCaption("About me");
tSheet.addTab(MyWork()).setCaption("My work");
tSheet.addTab(AboutMe()).setCaption("Contact me");
hLayout.addComponent(tSheet);
hLayout.setSpacing(true);
hLayout.setSizeFull();
return hLayout;
}
public Component AboutMe() {
Panel about = new Panel();
about.setWidth(100, Sizeable.UNITS_PERCENTAGE);
about.setHeight(100, Sizeable.UNITS_PERCENTAGE);
Label meLabel = new Label();
meLabel.setHeight(100, Sizeable.UNITS_PERCENTAGE);
meLabel.setWidth(100, Sizeable.UNITS_PERCENTAGE);
meLabel.setValue("Mtabgaefda");
about.addComponent(meLabel);
about.setSizeFull();
return about;
}
public Component MyWork()
{
Panel p = new Panel();
HorizontalSplitPanel hsPanle = new HorizontalSplitPanel();
p.setContent(hsPanle);
final Object[][]
planets = new Object[][]
{
new Object[]{"Android", "Working Days", "Coupon Calculator", "Fartoid"},
new Object[]{"Vaadin", "This page", "TKO Litija"},
new Object[]{"iOS", "Io", "Europa", "Ganymedes", "Callisto"}};
Tree tree = new Tree("My work");
/* Add planets as root items in the tree. */
for (int i=0; i<planets.length; i++) {
String planet = (String) (planets[i]
[0]
);
tree.addItem(planet);
if (planets[i]
.length == 1) {
// The planet has no moons so make it a leaf.
tree.setChildrenAllowed(planet, false);
} else {
// Add children (moons) under the planets.
for (int j=1; j<planets[i]
.length; j++) {
String moon = (String) planets[i]
[j]
;
// Add the item as a regular item.
tree.addItem(moon);
// Set it to be a child.
tree.setParent(moon, planet);
// Make the moons look like leaves.
tree.setChildrenAllowed(moon, false);
}
// Expand the subtree.
tree.expandItemsRecursively(planet);
}
}
hsPanle.setFirstComponent(tree);
hsPanle.setSecondComponent(new Label("Just test"));
return p;
}
}
You can see my page here: