有谁知道如何添加JTextField到图形名称bufferstrategy.getDrawGraphics?试着把它变成图形,如下所示:
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);
Run Code Online (Sandbox Code Playgroud)
但是,尽管它显示,我无法编辑它.即使是Input.setBounds(800,250, 350,20)没有奏效.上面写的这个方法是在游戏循环中调用的.谁能帮我?