当前位置: 技术问答>java相关
请问各位高人为什么在这里不设置绘画模式为XOR,却还是能够擦除画出的矩形呢?
来源: 互联网 发布时间:2015-09-19
本文导语: 各位网友,大家好: 请各位看一下这段程序代码: import java.awt.*; import java.awt.event.*; import javax.swing.*; class MouseTestPanel extends JPanel implements MouseMotionListener { public MouseTestPanel() { ...
各位网友,大家好:
请各位看一下这段程序代码:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class MouseTestPanel extends JPanel implements MouseMotionListener
{
public MouseTestPanel()
{
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent evt)
{
int x=evt.getX();
int y=evt.getY();
current=find(x,y);
if(current=0 && evt.getClickCount()>=2)
{
//System.out.println(current);
remove(current);
}
}
});
addMouseMotionListener(this);
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
for(int i=0;i
请各位看一下这段程序代码:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class MouseTestPanel extends JPanel implements MouseMotionListener
{
public MouseTestPanel()
{
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent evt)
{
int x=evt.getX();
int y=evt.getY();
current=find(x,y);
if(current=0 && evt.getClickCount()>=2)
{
//System.out.println(current);
remove(current);
}
}
});
addMouseMotionListener(this);
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
for(int i=0;i