Quiero que la fecha actual del sistema aparezca en un label de un JFrame, el problema es que al momento de ejecutarlo, no aparece nada. ¿Cómo puedo solucionar esto? Aqui el código:
private void txtDateActionPerformed(java.awt.event.ActionEvent evt) {
Calendar calendar = new GregorianCalendar();
String day = Integer.toString(calendar.get(Calendar.DATE));
String month = Integer.toString(calendar.get(Calendar.MONTH));
String year = Integer.toString(calendar.get(Calendar.YEAR));
String date = day+"/"+month+"/"+year;
txtDate.setText(date);
txtDate = new javax.swing.JTextField();
txtTime = new javax.swing.JTextField();
Time:
txtTime.setEditable(false);
txtTime.setBackground(new java.awt.Color(31, 37, 51));
txtTime.setFont(new java.awt.Font("Dubai", 1, 14)); // NOI18N
txtTime.setForeground(new java.awt.Color(153, 153, 0));
txtTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTime.setBorder(null);
txtTime.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtTimeActionPerformed(evt);
Date:
txtDate.setEditable(false);
txtDate.setBackground(new java.awt.Color(31, 37, 51));
txtDate.setFont(new java.awt.Font("Dubai", 1, 14)); // NOI18N
txtDate.setForeground(new java.awt.Color(153, 153, 0));
txtDate.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtDate.setBorder(null);
txtDate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtDateActionPerformed(evt);