Yes. The method is similar to simulation for drawing field line for static electric field.
Use EJS to calculate Bfield at any point in the region according to the source.
You can use current loops to simulate magnetic bar.

Suppose the point you want to draw field line is (x,y)
The differential equation is

dx/dt= Bfield component in x direction
dy/dt= Bfield component in y direction

And the particle will move along the field line.
Because you starts at one point , so you should use two particles to move in opposition direction to complete the field line.