我有一个这样的表:

表角色:

super("ROLES", // Name
            true,   // Can insert
            true,   // Can modify
            true,   // Can delete
            true,   // Supports events
            "system_table_data/roles.dat",   // don't Journal to disk
            1, // Read Access Level
            1, // Write Access Level (controlled via GUI)
            // Field Info
            new Object[][] {// Key    Name               Type         Read  Write  Insert  Modify
                           {PK_FIELD, "ROLE_ID",         "ROLE_ID",   YES,  YES,    NO,     NO},  // 0 BYTE
                           {NM_FIELD, "ROLE_NAME",       "STRING_80", YES,  YES,    YES,    YES}, // 1
                           {NM_FIELD, "SHIFT_PATTERN_ID","SHIFT_PAT", YES,  YES,    YES,    YES}, // 2 BYTE
                           {NM_FIELD, "START_DATE",      "CS_TIME",   YES,  YES,    YES,    YES}, // 3
                           }
           );




表移动方式:

super("PATTERNS", // Name
            true,   // Can insert
            true,   // Can modify
            true,   // Can delete
            true,   // Supports events
            "system_table_data/patterns.dat",   // don't Journal to diskmember_hna
            1, // Read Access Level
            1, // Write Access Level (controlled via GUI)
            // Field Info
            new Object[][] {// Key    Name               Type         Read  Write  Insert  Modify
                           {PK_FIELD, "NAME_ID",    "PATNAME_ID",     YES,  YES,    NO,     NO},  // 0
                           {NM_FIELD, "NAME",       "STRING_80",      YES,  YES,    NO,    YES},  // 1
                           }
           );


我正在使用JTables并弹出带有字段的对话框来填充表并将信息存储在诸如这两个表中。

全部都在选项卡式窗格中:“角色”选项卡和“转变”模式选项卡。

在“角色”窗格中,对话框中有一个组合框,应使用“班次模式”的名称填充该组合框,我想知道一种方法吗?

最佳答案

与其直接使用Object[],为什么不使用Pattern[]方法创建类似toString()的自定义类,然后使用JComboBox(Object[])创建Pattern[]
API Link
然后,它将使用toString()方法显示图案文本作为选择内容,您可以获得所选的Pattern并对其进行所需的操作。

10-07 20:02
查看更多