Sorry for answer late. I want to design a window like looks in the picture. I have implemented this code but it doesn’t work, i am generating one Container (that it’s the principal), another Container which have one panel with a Label, and i want to put three buttons (i can generate one of them, but i organize this panel and looks bad), and i need a panel that have input text (can i do this with lemur?) and finaly one panel where i can visualize the text. This windows works like a chat window.
this is the implemented code for this window
[java]
Agregar.detachAllChildren();
testPanel = new Container("glass");
guiNode.attachChild(testPanel);
testPanel.setLocalTranslation( 400, 150, 0 );
testPanel.setBackground(new QuadBackgroundComponent(new ColorRGBA(0,0.5f,0.5f,0.5f),5,5, 0.02f, false));
CursorEventControl.addListenersToSpatial(testPanel, new DragHandler());
BorderLayout layout = new BorderLayout();
Container panel1 = new Container(layout);
testPanel.addChild(panel1);
//Panel titulo
SpringGridLayout leftLayout = new SpringGridLayout(Axis.Y, Axis.X, FillMode.Even, FillMode.Even);
Container left = new Container(leftLayout);
panel1.addChild(left,BorderLayout.Position.West);
left.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.14f,0.38f,0.57f,0.5f),5,5, 0.02f, false));
left.addChild(new Label("Dr. Henry Wu",new ElementId("titulo"),"glass"));
left.addChild(new Panel(2,2,ColorRGBA.Cyan,"glass")).setUserData(LayerComparator.LAYER,2);
//Panel Botones
SpringGridLayout rightLayout = new SpringGridLayout(Axis.Y, Axis.X, FillMode.Even, FillMode.Even);
Container right = new Container(rightLayout);
panel1.addChild(right,BorderLayout.Position.East);
SpringGridLayout rrLayout = new SpringGridLayout(Axis.Y, Axis.X, FillMode.Even, FillMode.Even);
Container rClose = new Container(rrLayout);
right.addChild(rClose,BorderLayout.Position.West);
SpringGridLayout rlLayout = new SpringGridLayout(Axis.Y,Axis.X,FillMode.Even,FillMode.Even);
Container rMin = new Container(rlLayout);
right.addChild(rMin,BorderLayout.Position.East);
right.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.14f,0.38f,0.57f,0.5f),5,5, 0.02f, false));
//Cargar Iconos
IconComponent icon = new IconComponent("Interface/X.png");
icon.setOverlay(false);
icon.setHAlignment(HAlignment.Center);
icon.setVAlignment(VAlignment.Center);
float moveRightWidth = (float)(settings.getWidth()) / 10f;
float moveRightHeight = moveRightWidth;
// calculate icon scale to fit within desired button size
Image iconImage = icon.getImageTexture().getImage();
float scaleX = moveRightWidth / iconImage.getWidth();
float scaleY = moveRightHeight / iconImage.getHeight();
logger.log(Level.INFO, "button size x: {0}, y: {1}",
new Object[]{moveRightWidth, moveRightHeight});
logger.log(Level.INFO, "icon size x: {0}, y: {1}",
new Object[]{iconImage.getWidth(), iconImage.getHeight()});
logger.log(Level.INFO, "icon scale x: {0}, y: {1}",
new Object[]{scaleX, scaleY});
IconComponent iconmin = new IconComponent("Interface/minimizar.png");
iconmin.setOverlay(true);
iconmin.setHAlignment(HAlignment.Left);
iconmin.setVAlignment(VAlignment.Center);
Image iconImagemin = iconmin.getImageTexture().getImage();
float scaleXmin = moveRightWidth / iconImagemin.getWidth();
float scaleYmi = moveRightHeight / iconImagemin.getHeight();
logger.log(Level.INFO, "button size x: {0}, y: {1}",
new Object[]{moveRightWidth, moveRightHeight});
logger.log(Level.INFO, "icon size x: {0}, y: {1}",
new Object[]{iconImagemin.getWidth(), iconImagemin.getHeight()});
logger.log(Level.INFO, "icon scale x: {0}, y: {1}",
new Object[]{scaleXmin, scaleYmi});
//Crear Botones
Button cerrar = right.addChild(new Button(""));
cerrar.setBackground(icon);
// Button minimizar = rMin.addChild(new Button(""));
// minimizar.setBackground(iconmin);
cerrar.addCommands(Button.ButtonAction.Down, new Command() {
public void execute(Object source) {
testPanel.detachAllChildren();
}
});
Container mensaje1 = new Container("glass");
testPanel.addChild(mensaje1);
mensaje1.setBackground(new QuadBackgroundComponent(new ColorRGBA(0, 0.5f, 0.5f, 0.8f), 15, 5, 0.02f, false));
mensaje1.addChild(new Label("Avatar1"+ "Hola,ingresas a menudo? "));
Container mensaje2 = new Container("glass");
testPanel.addChild(mensaje2);
mensaje1.setBackground(new QuadBackgroundComponent(new ColorRGBA(0, 0.5f, 0.5f, 0.8f), 15, 5, 0.02f, false));
mensaje1.addChild(new Label("Avatar2"+ "Hola,es la primera \n que ingreso "));
}
[/java]
Thanks.