I have a table set up like so:
Table Roles:
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
}
);
and
Table Shift Pattern:
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
}
);
I am using JTables and pop out dialog boxes with fields to populate the tables and storing the information in tables such as these two.
It is all in a tabbed pane: a tab for Roles and a tab for the Shift pattern.
In the Roles pane, the dialog box has a combobox that should be populated by the name of the Shift Patterns, I want to know of a way to do this?
Rather than having straight Object[]
why not have a custom class like Pattern[]
with a toString()
method and then just create a JComboBox(Object[])
with the Pattern[]
? ( API Link ) It would then use the toString()
method to display the pattern text as the selection and you can get the selected Pattern
and do whatever you need with it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.