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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| package other_dialog;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Font;
import java.awt.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.JTextArea;
import java.awt.Rectangle;
import javax.swing.JScrollPane;
import java.util.ArrayList;
import simple_class.auto_size_cells_table;
import simple_class.datas;
import table.table_cable;
import table.table_model;
import javax.swing.JComboBox;
public class creer_salle_phase1_mod extends JDialog {
private static final long serialVersionUID = 145663433L;
private JPanel jContentPane = null;
private JScrollPane jScrollPane = null;
private table_cable table = null;
private String nom_fichier_local;
private int x_local,y_local;
/**
* @param owner
*/
public creer_salle_phase1_mod(JFrame owner,String nom_fichier,int x,int y) {
super(owner);
nom_fichier_local = nom_fichier;
x_local = x;
y_local = y;
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(1024, 768);
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJScrollPane(), null);
}
return jContentPane;
}
private table_cable getTC(){
if (table == null) {
table = new table_cable();
String[] headers = new String[x_local];
int i = 0;
while(i < x_local){
headers[i] = "D" + i;
i++;
}
table.tm = new table_model(headers);
table.set_Table();
table.set_table_Salle(x_local);
ArrayList[] donnes = new ArrayList[x_local];
JComboBox cb = new JComboBox();
cb.addItem("1");
cb.addItem("-1");
for(i=0;i<x_local;i++){
donnes[i] = new ArrayList();
for(int j=0;j<y_local;j++)
donnes[i].add(cb);
}
table.tm.data = donnes;
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 16));
table.centrerTable(table);
//auto_size_cells_table.autoSizeCells(table, true, false);
table.set_Model_Salle();
}
return table;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setBounds(new Rectangle(0, 0, 1000, 660));
jScrollPane.setViewportView(getTC());
jScrollPane.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 2));
}
return jScrollPane;
}
} |