Does anyone know how to add JTextField
into Graphics name bufferstrategy.getDrawGraphics
?
Tryed to pain it into graphics, something like this:
private JTextField Input = new JTextField();
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
final Graphics gCommands = bs.getDrawGraphics();
Graphics gCC = bs.getDrawGraphics();
Input.requestFocus();
Input.paint(gCC);
Input.setBounds(800,250, 350,20);
Input.setBorder(BorderFactory.createLineBorder(Color.BLACK, 0));
Input.setEditable(true);
Input.setBackground(getBackground());
Input.setForeground(getForeground());
Input.addKeyListener(key);
But, eventhough it displayed, I could not edit it. Even the Input.setBounds(800,250, 350,20)
did not work. This method that is written above, is being called inside a gameloop. Can anyone help me?