0
Hello. I have a window in Jdialog, where I put several components, which is like this:
And I had to do something kind of like this:
as this screen is very large, I will post only part of her code:
JPanel pnHe = new JPanel(new BorderLayout());
JPanel pnHeC1 = new JPanel(new FlowLayout(FlowLayout.CENTER));
JPanel pnHeC1Aux = new JPanel(new GridLayout(8, 1));
JPanel pnHeC1L1 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeC1L2 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeC1L3 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeC1L4 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeC1L5 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeC1L6 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeC1L7 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeC1L8 = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSem = new JPanel(new FlowLayout(FlowLayout.CENTER));
JPanel pnHeSemAux = new JPanel(new GridLayout(8, 1));
JPanel pnHeSemSeg = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSemTer = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSemQua = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSemQui = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSemSex = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSemSab = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSemDom = new JPanel(new FlowLayout(FlowLayout.LEADING));
JPanel pnHeSemFer = new JPanel(new FlowLayout(FlowLayout.LEADING));
JCheckBox chHeSeg = new JCheckBox("Seg ");
JCheckBox chHeTer = new JCheckBox("Ter ");
JCheckBox chHeQua = new JCheckBox("Qua ");
JCheckBox chHeQui = new JCheckBox("Qui ");
JCheckBox chHeSex = new JCheckBox("Sex ");
JCheckBox chHeSab = new JCheckBox("Sab ");
JCheckBox chHeDom = new JCheckBox("Dom");
JCheckBox chHeFer = new JCheckBox("Fer ");
JCheckBox chHeSegAp = new JCheckBox("Apura Agrupado");
JCheckBox chHeTerAp = new JCheckBox("Apura Agrupado");
JCheckBox chHeQuaAp = new JCheckBox("Apura Agrupado");
JCheckBox chHeQuiAp = new JCheckBox("Apura Agrupado");
JCheckBox chHeSexAp = new JCheckBox("Apura Agrupado");
JCheckBox chHeSabAp = new JCheckBox("Apura Agrupado");
JCheckBox chHeDomAp = new JCheckBox("Apura Agrupado");
JCheckBox chHeFerAp = new JCheckBox("Apura Agrupado");
JTextField tfHeSeg = new JTextField(4);
JTextField tfHeTer = new JTextField(4);
JTextField tfHeQua = new JTextField(4);
JTextField tfHeQui = new JTextField(4);
JTextField tfHeSex = new JTextField(4);
JTextField tfHeSab = new JTextField(4);
JTextField tfHeDom = new JTextField(4);
JTextField tfHeFer = new JTextField(4);
JCheckBox chHeDiario = new JCheckBox("Apura excedente Diário");
JCheckBox chHeSemana = new JCheckBox("Apura excedente Semanal");
JCheckBox chHeDsr = new JCheckBox("Apura excedente DSR (Domingos/Feriados)");
JCheckBox chHeDiuNot = new JCheckBox("Apura Diurno/Noturno separadamente");
JCheckBox chHeDiaSem = new JCheckBox("Apura excedente Diário/Semanal");
JCheckBox chHeNotSep = new JCheckBox("Apura excedente das \"horas noturnas acrescidas\" separadamente");
JCheckBox chHeEncerr = new JCheckBox("Apura excedente jornada Noturna até o encerramento do cartão");
JCheckBox chHeDupTri = new JCheckBox("Horas extras duplas/triplas");
Building:
pnHeC1L1.add(chHeDiario);
pnHeC1L2.add(chHeSemana);
pnHeC1L3.add(chHeDiaSem);
pnHeC1L4.add(chHeDiuNot);
pnHeC1L5.add(chHeDsr);
pnHeC1L6.add(chHeNotSep);
pnHeC1L7.add(chHeEncerr);
pnHeC1L8.add(chHeDupTri);
pnHeC1L8.add(tfHeFaixa1);
pnHeC1L8.add(tfHeFaixa2);
tfHeFaixa1.setEnabled(false);
tfHeFaixa2.setEnabled(false);
pnHeSemSeg.add(chHeSeg);
chHeSeg.setSelected(true);
pnHeSemSeg.add(tfHeSeg);
pnHeSemSeg.add(chHeSegAp);
pnHeSemTer.add(chHeTer);
chHeTer.setSelected(true);
pnHeSemTer.add(tfHeTer);
pnHeSemTer.add(chHeTerAp);
pnHeSemQua.add(chHeQua);
chHeQua.setSelected(true);
pnHeSemQua.add(tfHeQua);
pnHeSemQua.add(chHeQuaAp);
pnHeSemQui.add(chHeQui);
chHeQui.setSelected(true);
pnHeSemQui.add(tfHeQui);
pnHeSemQui.add(chHeQuiAp);
pnHeSemSex.add(chHeSex);
chHeSex.setSelected(true);
pnHeSemSex.add(tfHeSex);
pnHeSemSex.add(chHeSexAp);
pnHeSemSab.add(chHeSab);
chHeSab.setSelected(true);
pnHeSemSab.add(tfHeSab);
pnHeSemSab.add(chHeSabAp);
pnHeSemDom.add(chHeDom);
chHeDom.setSelected(true);
pnHeSemDom.add(tfHeDom);
pnHeSemDom.add(chHeDomAp);
pnHeSemFer.add(chHeFer);
chHeFer.setSelected(true);
pnHeSemFer.add(tfHeFer);
pnHeSemFer.add(chHeFerAp);
pnHeSemAux.add(pnHeSemDom);
pnHeSemAux.add(pnHeSemSeg);
pnHeSemAux.add(pnHeSemTer);
pnHeSemAux.add(pnHeSemQua);
pnHeSemAux.add(pnHeSemQui);
pnHeSemAux.add(pnHeSemSex);
pnHeSemAux.add(pnHeSemSab);
pnHeSemAux.add(pnHeSemFer);
pnHeSem.add(pnHeSemAux);
pnHeSemAux.setBorder(BorderFactory.createLoweredBevelBorder());
pnHeC1Aux.add(pnHeC1L1);
pnHeC1Aux.add(pnHeC1L2);
pnHeC1Aux.add(pnHeC1L3);
pnHeC1Aux.add(pnHeC1L4);
pnHeC1Aux.add(pnHeC1L5);
pnHeC1Aux.add(pnHeC1L6);
pnHeC1Aux.add(pnHeC1L7);
pnHeC1Aux.add(pnHeC1L8);
pnHeC1.add(pnHeC1Aux);
pnHe.add(pnHeC1, BorderLayout.CENTER);
pnHe.add(pnHeSem, BorderLayout.EAST);
I would like to know how to put that key there, followed by the 3 options, I know it is something basic, but I could not think of another solution without using setBounds or using images. But there might be something that makes me "draw" in Jpanel, something that makes the styling equal to the edge where the days of the week are, but in key format.
Place Jlabel with an image of
}
in that simple place. :)– user28595
turns out it’s to cover 2 lines, with the same
}
so I posted the question, the 2 lines are represented by 2 Jpanels, for the sake of organization, plus I’m finding it a little complicated to put the other 3 options right in front of the key using the layouts I used– Thomas Braz Pinto
I had understood this, and I can do it with an image and with Jlabel, just position it in that space, with height equal to the two panels and add an image of same height.
– user28595
but one of the panels will not "cover up" the image? even though having nothing in front?
– Thomas Braz Pinto
Depends, add the code of your screen (if it is too big for question, can be on external site as Stebin), so it is possible to reproduce it for testing,
– user28595
http://pastebin.com/D7z6wQDC take a look, I know you have a lot of things done badly, and a lot of things "for nothing" but I think you can take a look, just take the action of the buttons that the rest works
– Thomas Braz Pinto
It does not appear to be complete. Nor is it in a class that extends Jframe.
– user28595
Let’s go continue this discussion in chat.
– Thomas Braz Pinto
Key size is dynamic or will always be fixed?
– Adriano Gomes