Мне нужно расширить класс Graphics до @Override
некоторыми методами, включая drawRect(int,int,int,int)
и drawRoundRect(int,int,int,int,int,int)
. Однако я понятия не имею, как это сделать. Это то, что я получил до сих пор:Расширение класса Graphics в Java
public class myGraphics extends Graphics {
@Override
public void drawRect(int x, int y, int width, int height) {
super.fillRect(x, y, width, height);
setColor(Color.WHITE);
super.fillRect(x, y, width-6, height-6);
}
@Override
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
super.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
setColor(Color.WHITE);
super.fillRoundRect(x, y, width-6, height-6, arcWidth, arcHeight);
}
}
Я получаю сообщение об ошибке на объявлении класса линии говоря: myGraphics is not abstract and does not override abstract method dispose() in java.awt.Graphics
я получаю сообщение об ошибке на каждой строке, в которой super.fill..(..)
упоминается говоря: abstract method fill..(..) in java.awt.Graphics cannot be accessed directly
. У кого-нибудь есть идея, что я могу сделать?