⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tableinformationframe.java

📁 Athena酒店小组_Athena酒店管理系统
💻 JAVA
字号:
/*
 * NewJFrame.java
 *
 * Created on 2007年6月17日, 下午3:02
 */

package frames;

import java.util.*;
import javax.swing.*;
import java.lang.*;

import plugin.*;
import module.*;
import helper.*;
import dennis.*;

/**
 *
 * @author  Dennis;
 */
public class TableInformationFrame extends javax.swing.JInternalFrame {
    
    /** Creates new form NewJFrame */
    public TableInformationFrame() {
        initComponents();
        this.setTitle("Table Information");
        
    }
    

    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        baseInfoPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        accoutText = new javax.swing.JTextField();
        tableInfoPanel = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableInfoTable = new javax.swing.JTable();
        query = new javax.swing.JButton();
        repast = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);
        baseInfoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("\u57fa\u672c\u4fe1\u606f"));
        baseInfoPanel.setFont(new java.awt.Font("新宋体", 0, 12));
        jLabel1.setText("\u5e10\u53f7\uff1a");

        accoutText.setName("accoutText");

        org.jdesktop.layout.GroupLayout baseInfoPanelLayout = new org.jdesktop.layout.GroupLayout(baseInfoPanel);
        baseInfoPanel.setLayout(baseInfoPanelLayout);
        baseInfoPanelLayout.setHorizontalGroup(
            baseInfoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(baseInfoPanelLayout.createSequentialGroup()
                .add(19, 19, 19)
                .add(jLabel1)
                .add(21, 21, 21)
                .add(accoutText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 234, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(129, Short.MAX_VALUE))
        );
        baseInfoPanelLayout.setVerticalGroup(
            baseInfoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(baseInfoPanelLayout.createSequentialGroup()
                .add(18, 18, 18)
                .add(baseInfoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel1)
                    .add(accoutText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(30, Short.MAX_VALUE))
        );

        tableInfoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("\u9910\u684c\u4fe1\u606f"));
        jScrollPane1.setBackground(java.awt.Color.white);
        jScrollPane1.setAutoscrolls(true);
        jScrollPane1.setFont(new java.awt.Font("新宋体", 0, 12));
        jScrollPane1.setName("TableInfo");
        tableInfoTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "编号", "名称", "类型", "使用情况"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tableInfoTable);

        query.setLabel("\u67e5\u8be2");
        query.setName("query");
        query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                queryActionPerformed(evt);
            }
        });

        repast.setLabel("\u5c31\u9910");
        repast.setName("repast");
        repast.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repastActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout tableInfoPanelLayout = new org.jdesktop.layout.GroupLayout(tableInfoPanel);
        tableInfoPanel.setLayout(tableInfoPanelLayout);
        tableInfoPanelLayout.setHorizontalGroup(
            tableInfoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE)
            .add(tableInfoPanelLayout.createSequentialGroup()
                .add(54, 54, 54)
                .add(query)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 172, Short.MAX_VALUE)
                .add(repast)
                .add(99, 99, 99))
        );
        tableInfoPanelLayout.setVerticalGroup(
            tableInfoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tableInfoPanelLayout.createSequentialGroup()
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 315, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(tableInfoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(query)
                    .add(repast)))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, baseInfoPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, tableInfoPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(baseInfoPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(16, 16, 16)
                .add(tableInfoPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    //客人开桌就餐
    private void repastActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repastActionPerformed
// TODO 将在此处添加您的处理代码:
        int index=tableInfoTable.getSelectedRow();
        if(index==-1)
        {
            JOptionPane.showMessageDialog(this,"请选择一张餐桌");
        }
        else
        {
            String useinfo=(String)tableInfoTable.getValueAt(index,3);
            if(useinfo.trim().equals("未使用"))
            {
                String tableId=(String)tableInfoTable.getValueAt(index,0);
                String guestAccout=accoutText.getText();
                MenuListAccess menuList=new MenuListAccess(Resource.getDBResource());
                MenuList menu=new MenuList();
                menu.setGuestAccouts(guestAccout);
                menu.setIsCheckOut("否");
                menuList.insert(menu);
                ArrayList<MenuList> menus=menuList.getAllMenus();
                int menuId=menus.get(menus.size()-1).getMenuId();
                FoodListFrame foodList=new FoodListFrame(menuId,tableId,guestAccout);
                foodList.setVisible(true);
            }
            else
            {
                JOptionPane.showMessageDialog(this,"该餐桌已被使用!");
            }
        }
    }//GEN-LAST:event_repastActionPerformed
    //查询餐桌信息
    private void queryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryActionPerformed
// TODO 将在此处添加您的处理代码:
        TableAccess table=new TableAccess(Resource.getDBResource());
        ArrayList<TableInfo> tables=table.getAllTables();
        for(TableInfo ta : tables)
        {
            Object[] objs = new Object[]
            {
              ta.getTableId(),
              ta.getTableName(),
              ta.getTableType(),
              ta.getUseInfo()
            };
            TableHelper.addToTable(tableInfoTable,objs);
        }
        
    }//GEN-LAST:event_queryActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TableInformationFrame().setVisible(true);
            }
        });
    }
    
    // 变量声明 - 不进行修改//GEN-BEGIN:variables
    private javax.swing.JTextField accoutText;
    private javax.swing.JPanel baseInfoPanel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton query;
    private javax.swing.JButton repast;
    private javax.swing.JPanel tableInfoPanel;
    private javax.swing.JTable tableInfoTable;
    // 变量声明结束//GEN-END:variables
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -