swing: improved fix/workaround for openjdk bug on linux (see c8e9ab5703fa949a9dca81c66fd20d4f3942c073)