Fix de layout

This commit is contained in:
roche 2019-11-16 17:29:15 +01:00
parent cc5f59b5aa
commit 8bfab6a9dc
2 changed files with 16 additions and 22 deletions

View File

@ -51,31 +51,34 @@ public class Menu extends JFrame{
this.cargarGestiones(LocalDate.now().getYear(), LocalDate.now().getMonth());
this.cargarPestanias();
this.setLayout(new GridBagLayout());
this.panel = new VistaPanelLateral(constrain, this.meses);
this.panelCentral = new JPanel();
this.panelCentral.setLayout(new GridBagLayout());
this.panel = new VistaPanelLateral(this.meses);
constrain.fill = GridBagConstraints.HORIZONTAL;
constrain.gridx = 0;
constrain.gridwidth = 2;
constrain.gridy = 0;
constrain.weightx = 10;
this.add(this.barra);
constrain.fill = GridBagConstraints.VERTICAL;
constrain.gridx = 1;
constrain.weightx = 0;
this.panelCentral.add(this.barra,constrain);
constrain.fill = GridBagConstraints.HORIZONTAL;
constrain.gridwidth = 1;
constrain.gridx = 0;
constrain.gridy = 1;
constrain.weightx = 2;
constrain.weightx = 0.25;
this.panelCentral.add(pestania,constrain);
getContentPane().add(pestania);
setTitle("Titulo");
setSize(new Dimension(420,320));
setDefaultCloseOperation(3);
setLocationRelativeTo(null);
ControladorPanelLateral controlador3 = new ControladorPanelLateral(this.panel, this);
this.listenerPestania();
constrain.fill = GridBagConstraints.VERTICAL;
constrain.gridx = 2;
constrain.fill = GridBagConstraints.HORIZONTAL;
constrain.gridx = 1;
constrain.gridy = 1;
constrain.weightx = 2;
this.add(this.panel);
constrain.weightx = 0.25;
this.panelCentral.add(this.panel,constrain);
this.add(this.panelCentral);
}
private void close(){

View File

@ -22,7 +22,7 @@ public class VistaPanelLateral extends JPanel{
JButton aniadirGestion;
JButton eliminarTransaccion;
Meses meses;
VistaPanelLateral(GridBagConstraints constrain, Meses meses){
VistaPanelLateral(Meses meses){
this.setPreferredSize(new Dimension(200,200));
this.meses=meses;
this.total = new JTextArea(String.valueOf(meses.getTotal()));
@ -30,17 +30,8 @@ public class VistaPanelLateral extends JPanel{
this.mostrarEstadisticas = new JButton("Mostrar grafico del mes");
this.aniadirGestion = new JButton("Aniadir nueva gestión");
this.add(this.mostrarEstadisticas);
constrain.gridx = 1;
constrain.gridy = 0;
constrain.weightx = 2;
this.add(VistaPanelLateral.elegirMes);
constrain.gridx = 1;
constrain.gridy = 1;
constrain.weightx = 2;
this.add(this.total);
constrain.gridx = 1;
constrain.gridy = 2;
constrain.weightx = 2;
this.add(this.gastoEnvio);
this.add(this.aniadirGestion);
this.eliminarTransaccion = new JButton("Eliminar Deseleccionados");