this works with swing gui