public void paintComponent(Graphics g) {
        ButtonModel bm = getModel();
        Graphics2D g2d = (Graphics2D) g.create();
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        if(defImg != null && rolImg != null && preImg != null) {
            if(bm.isRollover() && bm.isEnabled()) {
                if(bm.isPressed()) g2d.drawImage(preImg, 0, 0, width, height, null);
                else g2d.drawImage(rolImg, 0, 0, width, height, null);
            }else g2d.drawImage(defImg, 0, 0, width, height, null);
        }else {
            BufferedImage loc, pre, rol, def;
            switch(type) {
                case 1:
                    loc = loc_button_1;
                    pre = pre_button_1;
                    rol = rol_button_1;
                    def = def_button_1;
                    break;
                case 2:
                    loc = loc_button_2;
                    pre = pre_button_2;
                    rol = rol_button_2;
                    def = def_button_2;
                    break;
                default:
                    BaseUtils.warn("Unknown button type!", true);
                    return;
            }
            if(!bm.isEnabled()) g2d.drawImage(loc, 0, 0, width, height, null);
            else if(bm.isRollover()) {
                if(bm.isPressed()) g2d.drawImage(pre, 0, 0, width, height, null);
                else g2d.drawImage(rol, 0, 0, width, height, null);
            }else g2d.drawImage(def, 0, 0, width, height, null);
        }
        g2d.dispose();
        super.paintComponent(g);
    }