Hi,
I have a Text Editor program I am working on. I need to be able to cut, copy, and paste with a right click of the mouse. I have this simple code here which does work:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test100
{
Test100()
{
JFrame theFrame = new JFrame();
theFrame.setSize(200,300);
theFrame.show();
theFrame.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent me)
{
boolean
test = me.isMetaDown();
if (test == true)
{
System.out.println("Meta is Down");
}
}
});
}
public static void main(
String [] args)
{
new Test100();
}
}
However, in my project I have a JTextPane added to a JScrollPane added to a Container added to a JFrame. I try to add the MouseListener to the JFrame and the code compiles but does not work. I have also tried adding the MouseListener to the Container, and that too does not work. Does anyone have any ideas? Thanks in advance!!!