🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15679

Re: How can I get the SelectionStart and SelectionEnd of a jComboBox ?

#15679
From: Tor Iver Wilhelmsen
Date: Mon, 10 May 1999 00:00
18 lines
990 bytes
Kopido@fell-edv.de (Ingo Kopido) writes:

> is it possible to get the position of the seletionStart and
> selectionEnd of an jComboBox when it is editable ?

You could try

TextComponent ed = null;
int start = 0;
int end = 0;
try {
  ed = (TextComponent) jComboBox1.getEditor().getEditorComponent();
  start = ed.getSelectionStart();
  end = ed.getSelectionEnd();
}
catch (ClassCastException cce) {
  System.out.println("Oy! Editor isn't a TextComponent! That sucks!");
}
Technical Details
Message-ID: <ubtftuq8q.fsf@sds.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3736af1e.15408926@fellnotes1>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,a2c58e2244f79953
X-Google-Attributes: gidf74b3,public
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Subject: Re: How can I get the SelectionStart and SelectionEnd of a jComboBox ?
Date: 1999/05/10
Message-ID: <ubtftuq8q.fsf@sds.no>
X-Deja-AN: 476137299
Sender: towi@SDSA1761
References: <3736af1e.15408926@fellnotes1>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language