Add Pattern From Selection In Java