I'm (new to SO and) attempting to code an "emulator" for an 8-bit CPU I am making with a friend. I have only ever used Java to make simple GUIs with Swing, and from reading similar questions it seems to me that using repaint() and Graphics2D to display 60fps is not the way to go.
From my attempts at using a custom JComponent to draw, I couldn't agree more. Despite calling screenComponent.repaint() 60 times per second, Java was only updating the screen around 2 times per second, whereas the video memory byte array (stores pixel data) that was also updated 60 times per second (before calling repaint) did change every frame.
So my question is: what can I use to display my one-dimension pixel array (using y * width + x to get pixels at a coordinate) and update it at 60fps?
What I need to be able to do:
draw each individual pixel with a set color -draw text with a font and size (the computer I am emulating has a toggle able text-only graphics mode)
efficiency is not a huge concern since the main purpose of this is to test assembly programs that will later run on the physical CPU, but it needs to update the screen at 60 Hertz and run CPU clock cycles at least at 1 kilohertz
scale up the canvas as the cpu only displays at 78 by 128 pixels (I did this in swing by using g2d.fillRect to display pixels and multiplying the arguments by a screen size multiplier integer)