我收到錯誤無法找到符號,符號:方法 setDate(Date)。這是我的導入代碼:import java.io.File;import java.io.FileInputStream;import java.io.InputStream;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.SQLException;import java.util.Date;import java.util.Vector;import java.util.logging.Level;import java.util.logging.Logger;import java.sql.ResultSet;import java.sql.Statement;import java.text.SimpleDateFormat;import javax.swing.ImageIcon;import javax.swing.JOptionPane;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;import sun.applet.Main;import javax.swing.table.DefaultTableModel;這是有錯誤的代碼(第 6 行):private String idTransaksi() { try { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd"); String tanggal = sdf.format(date); txtDate.setDate(date); SimpleDateFormat sdf2 = new SimpleDateFormat ("dd.MM.yyyy hh:mm:ss"); String tanggal2 = sdf2.format(date); String qDate = "SELECT time, sellID FROM mssell"; rs = stm.executeQuery(qDate); idJual = "Trans." + tanggal2; String query = "INSERT INTO t_jual VALUES ('"+idJual+"','"+tanggal+"','ADMIN',0,0,'NOTHING')"; stm.executeUpdate(query); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage()); } return idJual; }我錯過了什么?任何幫助回答表示贊賞。
找不到符號,符號:Netbeans 中的方法 setDate(Date)
慕無忌1623718
2021-10-28 17:25:18