У меня есть проект, созданный в NetBeans, и когда я скомпилировал его, он создал файлы классов, и это нормально.Но если у меня есть файл с именем operator.java после компиляции, я получил operator.class, operator $ 1.class, operator $ 2.class и т. Д. Есть ли какая-то конкретная причина для этого?Можете ли вы объяснить мне, почему это происходит?
package admin;
import forms_helper.global_variables;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import utilities.mysql_query;
import utilities.variables;
public class stock_adjust extends javax.swing.JFrame {`
List<String> list = new ArrayList<String>();
List<String> list_id = new ArrayList<String>();
List<String> list_quantity = new ArrayList<String>();
/** Creates new form stock_adjust */
public stock_adjust() {
initComponents();
}
/** 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() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
products = new javax.swing.JList();
jLayeredPane1 = new javax.swing.JLayeredPane();
jLabel2 = new javax.swing.JLabel();
product_name = new javax.swing.JTextField();
qty = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
cancel = new javax.swing.JButton();
save = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Stock Adjust");
setLocationByPlatform(true);
setResizable(false);
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel1.setText("Search:");
jTextField1.addCaretListener(new javax.swing.event.CaretListener() {
public void caretUpdate(javax.swing.event.CaretEvent evt) {
jTextField1CaretUpdate(evt);
}
});
products.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
productsMouseClicked(evt);
}
});
products.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
productsValueChanged(evt);
}
});
jScrollPane1.setViewportView(products);
jLayeredPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Adjust"));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel2.setText("Product Name:");
jLabel2.setBounds(10, 30, 80, 20);
jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
product_name.setBounds(100, 30, 240, -1);
jLayeredPane1.add(product_name, javax.swing.JLayeredPane.DEFAULT_LAYER);
qty.setBounds(100, 60, 110, -1);
jLayeredPane1.add(qty, javax.swing.JLayeredPane.DEFAULT_LAYER);
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel4.setText("Quantity:");
jLabel4.setBounds(10, 60, 80, 20);
jLayeredPane1.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);
cancel.setText("Cancel");
cancel.setBounds(220, 110, -1, 30);
jLayeredPane1.add(cancel, javax.swing.JLayeredPane.DEFAULT_LAYER);
save.setText("Save");
save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveActionPerformed(evt);
}
});
save.setBounds(50, 110, 73, 30);
jLayeredPane1.add(save, javax.swing.JLayeredPane.DEFAULT_LAYER);
jButton3.setText("Keyboard");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 356, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
.addComponent(jButton3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(19, 19, 19))
);
pack();
}// </editor-fold>
private void jTextField1CaretUpdate(javax.swing.event.CaretEvent evt) {
try {
String sql = "SELECT * FROM pos_products WHERE "
+ "company_id='" + global_variables.company_id + "' AND "
+ "shop_type='" + global_variables.shop_type + "' AND "
+ "product_name LIKE '%" + jTextField1.getText() + "%' OR "
+ "barcode LIKE '%" + jTextField1.getText() + "%'";
list.removeAll(list);
list_id.removeAll(list_id);
list_quantity.removeAll(list_quantity);
ResultSet rs = mysql_query.execute_mysql(variables.con.conn, sql);
products.removeAll();
while (rs.next()) {
list.add(rs.getString("product_name"));
list_id.add(rs.getString("p_id"));
list_quantity.add(rs.getString("available_stock"));
}
products.setListData(list.toArray(new String[list.size()]));
} catch (SQLException ex) {
Logger.getLogger(stock_adjust.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void productsValueChanged(javax.swing.event.ListSelectionEvent evt) {
}
private void productsMouseClicked(java.awt.event.MouseEvent evt) {
product_name.setText(list.get(products.getSelectedIndex()));
qty.setText(list_quantity.get(products.getSelectedIndex()));
}
private void saveActionPerformed(java.awt.event.ActionEvent evt) {
String sql = "UPDATE pos_products SET "
+ "available_stock='" + qty.getText() + "' WHERE "
+ "company_id='" + global_variables.company_id + "' AND "
+ "p_id='" + list_id.get(products.getSelectedIndex()) + "'";
mysql_query.update_mysql(variables.con.conn, sql);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new stock_adjust().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton cancel;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel4;
private javax.swing.JLayeredPane jLayeredPane1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField product_name;
private javax.swing.JList products;
private javax.swing.JTextField qty;
private javax.swing.JButton save; }`
В приведенном выше коде я получил 6 классов, как это.Таким образом, вы выбираете строки, ответственные за создание этого, пожалуйста, я не использую никаких внутренних классов в этом коде.Я не уверен в концепции Enum, поэтому, если вы могли бы помочь мне, я мог бы начать учиться там ...