codice:
cellSizes = new double[][] { // array bidimensionale o meglio array di array(a diff del monodim qui vengono usati 2 indici:
// uno per la riga,l'altro per la colonna).
{ 10, 96, 10, TableLayout.FILL, 5, TableLayout.FILL, 10 }, //relativo alle colonne(7 colonne)
{ 10, 24, 10, 24, 5, 24, 5, 24, 5, 24, 10, 24, 16, 24, 5, 24, 5, 24, 16, 24, 5, 24, 10 }// relativo alle righe(23 righe)
}; // NOTA BENE: the TableLayout itself is created using this array. The length of size is 2. size[0] contains the
// widths of each column, and size[1] contains the height of each row.
intArray = new int[MAX_NUMBER_OF_ENTRIES];
counter = 0;
Container contentPane = this.getContentPane();
contentPane.setLayout(new TableLayout(cellSizes));
contentPane.add(txtInput, "1, 1");
contentPane.add(btnInsert, "3, 1, 5, 1");
contentPane.add(scrollPane, "1, 3, 1, 21");
contentPane.add(lblMin, "3, 3");
contentPane.add(lblMinValue, "5, 3");
contentPane.add(lblMax, "3, 5");
contentPane.add(lblMaxValue, "5, 5");
contentPane.add(lblSum, "3, 7");
contentPane.add(lblSumValue, "5, 7");
contentPane.add(lblAverage, "3, 9");
contentPane.add(lblAverageValue, "5, 9");
contentPane.add(btnSort, "3, 11, 5, 11");
contentPane.add(btnImport, "3, 13, 5, 13");
contentPane.add(btnExport, "3, 15, 5, 15");
contentPane.add(cbxAsNumbers, "3, 17");
contentPane.add(cbxAsString, "5, 17");
contentPane.add(btnReset, "3, 19, 5, 19");
contentPane.add(btnExit, "3, 21, 5, 21");
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
this.setTitle("Java Exercise");
this.setResizable(false);
this.pack();
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameDimension = this.getSize();
this.setLocation((screenDimension.width - frameDimension.width) / 2,
(screenDimension.height - frameDimension.height) / 2);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);