0

在我的项目中,一个 ComboBox 中的选择会影响下一个 ComboBox 中可用的选项......我对此很陌生,但如果我是对的,我将这里的每个字符串视为 actionListener 中的 if/else 语句. 有什么办法可以减少这种情况,还是现在是时候敲响我的指关节并开始打字了(如果您看到 2 个具有相同字符串的模型,那只是因为尚未添加所有单独的字符串)?

//Model Dropdown
final DefaultComboBoxModel termModel = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Hypercom", "DejaVoo", "Nurit", "Verifone"});

//Default Dropdown
final DefaultComboBoxModel slctAbove = new DefaultComboBoxModel(new String[]{"Select Option Above"});


//Terminal Dropdowns
final DefaultComboBoxModel hSpecModel = new DefaultComboBoxModel(new String[]{
        "Choose One...", "T7Plus", "4205", "4210", "4220", "4230"});
final DefaultComboBoxModel dSpecModel = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Dial", "IP", "Wireless"});
final DefaultComboBoxModel nSpecModel = new DefaultComboBoxModel(new String[]{
        "Choose One...", "2085", "3020", "8320 Dial", "8320 IP", "8400 Dial", "8400 IP"});
final DefaultComboBoxModel vSpecModel = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Global Dial", "Global IP", "TPS Dial", "TPS IP", "Ptech Dial", "Ptech IP"});

//Call Type Dropdown
final DefaultComboBoxModel callReason = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Download", "Troubleshoot"});

//Error Dropdowns
//Hypercom
final DefaultComboBoxModel hypError = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Invalid Merch ID", "Printer Error", "Retry Batch Trans", "AP Dupe", "Invalid Balance Settlement"});

//DejaVoo
final DefaultComboBoxModel dejaError = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Invalid Merch ID", "Invalid Batch #", "AP Dupe"});
final DefaultComboBoxModel dejaMError = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Invalid Merch ID", "Invalid Batch #", "Transport Layer Abort", "AP Dupe"});

//Nurit
final DefaultComboBoxModel nuritDError = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Invalid Merch ID", "Invalid DUKPT Key", "Invalid Balance Settlement", "AP Dupe", "Secure Capture", "Invalid Term ID", "Open Tab", "No Host Response"});
final DefaultComboBoxModel nuritIpError = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Invalid Merch ID", "Invalid DUKPT Key", "Invalid Balance Settlement", "AP Dupe", "Secure Capture", "Invalid Term ID", "Open Tab", "No Host Response"});
final DefaultComboBoxModel nuritWError = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Invalid Merch ID", "Invalid DUKPT Key", "Invalid Balance Settlement", "AP Dupe", "Secure Capture", "Invalid Term ID", "Open Tab", "No Host Response", "Rad Fail", "No Net"});

//Verifone
final DefaultComboBoxModel verifError = new DefaultComboBoxModel(new String[]{
        "Choose One...", "Invalid Merch ID", "Invalid DUKPT Key", "Invalid Balance Settlement", "AP Dupe", "Keyboard Locked", "Invalid Term ID", "Card Not Supported", "Comm Error"});
4

0 回答 0