Ideally you would want to set anisotropic filtering before glTexImage2D(), but if you’re using JOGL’s Texture classes, you should instead set it once you’ve got your new Texture:
Texture texture = TextureIO.newTexture(blah);
texture.setTexParameteri(target, anisotropy, anisotropylevel); // if anisotropy available
Or, you could always create your own Texture/Image classes so you don’t have to use those in the Texture package. If the normal texture-making procedure is anything to go by, all you need to do is:
gl.glBindTexture(textureid);
gl.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, filterlevel);
gl.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filterlevel);
gl.glTexParameteri(target, anisotropy, anisotropylevel); // if anisotropy available
gl.glTexImage2D(…);
in the constructor or other initialization of your texture.