package com.ts3client.ui; import javax.swing.JSpinner; import java.awt.Dimension; /** Shared shaping for the numeric spinners the channel editor is full of. */ final class Spinners { /** Width that fits a five-digit power without swallowing the rest of a form row. */ private static final int WIDTH = 80; private Spinners() { } /** * Keeps a spinner to a sensible width and drops the grouping separator: these hold * permission powers and client counts, which TeamSpeak shows as plain numbers. */ static JSpinner compact(JSpinner spinner) { JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner, "#"); spinner.setEditor(editor); Dimension size = new Dimension(WIDTH, spinner.getPreferredSize().height); spinner.setPreferredSize(size); spinner.setMaximumSize(size); return spinner; } }