Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1091

Re: JFileChooser

From "Hulker69" <hulker69@THRWHITE.remove-dii-this>
Subject Re: JFileChooser
Message-ID <vkfhu2dmt31mbthc4dho2of1th0rgsbjg3@4ax.com> (permalink)
Newsgroups comp.lang.java.gui
References <1172847168.272703.190590@n33g2000cwc.googlegroups.com>
Date 2011-04-27 15:31 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On 2 Mar 2007 06:52:48 -0800, urpriya@gmail.com wrote:

>How can i disable the "File Name" TextFeild in JFileChooser?
>The file name present in the textfeild should not be editable.How can
>i do this?

Try this

((JTextComponent)((Container)((Container)((Container)((Container)getComponent(2)).getComponent(2))).getComponent(2)).getComponent(1)).setEnabled(false);

in constructor of an extension to the JFileChooser class.

It drills down into the component hierarchy of the JFileChooser class
and finds the JTextComponent associated with the File Name. I used jdb
(via Eclipse) to expose these compoents in the Swing classes. Of
course Sun may change the JFileChooser w.r.t. this component hierarchy
in the future, but it works as of JDK 1.6

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

JFileChooser "urpriya" <urpriya@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: JFileChooser "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: JFileChooser "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: JFileChooser "Hulker69" <hulker69@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: JFileChooser "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
      Re: JFileChooser "Dan Andrews" <dan.andrews@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: JFileChooser a24900@googlemail.com.remove-dii-this - 2011-04-27 15:31 +0000

csiph-web