单击 JButton 时 JTable 不会填充

2024-03-16

我正在开发的系统是一个收银系统JTable充当orderList。我试过了Vector我尝试过使用DefaultTableModel但我不确定如何让按钮提取数据并将其添加到表中。我知道这很难理解,但有人可以告诉我应该如何做吗?JButton然后剩下的应该是类似的,我可以自己做吗?

I need productID, productName and Price从数据库中提取并添加到表中。

然后我将计算总价并收取订单付款。

Order

//Order class for setting up and managing an order

package classes;

import java.sql.*;
import java.util.ArrayList;
import java.util.Vector;

public class Order 
{
    // Instance Variables
        private int productID;
        private String productName;
        private String productDescription;
        private String type;
        private String supplierName;
        private double quantity;
        private double price;
    
    // Connection To DB
    // JDBC Driver name and database URL
        final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
        final String DB_URL = "jdbc:mysql://localhost/team_project?useSSL=false";
        final String USER_NAME = "root";
        final String PASSWORD = "password";
        
        // sql variables
        ResultSet resultSet = null;
        private String itemName;
        private double itemPrice;
    
    // Constructors
    public Order()
    {
        
    }
    
    public Order(int productID, String itemName, double itemPrice, double quantity)
    {
        this.itemName = itemName;
        this.itemPrice = itemPrice;
        this.quantity = quantity;
    }
    
    
    // Get the details of stock items and add them to the order
    public Vector getOrderItems()
    {
         ResultSet rs = null;
        
        Statement statement = null;
        try{

            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
            Statement stmt = conn.createStatement();
            String sqlString= "select ProductID, ProductName, Price from product";
            stmt.executeUpdate(sqlString);  
            Vector vector = new Vector();
            Vector<String> orderItem = new Vector<String>();
            int i=0;
            while(rs.next())
            { 
                Vector<String> items = new Vector<String>();
                rs.getInt("ProductID");
                rs.getString("ProductName");
                rs.getDouble("Price");
            }
            return vector;
            }catch(Exception e)
            {
                e.printStackTrace();
            }
        return null;    
    }
        
            
         // Getter Methods
            public int getProductID()
            {
                return productID;
            }
            
            public String getProductName()                                  
            {
                return productName;
            }
            
            public String getProductDesc()
            {
                return productDescription;
            }
            
            public String getType()
            {
                return type;
            }
            
            public String getSupplierName()
            {
                return supplierName;
            }
            
            public double getQuantity()
            {
                return quantity;
            }
            
            public double getPrice()
            {
                return price;
            }
        }

Stock

// Stock class
//Team Project
//Stock class for setting up and managing stock

package classes;

import java.sql.*;
import java.util.*;

public class Stock 
{
    // Instance Variables
    private int productID;
    private String productName;
    private String productDescription;
    private String type;
    private String supplierName;
    private double quantity;
    private double price;



    
    // JDBC Driver name and database URL
    final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
    final String DB_URL = "jdbc:mysql://localhost/team_project?useSSL=false";
    final String USER_NAME = "root";
    final String PASSWORD = "password";

    
    // sql variables
    Statement statement = null;
    ResultSet resultSet = null;
    
    public Stock()
    {
        productID=0;
        productName=null;
        productDescription = null;
        type = null;
        supplierName=null;      
        quantity = 0;
        price=0;
    }
    
    // Initialisation Constructor that initializes everything in DB
    public Stock(int productID, String productName, String productDescription, String type, String supplierName,
                double quantity, double price)
    {
        this.productID = productID;
        this.productName = productName;
        this.productDescription = productDescription;
        this.type = type;
        this.supplierName = supplierName;
        this.quantity = quantity;
        this.price = price;
    }
    
    
    
    // Add a new product into the product table
    public void addProduct(int prodID, int amt) 
    {
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
            
            Statement stmt = conn.createStatement();
            String sqlString="insert into product " + "(ProductID, ProductName, ProductDescrp, type, SupplierName, Quantity, Price)"
            + " values(30, 'Marmalade', 'Homestead', 'Extras', 'Bakersworld', 20, 0.20)";
            stmt.executeUpdate(sqlString);
            conn.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    
    // Delete a product from the product table
    public void delete(int prodNumIn)
    {
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
            
            Statement stmt = conn.createStatement();
            String sqlString= "delete from team_Project.product where ProductID=" + prodNumIn;
            stmt.executeUpdate(sqlString);  
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
        
    // Subtracts quantity in stock in the DB When a sale is made on an item
    public int deductStock(int prodID) 
    {
        int status =0;
          String sql = ("UPDATE product " + "SET Quantity = " + (getDBQuantity(prodID)-1) + " WHERE ProductID = " + prodID);
          status = databaseUpdate(sql);
          return status;
    }
    
    // Add quantity to particular product in the DB if required
    public int addToQuantity(int prodID, int amt) 
    {
        int status =0;
        String sql = ("UPDATE product " + "SET Quantity = " + (getDBQuantity(prodID)+ amt) + " WHERE ProductID = " + prodID);
        status = databaseUpdate(sql);
        return status;
        
    }
        
    // return quantity of a product in DB
    public int getDBQuantity(int prodID)
    {
        int quantity=0;
        try
        {
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
        
        statement = (Statement) conn.createStatement();
        resultSet = statement.executeQuery("select Quantity from team_project.product WHERE ProductID = " + prodID);

        while (resultSet.next())
        {       
            quantity = (resultSet.getInt("Quantity"));
        }
        conn.close();
        }catch(Exception e)
        {
            e.printStackTrace();
        }
        return quantity;
        }
    
    
    // get price of a particular product 
    public int getItemPrice(int prodID)
    {
        int price = 0;      
        
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
            
            statement = (Statement) conn.createStatement();
            resultSet = statement.executeQuery("select Price from team_project.product WHERE ProductID = " + prodID);
           
        while (resultSet.next())
        {       
            price = (resultSet.getInt("Price"));
        }
        conn.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        System.out.println("€"+price);
        return price;
        }

    
    
    // Method that returns all products in product table
    public ArrayList<Stock> getProducts()
    {
        ArrayList<Stock> allStock = new ArrayList<Stock>();
        
    try
    {
    Class.forName("com.mysql.jdbc.Driver");
    Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
    
    statement = (Statement) conn.createStatement();
    resultSet = statement.executeQuery("select * from team_project.product");

    while (resultSet.next())
    {       
        Stock  stock = new Stock(resultSet.getInt("ProductID"), resultSet.getString("ProductName"), 
                resultSet.getString("ProductDescrp"),resultSet.getString("Type"),resultSet.getString("SupplierName"), 
                resultSet.getInt("Quantity"), resultSet.getDouble("Price"));
        allStock.add(stock);
    }
    conn.close();

    }catch(Exception e)
    {
        e.printStackTrace();
    }
    return allStock;
    }
    
    // update method to call
    // database update method 
         private int databaseUpdate(String sqlUpdate)
         {
              int status = 0;
           
              try{
                 Class.forName("com.mysql.jdbc.Driver");
                 Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
                 statement = conn.createStatement();
                 status = statement.executeUpdate(sqlUpdate);
                 conn.close(); 
              }       
               
              catch (Exception e) {
                 e.printStackTrace();
              }   
              return status;
           }
         
         // toString method for stock items
         public String toString()
         {
             return productName + "";
         }
        
    

    // Getter Methods
    public int getProductID()
    {
        return productID;
    }
    
    public String getProductName()                                  
    {
        return productName;
    }
    
    public String getProductDesc()
    {
        return productDescription;
    }
    
    public String getType()
    {
        return type;
    }
    
    public String getSupplierName()
    {
        return supplierName;
    }
    
    public double getQuantity()
    {
        return quantity;
    }
    
    public double getPrice()
    {
        return price;
    }
}
    

// 小型美式监听器

americanoSmall.addActionListener(
        new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                try {
                    String query = "select ProductName, Price from product where ProductID = 24";
                    java.sql.PreparedStatement pst = connection.prepareStatement(query);
                    ResultSet rs = pst.executeQuery();
                    table.setModel(DbUtils.resultSetToTableModel(rs));
                
                    } catch (Exception e1) 
                    {
                        e1.printStackTrace();
                    }
                }
            });    
   
    
   
    

你的代码有点倾斜,你有一个Stock对象,但该对象似乎也在管理数据库,作为一个更长期的解决方案,我建议将这些问题分开,但现在我们暂时保留它。

我要做的第一件事是定义模型的期望,你期望它做什么,你期望它如何工作

public interface MutableStockModel {
    public void add(Stock item) throws ModelException;
    public void remove(Stock item) throws ModelException;
}

所以这是一个简单的接口,它定义了任何实现类都应该提供的几个操作。但你为什么问?这是个好问题,我很快就会回答。

您可以延长MutableStockModel from a TableModel,但这将您锁定在一个特定的实施渠道中,这可能无法满足您的长期需求,此外,使用它的人关心什么,他们只是希望能够添加和删除产品

一个示例实现...

public class DefaultStockTableModel extends AbstractTableModel implements MutableStockModel {

    private List<Stock> items;

    public DefaultStockTableModel() {
        items = new ArrayList<>(25);
    }

    public DefaultStockTableModel(List<Stock> items) {
        this.items = items;
    }

    @Override
    public int getRowCount() {
        return items.size();
    }

    @Override
    public int getColumnCount() {
        return 7;
    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
        switch (columnIndex) {
            case 1:
            case 2:
            case 3:
            case 4: return String.class;
            case 0:
            case 5:
            case 7: return int.class;
        }
        return Object.class;
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0: return "ID";
            case 1: return "Name";
            case 2: return "Description";
            case 3: return "Type";
            case 4: return "Supplier Name";
            case 5: return "Quanity";
            case 6: return "Price";
        }
        return null;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Stock item = items.get(rowIndex);
        switch (columnIndex) {
            case 0: return item.getProductID();
            case 1: return item.getProductName();
            case 2: return item.getProductDesc();
            case 3: return item.getType();
            case 4: return item.getSupplierName();
            case 5: return item.getQuantity();
            case 6: return item.getPrice();
        }
        return null;
    }

    @Override
    public void add(Stock item) throws ModelException {
        // Add the item to the database if required
        items.add(item);
        int row = items.indexOf(item);
        fireTableRowsInserted(row, row);
    }

    @Override
    public void remove(Stock item) throws ModelException {
        if (items.contains(item)) {
            // Delete theitem from the database if required
            int row = items.indexOf(item);
            items.remove(row);
            fireTableRowsDeleted(row, row);
        }
    }

}

所以这是基本的示例,您的代码都不关心它的实际管理方式,只关心它满足合同要求。

要添加或删除产品,只需调用特定方法即可。

现在,您可以扩展这个概念以使其更易于使用,例如......

public interface MutableStockTableModel extends MutableStockModel, TableModel {
    public void removeAt(int row) throws ModelException;
}

这是一个特定的、有针对性的实现,它允许您删除特定行的行。这延伸了TableModel,因为一个TableModel有一个“行”的概念,MutableStockModel没有。当然,您必须更新任何实现implement这个特定的interface ;)

好吧,但是“为什么”呢?

简短的回答是,根据数据库的不同,ResultSet实际上可以直接进行变异,也就是说,您可以直接通过ResultSet, see 从结果集中检索和修改值 https://docs.oracle.com/javase/tutorial/jdbc/basics/retrieving.html更多细节。

这意味着您可以创建一个实现TableModel它实现了MutableStockTableModel or MutableStockModel接口,但引用了原始接口ResultSet因为它的内部结构。

听起来很简单,但是当您意识到可以更改的任何实例时TableModel对于任何满足实现要求而不影响任何代码的实现,它开辟了多种可能性。

因此,例如,不要使用TableModel or DefaultTableModel在你的代码中,你可以使用

private MutableStockTableModel tableModel;

//...

tableModel = new ResultSetMutableStockTableModel(resultSet);
table.setModel(tableModel);

//...

tableModel.add(stockItem);

但你可以简单地改变tableModel对于不同的例子...

tableModel = new DefaultStockTableModel(listOfItems);

没有其他需要改变的!

所以,这是“编码到接口,而不是实现”的基本示例,我可以进一步解耦代码,但我不想让你不知所措;)

回到我的第一条评论,OO 提倡单一责任原则 http://www.oodesign.com/single-responsibility-principle.html,这意味着任何对象都应该有单一的职责(或工作)。

例如,这可能建议您应该将您的功能分开Stock class.

天哪,我会从惊讶开始interface...

public interface Stock {
    public int getProductID();
    public String getProductName();
    public String getProductDesc();
    public String getType();
    public String getSupplierName();
    public double getQuantity();
    public double getPrice();
}

然后你会有某种实施......

public class DefaultStock implements Stock {
    // Instance Variables

    private int productID;
    private String productName;
    private String productDescription;
    private String type;
    private String supplierName;
    private double quantity;
    private double price;

    public DefaultStock() {
        productID = 0;
        productName = null;
        productDescription = null;
        type = null;
        supplierName = null;
        quantity = 0;
        price = 0;
    }

    // Initialisation Constructor that initializes everything in DB
    public DefaultStock(int productID, String productName, String productDescription, String type, String supplierName,
                             double quantity, double price) {
        this.productID = productID;
        this.productName = productName;
        this.productDescription = productDescription;
        this.type = type;
        this.supplierName = supplierName;
        this.quantity = quantity;
        this.price = price;
    }

    // toString method for stock items
    @Override
    public String toString() {
        return productName + "";
    }

    // Getter Methods
    @Override
    public int getProductID() {
        return productID;
    }

    @Override
    public String getProductName() {
        return productName;
    }

    @Override
    public String getProductDesc() {
        return productDescription;
    }

    @Override
    public String getType() {
        return type;
    }

    @Override
    public String getSupplierName() {
        return supplierName;
    }

    @Override
    public double getQuantity() {
        return quantity;
    }

    @Override
    public double getPrice() {
        return price;
    }
}

然后你可能会有某种经理/控制器/工厂......

(是的,我很想通过某种界面来描述这一点,但这已经是一篇很长的文章了)

public class StockManager {

    // JDBC Driver name and database URL
    final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
    final String DB_URL = "jdbc:mysql://localhost/team_project?useSSL=false";
    final String USER_NAME = "root";
    final String PASSWORD = "password";

    // sql variables
    Statement statement = null;
    ResultSet resultSet = null;

    // Add a new product into the product table
    public void addProduct(int prodID, int amt) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);

            Statement stmt = conn.createStatement();
            String sqlString = "insert into product " + "(ProductID, ProductName, ProductDescrp, type, SupplierName, Quantity, Price)"
                    + " values(30, 'Marmalade', 'Homestead', 'Extras', 'Bakersworld', 20, 0.20)";
            stmt.executeUpdate(sqlString);
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    // Delete a product from the product table
    public void delete(int prodNumIn) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);

            Statement stmt = conn.createStatement();
            String sqlString = "delete from team_Project.product where ProductID=" + prodNumIn;
            stmt.executeUpdate(sqlString);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    // Subtracts quantity in stock in the DB When a sale is made on an item
    public int deductStock(int prodID) {
        int status = 0;
        String sql = ("UPDATE product " + "SET Quantity = " + (getDBQuantity(prodID) - 1) + " WHERE ProductID = " + prodID);
        status = databaseUpdate(sql);
        return status;
    }

    // Add quantity to particular product in the DB if required
    public int addToQuantity(int prodID, int amt) {
        int status = 0;
        String sql = ("UPDATE product " + "SET Quantity = " + (getDBQuantity(prodID) + amt) + " WHERE ProductID = " + prodID);
        status = databaseUpdate(sql);
        return status;

    }

    // return quantity of a product in DB
    public int getDBQuantity(int prodID) {
        int quantity = 0;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);

            statement = (Statement) conn.createStatement();
            resultSet = statement.executeQuery("select Quantity from team_project.product WHERE ProductID = " + prodID);

            while (resultSet.next()) {
                quantity = (resultSet.getInt("Quantity"));
            }
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return quantity;
    }

    // get price of a particular product 
    public int getItemPrice(int prodID) {
        int price = 0;

        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);

            statement = (Statement) conn.createStatement();
            resultSet = statement.executeQuery("select Price from team_project.product WHERE ProductID = " + prodID);

            while (resultSet.next()) {
                price = (resultSet.getInt("Price"));
            }
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("€" + price);
        return price;
    }

    // Method that returns all products in product table
    public ArrayList<Stock> getProducts() {
        ArrayList<Stock> allStock = new ArrayList<Stock>();

        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);

            statement = (Statement) conn.createStatement();
            resultSet = statement.executeQuery("select * from team_project.product");

            while (resultSet.next()) {
                Stock stock = new DefaultStock(resultSet.getInt("ProductID"), resultSet.getString("ProductName"),
                                                                resultSet.getString("ProductDescrp"), resultSet.getString("Type"), resultSet.getString("SupplierName"),
                                                                resultSet.getInt("Quantity"), resultSet.getDouble("Price"));
                allStock.add(stock);
            }
            conn.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
        return allStock;
    }

    // update method to call
    // database update method 
    private int databaseUpdate(String sqlUpdate) {
        int status = 0;

        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = (Connection) DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
            statement = conn.createStatement();
            status = statement.executeUpdate(sqlUpdate);
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return status;
    }

}

我也鼓励你看看使用准备好的语句 http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html整体改进代码

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

单击 JButton 时 JTable 不会填充 的相关文章

随机推荐

  • chai 未在 Karma-mocha 中定义

    我正在使用 mocha phantomjs 配置成功运行我的测试用例 现在我正在使用 Karma 启动器运行这些测试 但我明白了这个问题Chai is not defined 这是我的配置文件 module exports function
  • Vimomnicomplete 和系统 Python 的问题

    我已经设置了 Vim python version说没关系 我的 vimrc包含 filetype plugin on set ofu syntaxcomplete Complete autocmd FileType python setl
  • Python 中时间序列的时间分解

    我正在尝试找到一个能够对时间序列进行时间分解的包 R 中有一个名为 tempdisagg 的包 https journal r project org archive 2013 RJ 2013 028 RJ 2013 028 pdf htt
  • .NET Web API HttpResponseMessage 模式?

    所以我看到了 Web API 2 控制器的返回HttpResponse和实际的物体 例子 public HttpResponseMessage Get string id var app apps Single c gt c Id id r
  • 将 RGB 转换为 sRGB?

    我正在尝试将 RGB 转换为感知均匀的色彩空间 CIELAB 维基百科指出 首先必须将 RGB 或 CMYK 值转换为特定的 绝对色彩空间 例如 sRGB 或 Adob e RGB 此次调整将 与设备相关 但转换产生的数据将是 独立于设备
  • PowerShell 将 Char 数组转换为字符串

    我已经阅读了在 PowerShell 中将字符数组转换为字符串的各种方法 但它们似乎都不适用于我的字符串 我的字符串的来源是 ComputerName 6WMPSN1 WarrantyURL http www dell com suppor
  • Liquibase 包含上下文

    我需要将文件包含在databaseChangeLog 中 但这些文件可能不存在 具体取决于安装 我的想法是使用类似包含上下文的内容 因此 Liquibase 仅在给出适当的上下文时尝试打开文件
  • 在 Android Studio 中调试时可以退回到上一个断点吗? (丢掉框架)

    我希望能够执行我刚刚跨过的上一个断点 我知道 Android Studio 是基于 Intellij Idea 的链接在这里 https stackoverflow com questions 22867491 how to step on
  • 如何为 iFrame 按钮单击父页面和 iFrame 位于不同域的位置调用窗口 onunload 事件

    我有一个可以打开 iFrame 的按钮 位于 xyz 域中 iFrame 加载驻留在另一个域中的页面 说 lmn templateSelectionFrame get 0 contentWindow location href url ur
  • 如何在Windows上构建GDB

    如何在 Windows 上从源代码构建 GDB GNU 调试器 我需要构建它才能使用 Python 支持进行构建 我无法使用随 Cygwin 一起发布的版本 因为它在 Windows 上解释反斜杠时出现问题 构建需要哪些工具链 GnuWin
  • 如何在storm中注册kryo序列化器实例?

    我拼命尝试配置序列化器实例以在我的风暴拓扑中使用 Storm 文档指出 有两种注册序列化器的方法 1 The name of a class to register In this case Storm will use Kryo s Fi
  • ARKit – 有没有办法知道物体在与 ARCamera 相关的空间中的位置?

    我在 ARKit 的屏幕上有一个物体 我想知道它与相机方向之间的水平角度 或者至少该物体位于屏幕的左侧 中心或右侧 绝对 很好 首先 我们需要了解ARKit ARKit 对象不在actual空间并基于相机所看到的内容 相机并不完美 你会注意
  • Eclipse Juno:如何更改选项卡颜色?

    不幸的是 最新的 Eclipse 插件更新放弃了 Inigo 安装了 Juno 我花了很多时间才使它看起来像以前的版本 但我无法设法更改蓝色选项卡颜色 有什么想法这是哪个设置或CSS吗 更新 有一些设置可以更改颜色 但是这些设置不会产生任何
  • Ansible:如何以其他用户身份克隆存储库

    我正在尝试使用 Ansible 编写部署规则 其中一些步骤是 更新和升级服务器 创建一个名为 Harry 的用户 添加公钥和私钥到 Harry 从 bitbucket org 克隆 Git 存储库 我想将存储库克隆为harry用户在他的主目
  • 如何使用 Ansible 过滤树中每个文件的最新版本?

    我有一个包含各种文件的中型目录树 some place distfiles foo 1 2 jar some place distfiles subdir foo 1 3 jar some place distfiles bar 1 1 j
  • C++ 中布尔值的运算符 |=

    我偶然发现了 C 中的以下构造 bool result false for int i 0 i
  • 未捕获的类型错误:无法读取未定义的属性“hasAttribute”

    我正在使用一个来自 W3C 的脚本 https www w3 org TR 2017 NOTE wai aria practices 1 1 20171214 examples tabs tabs 1 tabs html创建可访问的选项卡面
  • 将图像注释添加到条形图中

    举例来说 假设我有一些数据 countries Norway Spain Germany Canada China valuesA 20 15 30 5 26 valuesB 1 5 3 6 2 我确实想把它们画成这样 如何将这些标志图片放
  • 将模型传递给 RedirectToAction()

    我很好奇这是如何运作的 在 MVC 中 您可以调用 View 并将模型作为参数传递 但 RedirectToAction 至少是其化身之一 采用 routeValues 对象 该对象似乎是最接近的匹配 如果您的模型传入此参数 该模型类型是否
  • 单击 JButton 时 JTable 不会填充

    我正在开发的系统是一个收银系统JTable充当orderList 我试过了Vector我尝试过使用DefaultTableModel但我不确定如何让按钮提取数据并将其添加到表中 我知道这很难理解 但有人可以告诉我应该如何做吗 JButton