All projects

Resource Factory

A Producer-Consumer Game in Java Swing

Year
2026
Disciplines
  • Development
  • Video game
  • Java
Tools
  • Java
  • Swing
Links

An exercise for the Processes and Services Programming module: solve the producer-consumer problem with Java threads. I turned it into a management game in Java Swing, with a strict Model-View-Presenter architecture and a fully custom retro interface.

Orders, producers and customers View full size
01

Orders, producers and customers

You order a product and pay its cost. A free producer picks up the order, makes it and leaves the unit in stock. Customers arrive, queue, sit down, take a unit and pay its price. With the earnings you open up to 8 producers, upgrade them, unlock products and run promotions. Producers and customers are threads, and every unit goes through two shared resources in a chain, the order list and the stock, both guarded with synchronized and wait/notifyAll. The view never talks to the model: every 16 ms the presenter reads it and builds an immutable snapshot for the view to paint.

Four themes, painted by hand View full size
02

Four themes, painted by hand

The interface is a retro desktop drawn in Swing: windows with striped title bars, pixel icons, segmented bars, pattern fills and a pixel font. Four themes, Mac, Game Boy, SNES and 8-bit, switch at runtime from the Theme menu.

Kepler for Obsidian A Theme for Writing and Reading View project