On Wed, 2011-04-13 at 16:54 +0800, Sean Chou wrote: > Hi all, > > > I found a similar bug was reported for JTextArea. > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4512626 > > > That bug is about JTextArea, while this is about TextArea behavior > difference. > > > It seems showing a caret is a general way to address this kind of > accessibility. > So I made a simple patch. > > > diff -r 554adcfb615e src/solaris/classes/sun/awt/X11/XTextAreaPeer.java > --- a/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java Wed Mar 16 > 15:01:07 2011 -0700 > +++ b/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java Fri Mar 18 > 16:31:56 2011 +0800 > @@ -664,6 +664,8 @@ > class XAWTCaret extends DefaultCaret { > public void focusGained(FocusEvent e) { > super.focusGained(e); > + // Make sure the cursor in visible in case of non-editable > TextArea > + super.setVisible(true); > getComponent().repaint(); > } > > > > > 2011/4/1 Sean Chou <[email protected]> > Hi, > I find that if a TextArea is set to un-editable on linux > system, the customer will be > unable to view the focus when the TextArea gets focused(eg. > clicked). On > windows, the cursor is blinking when the un-editable TextArea > get the focus. > So linux users may get confused when trying to move the focus > to the TextArea > because no visible feedback is given. > > > I think it will be better if TextArea behaves the same as > it is on windows. > Here is a simple testcase: > > > import java.awt.TextArea; > import javax.swing.JButton; > import javax.swing.JFrame; > import javax.swing.JPanel; > import javax.swing.JTextArea; > > > public class NonEditable { > public static void main(String[] str) { > JFrame jf = new JFrame(); > JButton jb = new JButton("click"); > JPanel jp = new JPanel(); > jf.setSize(200, 200); > JTextArea jt = new JTextArea(3, 3); > jf.getContentPane().add(jp); > jp.add(jb); > jp.add(jt); > jf.setVisible(true); > jt.setText("hello how r u"); > jt.setEditable(false); > TextArea ta = new TextArea(6, 10); > ta.setText("Rajesh kumar"); > ta.setEditable(false); > jp.add(ta); > } > } > > > > -- > Best Regards, > Sean Chou > > > > > -- > Best Regards, > Sean Chou >
Hi Sean, As your observation is about an AWT object (rather than a Swing one), I think it best to raise this on the 'awt-dev' list. I've cc'd this list so the folk there can consider your suggestion. Regards, Neil -- Neil Richards <[email protected]> IBM
