addWidget(cmnPane, new PatchNameWidget(" Name  ", patch, ((Driver) patch.getDriver()).getPatchNameSize()), 0, gy, 2, 1, 0);
addWidget(cmnPane, new PatchNameWidget(" Name  ", patch), 0, gy, 2, 1, 0);
    public RolandMT32SingleEditor(Patch patch) {	super ("Roland MT-32 Single Editor", patch);//      Common Pane        gbc.weightx=5;        int gy = 0;  // row count        int k = 0;  // timbre number offset. Not implemented yet.        int lwc = getLabelWidth("Part 1&2 Struct  ");  // Longest label length        JPanel cmnPane=new JPanel();        cmnPane.setLayout(new GridBagLayout());	         gbc.weightx=0;   							                 addWidget(cmnPane, new PatchNameWidget(" Name  ", patch, ((Driver) patch.getDriver()).getPatchNameSize()), 0, gy, 2, 1, 0);        gy++;        addWidget(cmnPane, new ScrollBarWidget("Part 1&2 Struct", patch,0,12,1,lwc,             new MT32Model(patch,0x0A), new MT32Sender(k+0x0A)),0,gy,5,1,1);        gy++;        addWidget(cmnPane, new ScrollBarWidget("Part 3&4 Struct", patch,0,12,1,lwc,             new MT32Model(patch,0x0B), new MT32Sender(k+0x0B)),0,gy,5,1,2);        gy++;        addWidget(cmnPane, new ScrollBarWidget("Partial Mute", patch,0,15,0,lwc,             new MT32Model(patch,0x0C), new MT32Sender(k+0x0C)),0,gy,5,1,3);        gy++;        addWidget(cmnPane, new CheckBoxWidget ("Env Mode", patch,             new MT32Model(patch,0x0D), new MT32Sender(k+0x0D)),0,gy,5,1,4);           gbc.gridx=0; gbc.gridy=0; gbc.gridwidth=5; gbc.gridheight=3;        gbc.fill=GridBagConstraints.BOTH;        gbc.anchor=GridBagConstraints.EAST;        cmnPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),            "COMMON",TitledBorder.CENTER, TitledBorder.CENTER));          scrollPane.add(cmnPane,gbc);            gbc.weightx = 5;        JPanel partialPane = new JPanel();        partialPane.setLayout(new GridBagLayout());                JTabbedPane partTabPane = new JTabbedPane();           for (int i=0; i<4; i++)        {            int j = i * 0x3A + 0x0E;  // Point to partial parameters             gy = 0;             // Partial panel            JPanel partNPane = new JPanel();                  int lww = getLabelWidth("WG PW VELO SENS  "); // Longest label lenght            JTabbedPane partNTabPane = new JTabbedPane();                        // WG and P_ENV panel on partial panel            JPanel WGPane = new JPanel();            WGPane.setLayout(new GridBagLayout());            addWidget(WGPane, new ComboBoxWidget("WG PITCH COARSE", patch,                 new MT32Model(patch,j+0x00), new MT32Sender(j+k+0x00), noteName), 0, gy, 1, 1, 11);            gy++;            addWidget(WGPane, new ScrollBarWidget("WG PITCH FINE", patch, 0, 100, -50, lww,                 new MT32Model(patch,j+0x01), new MT32Sender(j+k+0x01)),0,gy,3,1,12);            gy++;            addWidget(WGPane,new ComboBoxWidget("WG PITCH FOLLOW", patch,                 new MT32Model(patch,j+0x02), new MT32Sender(j+k+0x02), pKeyFollow), 0, gy, 1, 1, 13);            gy++;            addWidget(WGPane,new CheckBoxWidget("WG PITCH BENDER SW", patch,                 new MT32Model(patch,j+0x03), new MT32Sender(j+k+0x03)),1,gy,1,1,14);               gy++;            addWidget(WGPane,new ComboBoxWidget("WG WAVEFORM", patch,                 new MT32Model(patch,j+0x04), new MT32Sender(j+k+0x04),waveName), 0, gy, 1, 1, 15);            gy++;            addWidget(WGPane,new ComboBoxWidget("WG PCM WAVE #", patch,                 new MT32Model(patch,j+0x05), new MT32Sender(j+k+0x05),WGPCMWAVE), 0, gy, 1, 1, 15);//            addWidget(WGPane,new ScrollBarWidget("WG PCM WAVE #", patch, 0, 127, 1, lww, //                new MT32Model(patch,j+0x05), new MT32Sender(j+k+0x05)), 0, gy, 3, 1, 16);            gy++;            addWidget(WGPane,new ScrollBarWidget("WG PULSE WIDTH", patch, 0, 100, 0, lww,                new MT32Model(patch,j+0x06), new MT32Sender(j+k+0x06)), 0, gy, 3, 1, 17);            gy++;            addWidget(WGPane,new ScrollBarWidget("WG PW VELO SENS", patch, 0, 14, -7, lww,                new MT32Model(patch,j+0x07), new MT32Sender(j+k+0x07)), 0, gy, 3, 1, 18);            gy++;            addWidget(WGPane,new ScrollBarWidget("P-ENV DEPTH", patch, 0, 10, 0, lww,                new MT32Model(patch,j+0x08), new MT32Sender(j+k+0x08)), 0, gy, 3, 1, 19);            gy++;            addWidget(WGPane,new ScrollBarWidget("P-ENV VELO SENS", patch, 0, 100, 0, lww,                new MT32Model(patch,j+0x09), new MT32Sender(j+k+0x09)), 0, gy, 3, 1, 20);            gy++;            addWidget(WGPane,new ScrollBarWidget("P-ENV TIME KEYF", patch, 0, 4, 0, lww,                new MT32Model(patch,j+0x0A), new MT32Sender(j+k+0x0A)), 0, gy, 3, 1, 21);            gy++;            EnvelopeWidget.Node[] pNodes = new EnvelopeWidget.Node[] {                new EnvelopeWidget.Node(                    0, 0,     null, 0, 100, new MT32Model(patch,j+0x0F),                     0, false, null,         new MT32Sender(j+k+0x0F),                     null,           "LEVEL 0"),     	        new EnvelopeWidget.Node(                    0, 100,   new MT32Model(patch,j+0x0B), 0, 100, new MT32Model(patch,j+0x10),                     0, false, new MT32Sender(j+k+0x0B),            new MT32Sender(j+k+0x10),                     "TIME 1 Atk",                          "LEVEL 1 Atk"),     		        new EnvelopeWidget.Node(                    0, 100,    new MT32Model(patch,j+0x0C), 0, 100, new MT32Model(patch,j+0x11),                     25, false, new MT32Sender(j+k+0x0C),            new MT32Sender(j+k+0x11),                     "TIME 2 Dcy",                           "LEVEL 2 Dcy"),	        new EnvelopeWidget.Node(                    0,100,     new MT32Model(patch,j+0x0D), 0, 100, new MT32Model(patch,j+0x12),                     25, false, new MT32Sender(j+k+0x0D),            new MT32Sender(j+k+0x12),                     "TIME 3 Sus",                          "LEVEL S Sus"),                new EnvelopeWidget.Node(                    50, 50,  null,   EnvelopeWidget.Node.SAME, EnvelopeWidget.Node.SAME, null,                     0, false, null,                                                      null,                     null,            null),     	        new EnvelopeWidget.Node(                    0, 100,   new MT32Model(patch,j+0x0E), 0, 100, new MT32Model(patch,j+0x13),                     0, false, new MT32Sender(j+k+0x0E),            new MT32Sender(j+k+0x13),                     "TIME 4 Rel",                          "LEVEL E End"),            };            addWidget(WGPane,	        new EnvelopeWidget("P-ENV", patch, pNodes), 0, gy, 3, 5, 19);            gy=gy+9; // Ajust for number of parameters            addWidget(WGPane, new ScrollBarWidget("P_LFO RATE", patch, 0, 100, 0, lww,                new MT32Model(patch,j+0x14), new MT32Sender(j+k+0x14)), 0, gy, 3, 1, 38);            gy++;            addWidget(WGPane,new ScrollBarWidget("P_LFO DEPTH", patch, 0, 100, 0, lww,                new MT32Model(patch,j+0x15), new MT32Sender(j+k+0x15)), 0, gy, 3, 1, 38);            gy++;            addWidget(WGPane,new ScrollBarWidget("P_LFO MOD SENS", patch, 0, 100, 0, lww,                new MT32Model(patch,j+0x16), new MT32Sender(j+k+0x16)), 0, gy, 3, 1, 38);            gy++;                     WGPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),                "",TitledBorder.CENTER,TitledBorder.CENTER));            partNTabPane.add(WGPane, gbc);            partNTabPane.addTab("Wave Generator & Pitch Envelope", WGPane);                        // TVF panel on partial panel            JPanel TVFPane = new JPanel();            TVFPane.setLayout(new GridBagLayout());            int lwf = getLabelWidth("TVF ENV VELO SENS  ");  // Longest label string            gy = 0;            addWidget(TVFPane,new ScrollBarWidget("TVF CUTOFF FREQ",patch,0,100,0, lwf,                new MT32Model(patch,j+0x17),new MT32Sender(j+k+0x17)),0,gy,3,1,55);            gy++;            addWidget(TVFPane,new ScrollBarWidget("TVF RESONANCE",patch,0,30,0, lwf,                new MT32Model(patch,j+0x18),new MT32Sender(j+k+0x18)),0,gy,3,1,55);            gy++;            addWidget(TVFPane,new ComboBoxWidget("TVF KEYFOLLOW",patch,                new MT32Model(patch,j+0x19),new MT32Sender(j+k+0x19),tKeyFollow),0,gy,1,1,13);									                gy++;            addWidget(TVFPane,new ComboBoxWidget("TVF BIAS POINT/DIR",patch,                new MT32Model(patch,j+0x1A),new MT32Sender(j+k+0x1A),biasPoint),0,gy,3,1,55);									                gy++;            addWidget(TVFPane,new ScrollBarWidget("TVF BIAS LEVEL",patch,0,14,-7, lwf,                new MT32Model(patch,j+0x1B),new MT32Sender(j+k+0x1B)),0,gy,3,1,55);            gy++;            addWidget(TVFPane,new ScrollBarWidget("TVF ENV DEPTH",patch,0,100,0, lwf,                new MT32Model(patch,j+0x1C),new MT32Sender(j+k+0x1C)),0,gy,3,1,55);            gy++;            addWidget(TVFPane,new ScrollBarWidget("TVF ENV VELO SENS",patch,0,100,0, lwf,                new MT32Model(patch,j+0x1D),new MT32Sender(j+k+0x1D)),0,gy,3,1,55);            gy++;            addWidget(TVFPane,new ScrollBarWidget("TVF ENV DEPTH KEYF",patch,0,4,0, lwf,                new MT32Model(patch,j+0x1E),new MT32Sender(j+k+0x1E)),0,gy,3,1,55);            gy++;            addWidget(TVFPane,new ScrollBarWidget("TVF ENV TIME KEYF",patch,0,4,0, lwf,                new MT32Model(patch,j+0x1F),new MT32Sender(j+k+0x1F)),0,gy,3,1,55);            gy++;            EnvelopeWidget.Node[] fNodes = new EnvelopeWidget.Node[] {                new EnvelopeWidget.Node(0,  0,                      null, 0,  0, null, 0,false,                    null, null,                     null, null),     	        new EnvelopeWidget.Node(                    0, 100,    new MT32Model(patch,j+0x20), 0, 100, new MT32Model(patch,j+0x25),                    25, false, new MT32Sender(j+k+0x20),            new MT32Sender(j+k+0x25),                    "TIME 1",                               "LEVEL 1"),	        new EnvelopeWidget.Node(                    0, 100,    new MT32Model(patch,j+0x21), 0, 100, new MT32Model(patch,j+0x26),                    25, false, new MT32Sender(j+k+0x21),            new MT32Sender(j+k+0x26),                    "TIME 2",                               "LEVEL 2"),	        new EnvelopeWidget.Node(                    0, 100, new MT32Model(patch,j+0x22), 0, 100, new MT32Model(patch,j+0x27),                    25, false, new MT32Sender(j+k+0x22),         new MT32Sender(j+k+0x27),                    "TIME 3",                            "LEVEL 3"),	        new EnvelopeWidget.Node(                    0,100,    new MT32Model(patch,j+0x23), 0,100, new MT32Model(patch,j+0x28),                    25,false, new MT32Sender(j+k+0x23),           new MT32Sender(j+k+0x28),                    "TIME 4",                              "LEVEL S"),                new EnvelopeWidget.Node(                    50,50,   null, 5000,5000, null,                     0,false, null,            null,                      null,          null),     	        new EnvelopeWidget.Node(0,100,                      new MT32Model(patch,j+0x24),0,  0, null, 0,false,                    new MT32Sender(j+k+0x24),          null,                                      "TIME 5",                          null)            };            addWidget(TVFPane,	        new EnvelopeWidget("TVF", patch, fNodes), 0, gy, 3, 5, 56);            TVFPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),                "",TitledBorder.CENTER,TitledBorder.CENTER));            partNTabPane.add(TVFPane, gbc);            partNTabPane.addTab("Time Variant Filter", TVFPane);//                  gbc.gridx=10;gbc.gridy=8;gbc.gridwidth=0;gbc.gridheight=9;                        // TVA panel on partial panel            JPanel TVAPane = new JPanel();            TVAPane.setLayout(new GridBagLayout());            gy = 0;            int lwa = getLabelWidth("TVA ENV TIME_FOLLOW ");  // Longest label string                        addWidget(TVAPane,new ScrollBarWidget("TVA LEVEL",patch,0,100,0, lwa,                new MT32Model(patch,j+0x29), new MT32Sender(j+k+0x29)),0,gy,3,1,55);            gy++;            addWidget(TVAPane,new ScrollBarWidget("TVA VELO SENS",patch,0,100,0, lwa,                new MT32Model(patch,j+0x2A), new MT32Sender(j+k+0x2A)),0,gy,3,1,55);            gy++;            addWidget(TVAPane,new ScrollBarWidget("TVA BIAS POINT 1",patch,0,127,0, lwa,                new MT32Model(patch,j+0x2B), new MT32Sender(j+k+0x2B)),0,gy,3,1,55);            gy++;            addWidget(TVAPane,new ScrollBarWidget("TVA BIAS LEVEL 1",patch,0,12,-12, lwa,                new MT32Model(patch,j+0x2C),new MT32Sender(j+k+0x2C)),0,gy,3,1,55);            gy++;            addWidget(TVAPane,new ScrollBarWidget("TVA BIAS POINT 2",patch,0,127,0, lwa,                new MT32Model(patch,j+0x2D),new MT32Sender(j+k+0x2D)),0,gy,3,1,55);            gy++;            addWidget(TVAPane,new ScrollBarWidget("TVA BIAS LEVEL 2",patch,0,12,-12, lwa,                new MT32Model(patch,j+0x2E),new MT32Sender(j+k+0x2E)),0,gy,3,1,55);            gy++;            addWidget(TVAPane,new ScrollBarWidget("TVA ENV TIME KEYF",patch,0,4,0, lwa,                new MT32Model(patch,j+0x2F),new MT32Sender(j+k+0x2F)),0,gy,3,1,55);            gy++;            addWidget(TVAPane,new ScrollBarWidget("TVA ENV TIME_FOLLOW",patch,0,4,0, lwa,                new MT32Model(patch,j+0x30),new MT32Sender(j+k+0x30)),0,gy,3,1,55);            gy++;//            System.out.print ("i / j " + i + " / " + j);            EnvelopeWidget.Node[] aNodes = new EnvelopeWidget.Node[] {                 new EnvelopeWidget.Node(                    0,  0,    null, 0,  0, null,            // minx,  maxx,    ofsx,  miny, maxy, ofsy                    0, false, null,        null,            // basey, invertx, x,                 y,                     null,           null),                  // namex,                 namey	        new EnvelopeWidget.Node(                    0, 100,   new MT32Model(patch,j+0x31), 0, 100, new MT32Model(patch,j+0x36),                    25,false, new MT32Sender(j+k+0x31),            new MT32Sender(j+k+0x36),                    "TIME 1",                              "LEVEL 1"),	        new EnvelopeWidget.Node(                    0, 100,    new MT32Model(patch,j+0x32), 0, 100, new MT32Model(patch,j+0x37),                    25, false, new MT32Sender(j+k+0x32),            new MT32Sender(j+k+0x37),                    "TIME 2",                               "LEVEL 2"),	        new EnvelopeWidget.Node(                    0, 100, new MT32Model(patch,j+0x33), 0, 100, new MT32Model(patch,j+0x38),                    25, false, new MT32Sender(j+k+0x33),         new MT32Sender(j+k+0x38),                    "TIME 3",                            "LEVEL 3"),	        new EnvelopeWidget.Node(                    0, 100,    new MT32Model(patch,j+0x34), 0, 100, new MT32Model(patch,j+0x39),                     25, false, new MT32Sender(j+k+0x34),            new MT32Sender(j+k+0x39),                    "TIME 4",                               "LEVEL S"),                new EnvelopeWidget.Node(                    50, 50,   null, 5000, 5000, null,                     0, false, null,             null,                      null,           null),     	        new EnvelopeWidget.Node(                    0, 100,   new MT32Model(patch,j+0x35), 0,  0, null,                     0, false, new MT32Sender(j+k+0x35),           null,                                      "TIME 5",                              null)            };            addWidget(TVAPane,	        new EnvelopeWidget("TVA", patch, aNodes), 0, gy, 3, 5, 56);            TVAPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),                "",TitledBorder.CENTER,TitledBorder.CENTER));            partNTabPane.add(TVAPane, gbc);            partNTabPane.addTab("Time Variant Amplifier", TVAPane);            //            partNPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED), //                "PART "+(i+1)+" (partNPane) ",TitledBorder.CENTER,TitledBorder.CENTER));                        partNPane.add(partNTabPane, gbc);            partTabPane.addTab("Partial "+(i+1), partNPane);         } // end for loop        gbc.gridx=5;gbc.gridy=0;gbc.gridwidth=0;gbc.gridheight=0;        partialPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),             "PARTIALS",TitledBorder.CENTER,TitledBorder.CENTER));          partialPane.add(partTabPane, gbc);//        gbc.anchor=GridBagConstraints.WEST;                 gbc.gridx=5;gbc.gridy=0;gbc.gridwidth=8;gbc.gridheight=9;        scrollPane.add(partialPane, gbc);        pack();        show();    }