我试图将一行记录添加到我已经存在的 MS 数据库中。基本上,这些记录将被输入到 GUI 中,然后在用户单击提交时添加到数据库中。
我使用 3 个 JLabel、3 个 JTextfield 和 1 个 JButton 创建了 GUI。用户需要输入名称、数量和价格,然后单击提交按钮。
JLabel newproductname = new JLabel("Enter Product Name");
JTextField npn = new JTextField(7);
JLabel newproductprice = new JLabel("Enter Product Price");
JTextField npp = new JTextField(7);
JLabel newproductstock = new JLabel("Enter Product Stock");
JTextField nps = new JTextField(7);
JButton addnewitem = new JButton("Add New Item");
这是我用来创建 GUI 的,显然我已将所有这些添加到下面的面板中
我是 Java 新手,所以我很欣赏任何人都能理解的术语,谢谢!