Re: JTextField - how to disable selecting text in this component?
- From: "mearvk" <mearvk@xxxxxxxxx>
- Date: 29 Dec 2006 04:53:34 -0800
dako wrote:
Brandon McCombs napisal(a):
setEnabled(false) and setEditable(false) are different and
setEditable(false) would be what you want to prevent people from putting
text in it. Disabling the component is done by setEnabled() which wasn't
what Mearvk proposed to you.
Sorry. I forget say I don't want to prevent component from puting text
in it but only whilst selecting text in it. Is it imposible?
Try subclassing JTextField. When the mouseDrag event fires inside the
JTextField do something like return immediately or set the focus on the
parent JComponent. You will want to catch keyboard input also. (Block
things like ctrl+A, ctrl+C, shift+end and shift+home)
I think it can be done but it will require some hacking and time. There
may be a better way but this is what I can figure.
Good luck,
Mearvk
.
- Follow-Ups:
- Re: JTextField - how to disable selecting text in this component?
- From: Andrew Thompson
- Re: JTextField - how to disable selecting text in this component?
- References:
- JTextField - how to disable selecting text in this component?
- From: dako
- Re: JTextField - how to disable selecting text in this component?
- From: mearvk
- Re: JTextField - how to disable selecting text in this component?
- From: dako
- Re: JTextField - how to disable selecting text in this component?
- From: Brandon McCombs
- Re: JTextField - how to disable selecting text in this component?
- From: dako
- JTextField - how to disable selecting text in this component?
- Prev by Date: Java Gui Questions
- Next by Date: Re: JTextField - how to disable selecting text in this component?
- Previous by thread: Re: JTextField - how to disable selecting text in this component?
- Next by thread: Re: JTextField - how to disable selecting text in this component?
- Index(es):