@Override
    protected void paintComponent(Graphics g) {
    	super.paintComponent(g);
		if(width!=this.getWidth() || height!=this.getHeight()) {
			width = this.getWidth();
			height = this.getHeight();
			displayBuffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
			dBufferG = displayBuffer.createGraphics();
		}
        String str,part1="", part2="";
        int alpha, red, green, blue;
        int width = (getWidth()- gridStroke)/(PAGE_SIZE)- gridStroke;
        int height = (getHeight()- gridStroke)/(PAGE_SIZE)- gridStroke;
        int textX, textY;
        int offsetX = (getWidth()- systemValues[0].length*(gridStroke+width)-gridStroke)/2; 
        int offsetY = (getHeight()- systemValues.length*(gridStroke+height)-gridStroke)/2; 
        dBufferG.setFont(font);
        dBufferG.setColor(displayGrid);
        dBufferG.fillRect(0,0,getWidth(),getHeight());
        for(int row = 0; row < systemValues.length; row++) {
            for(int col = 0; col < systemValues[row].length; col++) {
            	dBufferG.setColor(displayBackground);
            	dBufferG.fillRect(offsetX + gridStroke + col * (width + gridStroke), offsetY + gridStroke + row * (height + gridStroke), width, height);
                textX = offsetX + gridStroke + 4 + col*(width+gridStroke);
                textY = offsetY + gridStroke + height/2 - 4 + row*(height+gridStroke);
                dBufferG.setColor(displayTextColor);
                if(mode==Mode.SHOW_BYTES) {
                    alpha = Color.alpha(systemValues[row][col]);
                    red = Color.red(systemValues[row][col]);
                    green = Color.green(systemValues[row][col]);
                    blue = Color.blue(systemValues[row][col]);
                    part1=String.format("%3d,%3d",alpha,red);
                    part2=String.format("%3d,%3d",green,blue);
                } else if(mode==Mode.SHOW_INT) {
                    part1 = String.valueOf(systemValues[row][col]);
                    if(part1.length()>5) {
                    	part2 = " "+part1.substring(5,part1.length());
                    	part1 = " "+part1.substring(0,5);
                    } else {
                    	part2 = "";
                    }
                }
                dBufferG.drawString(part1, textX, textY);
                dBufferG.drawString(part2, textX, textY + height / 2);
                g.drawImage(displayBuffer, 0, 0, getWidth(), getHeight(),null);
            }
        }
    }