0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Buzz Lightyear
  • 190
  • 2
  • 19
  • sorry out of ideas from your question, a.m. description, DYM each from JComboBoxes has different model, data, items and structure e.i. ???? – mKorbel Jan 07 '13 at 13:50
  • There's an example using JPA [here](http://stackoverflow.com/a/2531942/230513). – trashgod Jan 07 '13 at 17:36

1 Answers1

1

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.

Skepi
  • 478
  • 3
  • 12