-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.2
-
Fix Understood
-
x86
-
windows_xp
Name: rmT116609 Date: 05/06/2004
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
All OS -
Microsoft Windows XP [Version 5.1.2600]
Linux gaz 2.4.18 #18 SMP Mon Feb 24 11:42:05 EST 2003 i686 unknown
A DESCRIPTION OF THE PROBLEM :
In the page setup tab of the 1.4 Print dialog, there are 4 edit boxes for margin. If you click on the right of the text in any of these edit boxes, the caret always ends up in the far left of the edit box for the first click into the box. Subsequent clicks into an edit box go to the correct location.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Included below is src code to reproduce this problem. Compile it and run it. Click on the page setup tab. Click in any edit box in the page setup tab. Note that the caret always goes to the left no matter where your initial click in the box is.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect the caret to go to the click position.
ACTUAL -
The caret always goes to the left no matter where your initial click in the box is. It is as if the first click is seen merely as a focus event.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import javax.print.*;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import java.awt.print.*;
import java.awt.*;
public class TestPrintDialog {
private JFrame fFrame;
private MyTextArea fTextArea;
public TestPrintDialog()
{
//bring up a 1.4 print dialog for a text area.
fFrame = new JFrame("Text Area");
fTextArea = new MyTextArea("foo bar test\n" +
"foo bar test\n" +
"test test test");
fFrame.getContentPane().add(fTextArea);
fFrame.setSize(200,200);
fFrame.setVisible(true);
print();
}
public void print()
{
DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
final PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
PrintService[] printService = // using pras above causes problems-- no printers returned
PrintServiceLookup.lookupPrintServices(flavor, new HashPrintRequestAttributeSet());
Point location = fFrame.getLocationOnScreen();
PrintService service = ServiceUI.printDialog(null, location.x + 100, location.y + 100,
printService, defaultService, flavor, pras);
}
public class MyTextArea extends JTextArea implements Printable
{
public MyTextArea(String text)
{
super(text);
}
public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException
{
return -1;
}
}
public static void main(String[] args)
{
new TestPrintDialog();
}
}
---------- END SOURCE ----------
(Incident Review ID: 261226)
======================================================================