void (Graphics g, JComponent comp, JMenu jMenu, ButtonModel buttonmodel, Icon allowedIcon) { if (comp.isOpaque()) { g.setColor(jMenu.getBackground()); g.fillRect(0, 0, jMenu.getWidth(), jMenu.getHeight()); } if (buttonmodel.isArmed() || buttonmodel.isSelected()){ paintHover(g, comp, jMenu, allowedIcon); } }