Article View: borland.public.jbuilder.java.swing
Article #9945Re: JTextPane: Exception on selection
From: Darko Krsul
Date: Wed, 15 Dec 1999 00:00
Date: Wed, 15 Dec 1999 00:00
118 lines
4651 bytes
4651 bytes
Rich:
Here is complete code of my testing application:
package untitled;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Frame1 extends JFrame {
JTextPane jTextPane1 = new JTextPane();
public Frame1() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Frame1 frame11 = new Frame1();
frame11.setSize(400, 300);
frame11.setVisible(true);
}
private void jbInit() throws Exception {
jTextPane1.setText("jTextPane1");
this.getContentPane().add(jTextPane1, BorderLayout.CENTER);
}
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if(e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
I get the same exception if I click on the caret, if it is at the end of the
text.
Thanks,
D.
Rich Wilkman wrote:
> Darko:
>
> Let's see the contents of jbInit(). This type of error usually is found
> after setting a property incorrectly (and the bean not being graceful
> about the error condition).
>
> -Rich
>
> Darko Krsul wrote:
> >
> > Selecting text inside JTextPane(dragging the cursor) and passing the
> > last character throws following exception:
> >
> > Exception occurred during event dispatching:
> > java.lang.IllegalArgumentException: index 1 >= 1
> > at javax.swing.text.StandardExtendedTextLabel.validate(Compiled Code)
> > at javax.swing.text.StandardExtendedTextLabel.getCharX(Compiled Code)
> > at javax.swing.text.LabelView$LabelFragment.viewToModel(Compiled Code)
> > at javax.swing.text.LabelView.viewToModel(Compiled Code)
> > at javax.swing.text.CompositeView.viewToModel(Compiled Code)
> > at javax.swing.text.BoxView.viewToModel(Compiled Code)
> > at javax.swing.text.CompositeView.viewToModel(Compiled Code)
> > at javax.swing.text.BoxView.viewToModel(Compiled Code)
> > at javax.swing.text.CompositeView.viewToModel(Compiled Code)
> > at javax.swing.text.BoxView.viewToModel(Compiled Code)
> > at javax.swing.plaf.basic.BasicTextUI$RootView.viewToModel(Compiled
> > Code)
> > at javax.swing.plaf.basic.BasicTextUI.viewToModel(Compiled Code)
> > at javax.swing.text.DefaultCaret.moveCaret(Compiled Code)
> > at javax.swing.text.DefaultCaret.mouseDragged(Compiled Code)
> > at java.awt.Component.processMouseMotionEvent(Compiled Code)
> > at javax.swing.JComponent.processMouseMotionEvent(Compiled Code)
> > at java.awt.Component.processEvent(Compiled Code)
> > at java.awt.Container.processEvent(Compiled Code)
> > at java.awt.Component.dispatchEventImpl(Compiled Code)
> > at java.awt.Container.dispatchEventImpl(Compiled Code)
> > at java.awt.Component.dispatchEvent(Compiled Code)
> > at java.awt.LightweightDispatcher.retargetMouseEvent(Compiled Code)
> > at java.awt.LightweightDispatcher.processMouseEvent(Compiled Code)
> > at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
> > at java.awt.Container.dispatchEventImpl(Compiled Code)
> > at java.awt.Window.dispatchEventImpl(Compiled Code)
> > at java.awt.Component.dispatchEvent(Compiled Code)
> > at java.awt.EventQueue.dispatchEvent(EventQueue.java:258)
> > at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
> >
> > Small testing application is created in JBuilder3 by simply adding
> > JtextPane to a JFrame, without any intervention in the code.
> > Is this a bug and what can be done to avoid this?
> >
> > Thanks.
>
> --
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Rich Wilkman
> Quality Assurance
> Borland JBuilder Team
>
> If you see something that looks like an opinion up there,
> it's mine and mine alone.
>
> Mail sent to me from the newsgroups won't bounce but will
> be ignored. If I have time, I'll respond, but you have
> a better chance if you confine your posts to the newsgroups
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID:
<3857EB59.F9A63181@pathcom.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3856B664.DE136E0F@pathcom.com> <3857D0B1.6A82506@inprise.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,90abad8cd4248947 X-Google-Attributes: gid111d45,public From: Darko Krsul <darkok@pathcom.com> Subject: Re: JTextPane: Exception on selection Date: 1999/12/15 Message-ID: <3857EB59.F9A63181@pathcom.com> X-Deja-AN: 561082271 Content-Transfer-Encoding: 7bit References: <3856B664.DE136E0F@pathcom.com> <3857D0B1.6A82506@inprise.com> X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-2 Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing