package eu.midnightdust.yaytris.ui;

import javax.swing.*;
import java.awt.*;

import static eu.midnightdust.yaytris.ui.TetrisUI.scale;
import static eu.midnightdust.yaytris.ui.TetrisUI.setFontScale;

public class AbstractMenu extends JPanel {
    @Override
    public Component add(Component comp) {
        comp.setBounds(scale(60), scale(20+getSpacing()*this.getComponentCount()), scale(100), scale(20));
        if (comp instanceof JComponent) setFontScale((JComponent) comp);
        return super.add(comp);
    }

    public int getSpacing() {
        return 23;
    }
}
