addWidget(globalPane, new PatchNameWidget(" Name  ", patch, ((Driver) patch.getDriver()).getPatchNameSize()),0,0,1,1,0);
addWidget(globalPane, new PatchNameWidget(" Name  ", patch),0,0,1,1,0);
  public KorgX3SingleEditor(Patch patch)  {    super ("Korg X3 Single Editor",patch);    /** The tab pane under which all other JPanels lie */    JTabbedPane tabPane = new JTabbedPane();    /** The actual tabs under tabPane */    JPanel globalTabPane = new JPanel();    JPanel pitchTabPane = new JPanel();    JPanel osc1TabPane = new JPanel();    JPanel osc2TabPane = new JPanel();    JPanel modulationTabPane = new JPanel();    JPanel vdfmodTabPane = new JPanel();    /** All these have GridBagLayout */    globalTabPane.setLayout(new GridBagLayout());    pitchTabPane.setLayout(new GridBagLayout());    osc1TabPane.setLayout(new GridBagLayout());    osc2TabPane.setLayout(new GridBagLayout());    modulationTabPane.setLayout(new GridBagLayout());    vdfmodTabPane.setLayout(new GridBagLayout());    tabPane.addTab("Global", globalTabPane);    tabPane.addTab("Pitch EG", pitchTabPane);    tabPane.addTab("Osc1", osc1TabPane);    tabPane.addTab("Osc2", osc2TabPane);    tabPane.addTab("Pitch Mod", modulationTabPane);    tabPane.addTab("VDF Mod,AT&JC", vdfmodTabPane);    /** Global pane under globalTabPane */    JPanel globalPane = new JPanel();    globalPane.setLayout(new GridBagLayout());    addWidget(globalPane, new PatchNameWidget(" Name  ", patch, ((Driver) patch.getDriver()).getPatchNameSize()),0,0,1,1,0);    addWidget(globalPane, new ComboBoxWidget("Osc Mode",patch,new X3Model(patch,10),					     new X3Sender(10),new String []{"SINGLE","DOUBLE","DRUMS"}),1,0,1,1,1);    addWidget(globalPane, new ComboBoxWidget("Assign",patch,new X3Model(patch,11,0),					     new X3Sender(11),new String []{"POLY","MONO"}),2,0,1,1,2);    addWidget(globalPane, new ComboBoxWidget("hold",patch,new X3Model(patch,11,1),					     new X3Sender(11),new String []{"OFF","ON"}),3,0,1,1,3);    gbc.gridx=0;gbc.gridy=0;gbc.gridwidth=4;gbc.gridheight=2;gbc.fill=GridBagConstraints.BOTH;gbc.anchor=GridBagConstraints.EAST;    globalPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"Global",TitledBorder.CENTER,TitledBorder.CENTER));    globalTabPane.add(globalPane,gbc);    /* Osc1 setup pane under globalTabPane */    JPanel osc1setupPane = new JPanel();    osc1setupPane.setLayout(new GridBagLayout());gbc.weightx=1;    addWidget(osc1setupPane,new ComboBoxWidget("Multisound",patch,new MultiSoundModel(patch, 12),new MultiSoundSender(12),multiSounds),0,0,1,1,4);    addWidget(osc1setupPane,new ScrollBarWidget("Octave",patch,-2,1,0,new X3Model(patch,14),new X3Sender(14)),1,0,1,1,5);    addWidget(osc1setupPane,new ScrollBarWidget("Level",patch,0,99,0,new X3Model(patch,65),new X3Sender(65)),0,1,2,1,6);    addWidget(osc1setupPane,new ScrollBarWidget("Pitch EG Int",patch,-99,99,0,new X3Model(patch,40),new X3Sender(40)),0,2,2,1,7);    gbc.gridx=0;gbc.gridy=6;gbc.gridwidth=4;gbc.gridheight=2;gbc.fill=GridBagConstraints.BOTH;gbc.anchor=GridBagConstraints.EAST;    osc1setupPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"Osc1 setup",TitledBorder.CENTER,TitledBorder.CENTER));    globalTabPane.add(osc1setupPane, gbc);    /* Osc2 setup pane under globalTabPane */    JPanel osc2setupPane = new JPanel();    osc2setupPane.setLayout(new GridBagLayout());gbc.weightx=1;    addWidget(osc2setupPane,new ComboBoxWidget("Multisound",patch,new MultiSoundModel(patch, 15),new MultiSoundSender(15),multiSounds),0,0,1,1,8);    addWidget(osc2setupPane,new ScrollBarWidget("Octave",patch,-2,1,0,new X3Model(patch,17),new X3Sender(17)),1,0,1,1,9);    addWidget(osc2setupPane,new ScrollBarWidget("Level",patch,0,99,0,new X3Model(patch,112),new X3Sender(112)),0,1,2,1,10);    addWidget(osc2setupPane,new ScrollBarWidget("Pitch EG Int",patch,-99,99,0,new X3Model(patch,87),new X3Sender(87)),0,2,2,1,11);    addWidget(osc2setupPane,new ScrollBarWidget("Interval",patch,-12,12,0,new X3Model(patch,18),new X3Sender(18)),0,3,2,1,12);    addWidget(osc2setupPane,new ScrollBarWidget("Detune",patch,-50,50,0,new X3Model(patch,19),new X3Sender(19)),0,4,2,1,13);    addWidget(osc2setupPane,new ScrollBarWidget("Delay",patch,0,99,0,new X3Model(patch,20),new X3Sender(20)),0,5,2,1,14);    gbc.gridx=0;gbc.gridy=11;gbc.gridwidth=1;gbc.gridheight=2;gbc.fill=GridBagConstraints.BOTH;gbc.anchor=GridBagConstraints.EAST;    osc2setupPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"Osc2 setup",TitledBorder.CENTER,TitledBorder.CENTER));    globalTabPane.add(osc2setupPane, gbc);    /** Pitch EG Tab */    JPanel pitchegPane = new JPanel();    pitchegPane.setLayout(new GridBagLayout());    gbc.weightx=1;    addWidget(pitchegPane,new ScrollBarWidget("Level Vel.",patch,-99,99,0,new X3Model(patch,28),new X3Sender(28)),0,1,1,1,15);    addWidget(pitchegPane,new ScrollBarWidget("Time Vel.",patch,-99,99,0,new X3Model(patch,27),new X3Sender(27)),0,2,1,1,16);    addWidget(pitchegPane,new EnvelopeWidget("PITCHEG",patch,new EnvelopeWidget.Node [] {      new EnvelopeWidget.Node(0,0,null,-99,99,new X3Model(patch,21),99,false,null,new X3Sender(21),null,"SL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,22),-99,99,new X3Model(patch,23),99,false,new X3Sender(22),new X3Sender(23),"AT","AL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,24),99,99,null,0,false,new X3Sender(24),null,"DT",null),      new EnvelopeWidget.Node(0,99,new X3Model(patch,25),-99,99,new X3Model(patch,26),99,false,new X3Sender(25),new X3Sender(26),"RT","RL")    }),0,0,1,1,17);    gbc.gridx=10;gbc.gridy=0;gbc.gridwidth=7;gbc.gridheight=9;    pitchegPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"PITCH EG",TitledBorder.CENTER,TitledBorder.CENTER));    pitchTabPane.add(pitchegPane, gbc);    /** OSC 1 Tab */    // VDF1EG pane under osc1TabPane    JPanel vdf1egPane = new JPanel();    vdf1egPane.setLayout(new GridBagLayout());    gbc.weightx=1;    addWidget(vdf1egPane,new ScrollBarWidget("Fc",patch,0,99,0,new X3Model(patch,50),new X3Sender(50)),0,1,1,1,23);    addWidget(vdf1egPane,new ScrollBarWidget("EGint",patch,-99,99,0,new X3Model(patch,53),new X3Sender(53)),0,2,1,1,24);    addWidget(vdf1egPane,new EnvelopeWidget("VDF1EG",patch,new EnvelopeWidget.Node [] {      new EnvelopeWidget.Node(0,0,null,99,99,null,0,false,null,null,null,null),      new EnvelopeWidget.Node(0,99,new X3Model(patch,57),-99,99,new X3Model(patch,58),99,false,new X3Sender(57),new X3Sender(58),"AT","AL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,59),-99,99,new X3Model(patch,60),99,false,new X3Sender(59),new X3Sender(60),"DT","BP"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,61),-99,99,new X3Model(patch,62),99,false,new X3Sender(61),new X3Sender(62),"ST","SL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,63),-99,99,new X3Model(patch,64),99,false,new X3Sender(63),new X3Sender(64),"RT","RL")    }),0,0,1,1,25);    gbc.gridx=10;gbc.gridy=0;gbc.gridwidth=7;gbc.gridheight=9;    vdf1egPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"VDF1 EG",TitledBorder.CENTER,TitledBorder.CENTER));    osc1TabPane.add(vdf1egPane, gbc);    JPanel vda1egPane = new JPanel();    vda1egPane.setLayout(new GridBagLayout());    gbc.weightx=1;    addWidget(vda1egPane,new EnvelopeWidget("VDA1EG",patch,new EnvelopeWidget.Node [] {      new EnvelopeWidget.Node(0,0,null,0,0,null,0,false,null,null,null,null),      new EnvelopeWidget.Node(0,99,new X3Model(patch,71),0,99,new X3Model(patch,72),0,false,new X3Sender(71),new X3Sender(72),"AT","AL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,73),0,99,new X3Model(patch,74),0,false,new X3Sender(73),new X3Sender(74),"DT","BP"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,75),0,99,new X3Model(patch,76),0,false,new X3Sender(75),new X3Sender(76),"ST","SL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,77),0,0,null,0,false,new X3Sender(77),null,"RT",null)    }),0,0,1,1,33);    gbc.gridx=10;gbc.gridy=10;gbc.gridwidth=7;gbc.gridheight=9;    vda1egPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"VDA1 EG",TitledBorder.CENTER,TitledBorder.CENTER));    osc1TabPane.add(vda1egPane, gbc);    /** OSC 2 Tab */    // VDF2EG pane under osc2TabPane    JPanel vdf2egPane = new JPanel();    vdf2egPane.setLayout(new GridBagLayout());    gbc.weightx=1;    addWidget(vdf2egPane,new ScrollBarWidget("Fc",patch,0,99,0,new X3Model(patch,97),new X3Sender(97)),0,1,1,1,39);    addWidget(vdf2egPane,new ScrollBarWidget("EGint",patch,-99,99,0,new X3Model(patch,100),new X3Sender(100)),0,2,1,1,40);    addWidget(vdf2egPane,new EnvelopeWidget("VDF2EG",patch,new EnvelopeWidget.Node [] {      new EnvelopeWidget.Node(0,0,null,99,99,null,0,false,null,null,null,null),      new EnvelopeWidget.Node(0,99,new X3Model(patch,104),-99,99,new X3Model(patch,105),99,false,new X3Sender(104),new X3Sender(105),"AT","AL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,106),-99,99,new X3Model(patch,107),99,false,new X3Sender(106),new X3Sender(107),"DT","BP"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,108),-99,99,new X3Model(patch,109),99,false,new X3Sender(108),new X3Sender(109),"ST","SL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,110),-99,99,new X3Model(patch,111),99,false,new X3Sender(110),new X3Sender(111),"RT","RL")    }),0,0,1,1,41);    gbc.gridx=10;gbc.gridy=0;gbc.gridwidth=7;gbc.gridheight=9;    vdf2egPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"VDF2 EG",TitledBorder.CENTER,TitledBorder.CENTER));    osc2TabPane.add(vdf2egPane, gbc);    JPanel vda2egPane = new JPanel();    vda2egPane.setLayout(new GridBagLayout());    gbc.weightx=1;    addWidget(vda2egPane,new EnvelopeWidget("VDA2EG",patch,new EnvelopeWidget.Node [] {      new EnvelopeWidget.Node(0,0,null,0,0,null,0,false,null,null,null,null),      new EnvelopeWidget.Node(0,99,new X3Model(patch,118),0,99,new X3Model(patch,119),0,false,new X3Sender(118),new X3Sender(119),"AT","AL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,120),0,99,new X3Model(patch,121),0,false,new X3Sender(120),new X3Sender(121),"DT","BP"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,122),0,99,new X3Model(patch,123),0,false,new X3Sender(122),new X3Sender(123),"ST","SL"),      new EnvelopeWidget.Node(0,99,new X3Model(patch,124),0,0,null,0,false,new X3Sender(125),null,"RT",null)    }),0,0,1,1,49);    gbc.gridx=10;gbc.gridy=10;gbc.gridwidth=7;gbc.gridheight=9;    vda2egPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"VDA2 EG",TitledBorder.CENTER,TitledBorder.CENTER));    osc2TabPane.add(vda2egPane, gbc);    /** Modulation Tab */    JPanel pitch1ModPane = new JPanel();    pitch1ModPane.setLayout(new GridBagLayout());    addWidget(pitch1ModPane, new ComboBoxWidget("Waveform",patch,new X3Model(patch,41,0,3),						new X3Sender(41),new String []{"TRI","SAW UP","SAW DOWN","SQR1","RAND","SQR2"}),0,0,1,1,56);    addWidget(pitch1ModPane, new CheckBoxWidget("Key Sync",patch,new X3Model(patch,41,7),new X3Sender(41)),1,0,1,1,57);    addWidget(pitch1ModPane,new ScrollBarWidget("Frequency",patch,0,99,0,new X3Model(patch,42),new X3Sender(42)),0,1,2,1,57);    addWidget(pitch1ModPane,new ScrollBarWidget("Intensity",patch,0,99,0,new X3Model(patch,45),new X3Sender(45)),0,2,2,1,58);    addWidget(pitch1ModPane,new ScrollBarWidget("Delay",patch,0,99,0,new X3Model(patch,43),new X3Sender(43)),0,3,2,1,59);    addWidget(pitch1ModPane,new ScrollBarWidget("Fade In",patch,0,99,0,new X3Model(patch,44),new X3Sender(44)),0,4,2,1,60);    addWidget(pitch1ModPane,new ScrollBarWidget("Keyb. Tracking",patch,-99,99,0,new X3Model(patch,46),new X3Sender(46)),0,5,2,1,61);    addWidget(pitch1ModPane,new ScrollBarWidget("AT Mod. Int.",patch,0,99,0,new X3Model(patch,47),new X3Sender(47)),0,6,2,1,62);    addWidget(pitch1ModPane,new ScrollBarWidget("JS Mod. Int.",patch,0,99,0,new X3Model(patch,48),new X3Sender(48)),0,7,2,1,63);    addWidget(pitch1ModPane,new ScrollBarWidget("After Touch+Joy",patch,0,9,0,new X3Model(patch,49),new X3Sender(49)),0,8,2,1,64);    gbc.gridx=0;gbc.gridy=0;gbc.gridwidth=2;gbc.gridheight=9;    pitch1ModPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"Pitch 1 Modulation",TitledBorder.CENTER,TitledBorder.CENTER));    modulationTabPane.add(pitch1ModPane, gbc);    JPanel pitch2ModPane = new JPanel();    pitch2ModPane.setLayout(new GridBagLayout());    addWidget(pitch2ModPane, new ComboBoxWidget("Waveform",patch,new X3Model(patch,88,0,3),						new X3Sender(87),new String []{"TRI","SAW UP","SAW DOWN","SQR1","RAND","SQR2"}),0,0,1,1,56);    addWidget(pitch2ModPane, new CheckBoxWidget("Key Sync",patch,new X3Model(patch,88,7),new X3Sender(88)),1,0,1,1,57);    addWidget(pitch2ModPane,new ScrollBarWidget("Frequency",patch,0,99,0,new X3Model(patch,89),new X3Sender(89)),0,1,2,1,57);    addWidget(pitch2ModPane,new ScrollBarWidget("Intensity",patch,0,99,0,new X3Model(patch,92),new X3Sender(92)),0,2,2,1,58);    addWidget(pitch2ModPane,new ScrollBarWidget("Delay",patch,0,99,0,new X3Model(patch,90),new X3Sender(90)),0,3,2,1,59);    addWidget(pitch2ModPane,new ScrollBarWidget("Fade In",patch,0,99,0,new X3Model(patch,91),new X3Sender(91)),0,4,2,1,60);    addWidget(pitch2ModPane,new ScrollBarWidget("Keyb. Tracking",patch,-99,99,0,new X3Model(patch,93),new X3Sender(93)),0,5,2,1,61);    addWidget(pitch2ModPane,new ScrollBarWidget("AT Mod. Int.",patch,0,99,0,new X3Model(patch,94),new X3Sender(94)),0,6,2,1,62);    addWidget(pitch2ModPane,new ScrollBarWidget("JS Mod. Int.",patch,0,99,0,new X3Model(patch,95),new X3Sender(95)),0,7,2,1,63);    addWidget(pitch2ModPane,new ScrollBarWidget("After Touch+Joy",patch,0,9,0,new X3Model(patch,96),new X3Sender(96)),0,8,2,1,64);    gbc.gridx=0;gbc.gridy=10;gbc.gridwidth=2;gbc.gridheight=9;    pitch2ModPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"Pitch 2 Modulation",TitledBorder.CENTER,TitledBorder.CENTER));    modulationTabPane.add(pitch2ModPane, gbc);    /** VDF Modulation */    JPanel vdfModPane = new JPanel();    vdfModPane.setLayout(new GridBagLayout());    addWidget(vdfModPane, new ComboBoxWidget("Waveform",patch,new X3Model(patch,29,0,3),						new X3Sender(29),new String []{"TRI","SAW UP","SAW DOWN","SQR1","RAND","SQR2"}),0,0,1,1,65);    addWidget(vdfModPane, new CheckBoxWidget("OSC1 MG",patch,new X3Model(patch,29,5),new X3Sender(29)),1,0,1,1,66);    addWidget(vdfModPane, new CheckBoxWidget("OSC2 MG",patch,new X3Model(patch,29,6),new X3Sender(29)),2,0,1,1,67);    addWidget(vdfModPane, new CheckBoxWidget("K.Sync",patch,new X3Model(patch,29,7),new X3Sender(29)),3,0,1,1,68);    addWidget(vdfModPane,new ScrollBarWidget("Frequency",patch,0,99,0,new X3Model(patch,30),new X3Sender(30)),0,1,4,1,69);    addWidget(vdfModPane,new ScrollBarWidget("Intensity",patch,0,99,0,new X3Model(patch,32),new X3Sender(32)),0,2,4,1,70);    addWidget(vdfModPane,new ScrollBarWidget("Delay",patch,0,99,0,new X3Model(patch,31),new X3Sender(31)),0,3,4,1,71);    gbc.gridx=0;gbc.gridy=0;gbc.gridwidth=4;gbc.gridheight=5;    vdfModPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"VDF Modulation",TitledBorder.CENTER,TitledBorder.CENTER));    vdfmodTabPane.add(vdfModPane, gbc);    // ---    JPanel atModPane = new JPanel();    atModPane.setLayout(new GridBagLayout());    addWidget(atModPane,new ScrollBarWidget("Pitch Bend",patch,-12,12,0,new X3Model(patch,33),new X3Sender(33)),0,0,1,1,72);    addWidget(atModPane,new ScrollBarWidget("VDF Cutoff Fc",patch,-99,99,0,new X3Model(patch,34),new X3Sender(34)),0,1,1,1,73);    addWidget(atModPane,new ScrollBarWidget("VDF MG Int",patch,0,99,0,new X3Model(patch,35),new X3Sender(35)),0,2,1,1,74);    addWidget(atModPane,new ScrollBarWidget("VDA Amplitude",patch,-99,99,0,new X3Model(patch,36),new X3Sender(36)),0,3,1,1,75);    gbc.gridx=0;gbc.gridy=5;gbc.gridwidth=4;gbc.gridheight=5;    atModPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"After Touch Control",TitledBorder.CENTER,TitledBorder.CENTER));    vdfmodTabPane.add(atModPane, gbc);    // ---    JPanel jtModPane = new JPanel();    jtModPane.setLayout(new GridBagLayout());    addWidget(jtModPane,new ScrollBarWidget("Pitch Bend",patch,-12,12,0,new X3Model(patch,37),new X3Sender(37)),0,0,1,1,76);    addWidget(jtModPane,new ScrollBarWidget("VDF MG Int",patch,0,99,0,new X3Model(patch,39),new X3Sender(39)),0,1,1,1,77);    addWidget(jtModPane,new ScrollBarWidget("VDF Sweep",patch,-99,99,0,new X3Model(patch,38),new X3Sender(38)),0,2,1,1,78);    gbc.gridx=0;gbc.gridy=10;gbc.gridwidth=4;gbc.gridheight=5;    jtModPane.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED),"Joystick Control",TitledBorder.CENTER,TitledBorder.CENTER));    vdfmodTabPane.add(jtModPane, gbc);    // show tab    scrollPane.add(tabPane, gbc);    pack();    show();  }