Я программирую на Java с Netbeans.
У меня есть таблица со списком пациентов.Я прочитал информацию в XML-файле.Здесь у вас есть код:
package digiscope;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
/**
*
* @author Daniel
*/
public class TabelaPaciente extends javax.swing.JPanel {
String numero_processo;
int localizador = 0;
/** Creates new form TabelaPaciente */
public TabelaPaciente() {
initComponents();
load_table();
}
public void setNumeroProc(String numero) {
numero_processo = numero;
}
public String getNumeroProc() {
return numero_processo;
}
public int getLocalizador() {
return localizador;
}
String[][] concat(String[][] A, String[][] B) {
String[][] C = new String[A.length + B.length][A.length + B.length];
System.arraycopy(A, 0, C, 0, A.length);
System.arraycopy(B, 0, C, A.length, B.length);
return C;
}
private void load_table() {
File dir;
String[] filenames;
//dir = new File(System.getProperty("user.dir")+ "/XML");
dir = new File(System.getProperty("user.dir") + "/Processos");
filenames = dir.list();
String[][] table_final = new String[][]{};
for (int i = 0; i < filenames.length; i++) {
String n_proc = filenames[i];//filenames[i].substring(0,filenames[i].length()-4);
//System.out.println(filenames[i]);
Ler_XML xml = new Ler_XML(n_proc);
String nome_utente = xml.getNome();
String[][] line = new String[][]{
{n_proc, nome_utente, null, "ir para formulario"}
};
table_final = concat(table_final, line);
}
tabela_pacientes.setModel(new javax.swing.table.DefaultTableModel(
table_final,
new String[]{
"Process Nº", "Name", "Date", "Form state"
}));
}
void executa_accao(int column, int row) {
if (column == 3) {
Object numero_proc = tabela_pacientes.getValueAt(row, 0);
localizador = 1;
numero_processo = numero_proc.toString();
JanelaPrincipal cont = (JanelaPrincipal) this.getParent() // Internal Pane
.getParent() // ???
.getParent() // ???
.getParent() // ???
.getParent(); // Frame
cont.loadPanel(new Formulario(1));
Preencher_FormPaciente new_xml = new Preencher_FormPaciente(numero_processo, 1);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tabela_pacientes = new javax.swing.JTable();
btnMenu1 = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(1000, 550));
tabela_pacientes.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent event) {
int row = tabela_pacientes.rowAtPoint(event.getPoint());
int column = tabela_pacientes.columnAtPoint(event.getPoint());
if (row >= 0 && column >= 0) {
executa_accao(column, row);
}
}
});
jScrollPane1.setViewportView(tabela_pacientes);
btnMenu1.setBackground(new java.awt.Color(255, 153, 0));
btnMenu1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
btnMenu1.setText("MENU");
btnMenu1.setPreferredSize(new java.awt.Dimension(105, 75));
btnMenu1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnMenu1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(btnMenu1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(885, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1000, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(btnMenu1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE))
);
}// </editor-fold>
private void btnMenu1ActionPerformed(java.awt.event.ActionEvent evt) {
JanelaPrincipal cont = (JanelaPrincipal) this.getParent() // Internal Pane
.getParent() // ???
.getParent() // ???
.getParent() // ???
.getParent(); // Frame
cont.loadPanel(new Menu());
}
// Variables declaration - do not modify
private javax.swing.JButton btnMenu1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tabela_pacientes;
// End of variables declaration
}
Я хотел бы знать, возможно ли увеличить размер буквы?Вы можете увидеть здесь предварительный просмотр таблицы.
Спасибо за сотрудничество.
С уважением.