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

📄 tableimages.java

📁 由于想一次上传成功 所以将二个教程打包成了一个 这些例子几乎包含了所有java的框架集合
💻 JAVA
字号:
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;

/*
<APPLET
    CODE = tableimages.class
    WIDTH = 600
    HEIGHT = 280 >
</APPLET>
*/

public class tableimages extends JApplet
{
    String[] columns = {"Sandwich", "Available", "Price", "Date", "Image"};

    Date date = (new GregorianCalendar(2000, 9, 2)).getTime();

    Object[][] data = {
        {"Ham", new Boolean(false), new Float(4.99), date, new ImageIcon("table.jpg")},

        {"BBQ", new Boolean(true), new Float(5.99), date, new ImageIcon("table.jpg")},

        {"Turkey", new Boolean(false), new Float(4.99), date, new ImageIcon("table.jpg")},

        {"Watercress", new Boolean(true), new Float(4.99), date, new ImageIcon("table.jpg")},

        {"Cheese", new Boolean(false), new Float(4.99), date, new ImageIcon("table.jpg")},

        {"Beef", new Boolean(true), new Float(4.99), date, new ImageIcon("table.jpg")}
    };
    
    JTable jtable = new JTable(new newModel(data, columns));

    public void init() 
    {
        getContentPane().add(new JScrollPane(jtable));
    }
}

class newModel extends DefaultTableModel 
{
    public newModel(Object[][] data, Object[] columns) 
    {
        super(data, columns);
    }

    public boolean isCellEditable(int row, int col) 
    {
        return false;
    }

    public Class getColumnClass(int column) 
    {
        Vector v = (Vector) dataVector.elementAt(0);

        return v.elementAt(column).getClass();
    }
}

⌨️ 快捷键说明

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