📄 customermanagerframe.java
字号:
.addComponent(serverButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
filterPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "\u8fc7\u6ee4", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("新宋体", 0, 12)));
deptLabel.setFont(new java.awt.Font("新宋体", 0, 12));
deptLabel.setText("\u5ba2\u6237\u7c7b\u578b\uff1a");
styleCombo.setFont(new java.awt.Font("新宋体", 0, 12));
styleCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "\u5168\u90e8", "\u666e\u901a\u5ba2\u6237", "\u4f1a\u5458\u5ba2\u6237", "VIP\u5ba2\u6237" }));
sexLabel.setFont(new java.awt.Font("新宋体", 0, 12));
sexLabel.setText("\u6027\u522b\uff1a");
sexCombo.setFont(new java.awt.Font("新宋体", 0, 12));
sexCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "\u5168\u90e8", "\u7537", "\u5973" }));
sourceLabel.setFont(new java.awt.Font("新宋体", 0, 12));
sourceLabel.setText("\u6765\u6e90\uff1a");
sourceCombo.setFont(new java.awt.Font("新宋体", 0, 12));
sourceCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "\u5168\u90e8", "A", "B", "C", "D" }));
queryButton.setFont(new java.awt.Font("新宋体", 0, 12));
queryButton.setMnemonic('Q');
queryButton.setText("\u67e5\u8be2(Q)");
queryButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
queryButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout filterPanelLayout = new javax.swing.GroupLayout(filterPanel);
filterPanel.setLayout(filterPanelLayout);
filterPanelLayout.setHorizontalGroup(
filterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(filterPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(deptLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(styleCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30)
.addComponent(sexLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sexCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(36, 36, 36)
.addComponent(sourceLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sourceCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(36, 36, 36)
.addComponent(queryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(36, Short.MAX_VALUE))
);
filterPanelLayout.setVerticalGroup(
filterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(filterPanelLayout.createSequentialGroup()
.addGroup(filterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(deptLabel)
.addComponent(styleCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sexLabel)
.addComponent(sexCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sourceLabel)
.addComponent(sourceCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(queryButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(filterPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(customerScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(changePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(basicPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(filterPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(basicPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(changePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18))
.addGroup(layout.createSequentialGroup()
.addComponent(customerScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
.addContainerGap())))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formComponentShown(java.awt.event.ComponentEvent evt)//GEN-FIRST:event_formComponentShown
{//GEN-HEADEREND:event_formComponentShown
userInit();
}//GEN-LAST:event_formComponentShown
private void customerTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_customerTableMouseClicked
if (evt.getClickCount() == 2)
{
detailButtonActionPerformed(null);
}
}//GEN-LAST:event_customerTableMouseClicked
private void searchRecordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchRecordButtonActionPerformed
//DeptManagerFrame frame = new DeptManagerFrame();
//frame.setVisible(true);
}//GEN-LAST:event_searchRecordButtonActionPerformed
private void serverButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serverButtonActionPerformed
CustomerAnniversaryFrame frame = new CustomerAnniversaryFrame();
Resource.getGUIResource().getDesktopPane().add(frame);
frame.setVisible(true);
}//GEN-LAST:event_serverButtonActionPerformed
private void suggestionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_suggestionButtonActionPerformed
CustomerSuggestionFrame frame = new CustomerSuggestionFrame();
Resource.getGUIResource().getDesktopPane().add(frame);
frame.setVisible(true);
}//GEN-LAST:event_suggestionButtonActionPerformed
private void recordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_recordButtonActionPerformed
CustomerRecordFrame frame = new CustomerRecordFrame();
Resource.getGUIResource().getDesktopPane().add(frame);
frame.setVisible(true);
}//GEN-LAST:event_recordButtonActionPerformed
private void searchSourceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchSourceButtonActionPerformed
CustomerSourceFrame frame = new CustomerSourceFrame();
Resource.getGUIResource().getDesktopPane().add(frame);
frame.setVisible(true);
}//GEN-LAST:event_searchSourceButtonActionPerformed
private void modifyButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_modifyButtonActionPerformed
{//GEN-HEADEREND:event_modifyButtonActionPerformed
/*String customerId = getSelectedcustomerId();
if (customerId != null)
{
UpdatecustomerFrame frame = new UpdatecustomerFrame();
frame.setUpdateMode(customerId);
frame.setVisible(true);
}*/
}//GEN-LAST:event_modifyButtonActionPerformed
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_deleteButtonActionPerformed
{//GEN-HEADEREND:event_deleteButtonActionPerformed
// TODO del customer
}//GEN-LAST:event_deleteButtonActionPerformed
private void detailButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_detailButtonActionPerformed
{//GEN-HEADEREND:event_detailButtonActionPerformed
String customerId = getSelectedcustomerId();
if (customerId != null)
{
CustomerAccess access=new CustomerAccess(Resource.getDBResource());
CustomerInfo customer = new CustomerInfo();
customer=access.getCustomerById(customerId);
CustomerInfoFrame frame = new CustomerInfoFrame(customer);
Resource.getGUIResource().getDesktopPane().add(frame);
frame.setVisible(true);
}
}//GEN-LAST:event_detailButtonActionPerformed
private void addButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_addButtonActionPerformed
{//GEN-HEADEREND:event_addButtonActionPerformed
CustomerRegisterFrame frame = new CustomerRegisterFrame();
Resource.getGUIResource().getDesktopPane().add(frame);
frame.setVisible(true);
}//GEN-LAST:event_addButtonActionPerformed
private void queryButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_queryButtonActionPerformed
{//GEN-HEADEREND:event_queryButtonActionPerformed
//清除表格数据
TableHelper.clearTable(customerTable);
//获取查询信息
ArrayList<String> names = new ArrayList<String>();
ArrayList<Object> values = new ArrayList<Object>();
if (!styleCombo.getSelectedItem().toString().equals("全部"))
{
String style = styleCombo.getSelectedItem().toString();
names.add("CustoemrType");
values.add(style);
}
if (!sexCombo.getSelectedItem().toString().equals("全部"))
{
String sex = sexCombo.getSelectedItem().toString();
names.add("Sex");
values.add(sex);
}
if (!sourceCombo.getSelectedItem().toString().equals("全部"))
{
String source = sourceCombo.getSelectedItem().toString();
names.add("SourceId");
values.add(source);
}
//查询客户信息并将其添加到Table中
CustomerAccess ea = new CustomerAccess(Resource.getDBResource());
ArrayList<CustomerInfo> eis = ea.getCustomersByCondition(names, values);
for(CustomerInfo ei : eis)
{
Object[] objs = new Object[]
{
ei.getCustomerId(),
ei.getName(),
ei.getSex(),
ei.getId(),
ei.getCustomerType(),
ei.getSourceId(),
ei.getBlacklist()
};
TableHelper.addToTable(customerTable, objs);
}
}//GEN-LAST:event_queryButtonActionPerformed
// 变量声明 - 不进行修改//GEN-BEGIN:variables
private javax.swing.JButton addButton;
private javax.swing.JPanel basicPanel;
private javax.swing.JPanel changePanel;
private javax.swing.JScrollPane customerScrollPane;
private javax.swing.JTable customerTable;
private javax.swing.JButton deleteButton;
private javax.swing.JLabel deptLabel;
private javax.swing.JButton detailButton;
private javax.swing.JPanel filterPanel;
private javax.swing.JButton modifyButton;
private javax.swing.JButton queryButton;
private javax.swing.JButton recordButton;
private javax.swing.JButton searchRecordButton;
private javax.swing.JButton searchSourceButton;
private javax.swing.JButton serverButton;
private javax.swing.JComboBox sexCombo;
private javax.swing.JLabel sexLabel;
private javax.swing.JComboBox sourceCombo;
private javax.swing.JLabel sourceLabel;
private javax.swing.JComboBox styleCombo;
private javax.swing.JButton suggestionButton;
// 变量声明结束//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -