my application layout is something like: custom JFrame (which just handles the creation of the gui) which contains a standard JPanel which contains a custom JPanel
Inside the custom JPanel, which is called MinimapPanel, I changed the paint method:
//in a constructor:
scaledTransform = new AffineTransform(); = new AffineTransform();
scaledTransform = new AffineTransform();
scaledTransform.scale(scaleAmount, scaleAmount);
//...
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setTransform(scaledTransform);
mapDrawer.paintMinimap(g, seatMap, miniViewHandler);//it just calls a bunch of fillRect
if (viewRect != null) {
g.setColor(new Color(255, 0, 0));
int x = viewRect.x;
int y = viewRect.y;
g.drawRect(x, y, Math.abs(viewRect.width), Math.abs(viewRect.height));
}
g2d.setTransform(plainTransform);
}
Everything works fine if I don't apply the trasform, or if the scaling is by 1.0 (none), but if I scale, everytime the JFrame repaints, the MinimapPanel stays blank.
Any ideas on what I could be doing wrong?