model view controller - 2D Geometry in java -


i writing application using mvc framework. it's examination application. there question generator classes in model part.

but when comes geometry question, i'm puzzled whether include drawing part in question generators. certainly, paintcomponent method in view part. tried use shape objects (arc2d etc), there few.

but need custom shapes lables on it.(like triangle a,b, c lables on it, square side length information on it). becomes easy if done paintcomponent method. but, painted changes exam question.

there few approaches in mind

  1. painting in buffered image in questiongenerator classes , passing ui make painted on jpanel via controller.

  2. implementing interface in questiongenerator classes having methods take graphics object , calling these methods paintcomponent.

  3. using canvas instead of buffered image.

  4. looking open source 2d library fulfill requirements.(i googled found no suitable one. should support types of shapes in high school textbook.should support labeled shapes.)

i'm locked between design , ease (of course, design eases later on). because, painting geometry absolutely related ui shapes paint related model.

please me, suggest me solve complication.

i'm afraid there may criticism said. after all, first question in stackoverflow.

thanks in advance......

i choose second option interface. seems simplest implement , maintain.


Comments