🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Swing JTextField: Focus-Lost-Problem

#11020
From: Robert Schossleitner
Date: Mon, 19 Jul 1999 00:00
18 lines
1077 bytes
Hi,

in my application I have a JTextField in which a timevalue can be entered.
This timestring hat to be checked on leaving the field (by pressing the
TAB or Enter-Key). If the format can not be converted, the focus
should not be handed over to the next contol.

The only way i found to prevent the focus to be changed is throwing a
runtime-exception in the focusLost-Event-Procedure (a consume of the
Focus-Event is not alowed.
The Exception causes the hiding of the caret but the focus stays in the
first field.

Does anybody know a better way to solve this problem?

greetings

Robert
Technical Details
Message-ID: <7mv4v6$esf10@forums.borland.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,d9e76987c762ed78,start
X-Google-Attributes: gid111d45,public
From: "Robert Schossleitner" <srro@ams.stiwa.com>
Subject: Swing JTextField: Focus-Lost-Problem
Date: 1999/07/19
Message-ID: <7mv4v6$esf10@forums.borland.com>
X-Deja-AN: 502691582
Organization: Another Netscape Collabra Server User
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: borland.public.jbuilder.java.swing