public class Drawing extends JPanel {
int Mouse_x = 0, Mouse_y = 0;
@Override
protected void paintComponent(Graphics g) {
// TODO Auto-generated method stub
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
this.setOpaque(true);
this.setBackground(Color.WHITE);
g2.drawString(Mouse_x + "," + Mouse_y, Mouse_x, Mouse_y);
}
}
如何在框架上保存此文本並在需要時清除所有框架。 例如: 如何保持重繪後的圖形g中繪製的文本()
目前還不清楚你問什麼。請更具體地說明目前發生的事情與您希望發生的事情。 – ApproachingDarknessFish
ValekHalfHeart,添加截圖 – user2650128