Details
-
Bug
-
Resolution: Fixed
-
P3
-
7u17
-
b94
-
linux_ubuntu
-
Verified
Description
FULL PRODUCT VERSION :
java version " 1.7.0_17 "
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux jazz 2.6.37.6-0.5-desktop #1 SMP PREEMPT 2011-04-25 21:48:33 +0200 i686 i686 i386 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Does not work on Linux whether new or old, 32-bit or 64-bit.
A DESCRIPTION OF THE PROBLEM :
When running on Linux/Java 7, a java.awt.datatransfer.FlavorListeners *never* receives DataFlavor events. There is no such problem on Linux/Java 6 and also on Windows/Java 7.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
[1] Compile and run the ShowFlavors application (code below) under Linux/Java 7.
[2] Start your Web browser and open a page containing some text and some images.
[3] Select and copy some text.
[4] Select and copy an image.
[5] Select and copy some text.
[6] Select and copy an image.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
During at least steps [3], [4], [5], you should see ``groups of data flavors'' printed in the main window of the ShowFlavors application.
This indicates that the application has been notified that the data flavors available in the clipboard have changed.
ACTUAL -
Nothing is printed in the main window of the ShowFlavors application.
This indicates that the application has *not* been notified that the data flavors available in the clipboard have changed.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import javax.swing.*;
public class ShowFlavors implements FlavorListener {
private JTextArea console;
private int counter;
public static void main(String[] args) {
new ShowFlavors();
}
public ShowFlavors() {
JFrame frame = new JFrame( " ShowFlavors " );
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
// workArea is a JPanel with a BorderLayout.
JPanel workArea = (JPanel) frame.getContentPane();
console = new JTextArea(25, 80);
console.setEditable(false);
JScrollPane scroller = new JScrollPane(console);
workArea.add(scroller);
frame.pack();
frame.show();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
registerListener();
}
});
}
private void registerListener() {
Clipboard clipboard = console.getToolkit().getSystemClipboard();
clipboard.addFlavorListener(this);
}
public void flavorsChanged(FlavorEvent e) {
++counter;
Clipboard clipboard = (Clipboard) e.getSource();
DataFlavor[] flavors = clipboard.getAvailableDataFlavors();
if (flavors != null) {
String separ = " ---[ " + Integer.toString(counter) + " ]---
" ;
console.append(separ);
for (DataFlavor flavor : flavors) {
console.append(flavor.toString() + "
" );
}
console.append(separ);
}
}
}
---------- END SOURCE ----------
java version " 1.7.0_17 "
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux jazz 2.6.37.6-0.5-desktop #1 SMP PREEMPT 2011-04-25 21:48:33 +0200 i686 i686 i386 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Does not work on Linux whether new or old, 32-bit or 64-bit.
A DESCRIPTION OF THE PROBLEM :
When running on Linux/Java 7, a java.awt.datatransfer.FlavorListeners *never* receives DataFlavor events. There is no such problem on Linux/Java 6 and also on Windows/Java 7.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
[1] Compile and run the ShowFlavors application (code below) under Linux/Java 7.
[2] Start your Web browser and open a page containing some text and some images.
[3] Select and copy some text.
[4] Select and copy an image.
[5] Select and copy some text.
[6] Select and copy an image.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
During at least steps [3], [4], [5], you should see ``groups of data flavors'' printed in the main window of the ShowFlavors application.
This indicates that the application has been notified that the data flavors available in the clipboard have changed.
ACTUAL -
Nothing is printed in the main window of the ShowFlavors application.
This indicates that the application has *not* been notified that the data flavors available in the clipboard have changed.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import javax.swing.*;
public class ShowFlavors implements FlavorListener {
private JTextArea console;
private int counter;
public static void main(String[] args) {
new ShowFlavors();
}
public ShowFlavors() {
JFrame frame = new JFrame( " ShowFlavors " );
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
// workArea is a JPanel with a BorderLayout.
JPanel workArea = (JPanel) frame.getContentPane();
console = new JTextArea(25, 80);
console.setEditable(false);
JScrollPane scroller = new JScrollPane(console);
workArea.add(scroller);
frame.pack();
frame.show();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
registerListener();
}
});
}
private void registerListener() {
Clipboard clipboard = console.getToolkit().getSystemClipboard();
clipboard.addFlavorListener(this);
}
public void flavorsChanged(FlavorEvent e) {
++counter;
Clipboard clipboard = (Clipboard) e.getSource();
DataFlavor[] flavors = clipboard.getAvailableDataFlavors();
if (flavors != null) {
String separ = " ---[ " + Integer.toString(counter) + " ]---
" ;
console.append(separ);
for (DataFlavor flavor : flavors) {
console.append(flavor.toString() + "
" );
}
console.append(separ);
}
}
}
---------- END SOURCE ----------
Attachments
Issue Links
- relates to
-
JDK-6538066 XSelection should be more passive
- Closed