🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9053

Pressing a JFileChooser's buttons

#9053
From: Joi Ellis
Date: Wed, 07 Jun 2000 00:00
33 lines
1641 bytes
I'm trying to write a unit test for a JFileChooser.  I can set the
default file, but I want to be able to automate pressing its 'save'
button.

I tracked the silly button down all the way into 

  javax.swing.plaf.basic.BasicFileChooserUI

which provides a method

  protected  JButton getApproveButton(JFileChooser fc) 

but I haven't figured out how to gain access to the method.
Do I have to subclass JFileChooser, cheat and stick my subclass
into javax.swing.something to muck with it, or can I leave
my subclass in my own package?

Or do I need to subclass BasicFileChooserUI and use setUI() to
get at it?

I've mucked around for several hours and really don't know how to
approach this.  JFileChooser is a rats nest!

Any suggestions?

--
Joi Ellis                    Software Engineer
Aravox Technologies          joi@aravox.com, gyles19@visi.com

No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried.  Anything
that kicks a monopoly in the pants has got to be good for something.
           - Chris Johnson
Technical Details
Message-ID: <393F0D36.EAF4580@aravox.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,f49abd9d7ca919ce,start
X-Google-Attributes: gid111d45,public
From: Joi Ellis <joi@aravox.com>
Subject: Pressing a JFileChooser's buttons
Date: 2000/06/07
Message-ID: <393F0D36.EAF4580@aravox.com>
X-Deja-AN: 632442616
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Aravox Technologies
Mime-Version: 1.0
Reply-To: joi@aravox.com
Newsgroups: borland.public.jbuilder.java.swing