1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| public class IhmCalibration extends JDialog {
private static JLabel unitLabel = null;
private static JLabel calibrationLabel = null;
private static JButton Submit = null;
private static JButton Cancel = null;
private static JDialog frame = null;
private static Vector <IhmLinesCalibration> Lines = new Vector <IhmLinesCalibration>();
/** Panel that contains all lanes panels */
private static JPanel lanesContainer;
private static int lanesNumber = 8;
static void createAndShowGUI() {
frame = new JDialog();
frame.setSize(650, 550);
frame.setResizable(false);
frame.setModal(true);
frame.setContentPane(getPanel());
frame.setVisible(true);
}
/*
* Create a panel
*/
public static JPanel getPanel(){
JPanel jContentPane = new JPanel();
jContentPane.setBackground(new Color(71, 145, 203)); //Background Color
unitLabel = new JLabel();
unitLabel.setBounds(new Rectangle(110, 15, 98, 19));
unitLabel.setText("Unité ");
calibrationLabel = new JLabel();
calibrationLabel.setBounds(new Rectangle(230, 15, 98, 19));
calibrationLabel.setText("Etalonnage ");
lanesContainer = new JPanel(new BorderLayout(8,1));
lanesContainer.setSize(frame.getWidth(), frame.getHeight());
/*
* Add element in Lines vector
*/
for (int i=0;i<10;i++)
{
Lines.addElement(new IhmLinesCalibration() );
}
lanesContainer.setLayout(null);
/*
* Add vector element in lanesContainer
*/
for(int i = 0; i < 9; i++){
lanesContainer.add(Lines.get(i));
}
lanesContainer.setVisible(true);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(lanesContainer,v,h);
jsp.setPreferredSize(new Dimension(200,25*lanesNumber));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setBackground(new Color(71, 145, 203));
jContentPane.add(unitLabel, null);
jContentPane.add(calibrationLabel, null);
jContentPane.add(getAnnuler(), null);
jContentPane.add(getValider(), null);
jContentPane.add(lanesContainer,null);
jContentPane.add(jsp);
return jContentPane;
} |
Partager