Single Selection in JGoPalette

JGo 5.1 - I have a class that extends from JGoPalette. I’m trying to make the nodes in the palette single selection.

I overrode JGoSelection and am trying to use it, but my selection handles are not showing up at all.
public class SingleJGoSelection extends JGoSelection {

public SingleJGoSelection(){

public JGoObject selectObject(JGoObject obj){

// if (obj instanceof ModelNode){
// clearSelection();
// }
return obj;


Code in my JGoPalette:
/* (non-Javadoc)
* @see com.nwoods.jgo.JGoView#createDefaultSelection()
public JGoSelection createDefaultSelection(){
return new SingleJGoSelection();

Any hints on what I am doing wrong? Does the createDefaultSelection() method do something other than just create the JGoSelection object?

You need to call the constructor that takes the JGoView as the argument:

public JGoSelection createDefaultSelection() {
return new SingleJGoSelection(this);

If the JGoSelection doesn’t know about the containing JGoView, it can’t add selection handles as appropriate.

By the way, I would recommend overriding JGoSelection.extendSelection in order to limit the number of selected objects to one, because extendSelection is called by various methods, including selectObject.

Thanks for the tips! I have it working now.

Also want to add that I had to override toggleSelection as well (called when holding down and selecting).