Java 用SimpleTable数据填充JCombobox
我有一张这样的桌子: 表角色:Java 用SimpleTable数据填充JCombobox,java,eclipse,swing,components,Java,Eclipse,Swing,Components,我有一张这样的桌子: 表角色: 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
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[])
使用模式[]
?
( )
然后,它将使用
toString()
方法显示模式文本作为选择,您可以获取所选的pattern
,并对其执行您需要的任何操作。对不起,您的问题中有很多想法,a.m.描述,DYM JComboBox中的每个都有不同的模型、数据,项目和结构e.i.?有一个使用JPA的示例。