Horizontal Layout Expand Panels

Hi,
In a horizontalLayout are two panels:

I would like the left pane occupies only the space needed. As you can see the left panel are wider than necessary.

I tried setExpandRatio (panelRight, 1.0f) but then the left panel disappears.

Could you give me some idea of what is happening?

Thanks.

I attached the code and picture.

		//**********BOTTOM**************
		bottomlayout= new HorizontalLayout();
		bottomlayout.setWidth("100%");
		bottomlayout.setHeight("100%");
		bottomlayout.setSpacing(true);
		
		//**********BOTTOM-LEFT*************
		VerticalLayout leftbottomlayout=new VerticalLayout();
		leftbottomlayout.setHeight("100%");
		leftbottomlayout.setSpacing(true);
		
		//**********BOTTOM-RIGHT*************
		VerticalLayout rightbottomlayout=new VerticalLayout();
		rightbottomlayout.setHeight("100%");
		rightbottomlayout.setSpacing(true);

		//PANEL BOTTOM-RIGHT
		Panel rightPanel=new Panel("Panel Right");;
		rightPanel.setStyleName("bubble");
		rightPanel.getContent().setSizeUndefined();
		VerticalLayout rightpanellayout=(VerticalLayout) rightPanel.getContent();
		rightPanel.setHeight("100%");
		rightpanellayout.setMargin(false);
		rightpanellayout.setSizeFull();
	
		//PANEL BOTTOM-LEFT
		Panel leftPanel=new Panel("Left Details");;
		leftPanel.setStyleName("bubble");
		leftPanel.getContent().setSizeUndefined();
		VerticalLayout leftPanellayout=(VerticalLayout) leftPanel.getContent();
		leftPanellayout.setMargin(false);
		leftPanellayout.setSizeFull();

		//************Adding on bottom
		leftPanel.addComponent(tableleft);
		tablePanel.addComponent(tableright);
		
		leftbottomlayout.addComponent(messagesPanel);
		rightbottomlayout.addComponent(tablePanel);
		
		bottomlayout.addComponent(leftbottomlayout);
		bottomlayout.addComponent(rightbottomlayout);

Thank You so much!!
11458.png