ArrayIndexOutOfBoundsException when setting visibility to the caret

Hi all,
I made a JTextPane and run into some problems. I get an ArrayIndexOutOfBoundsException when I'm setting it's caret visibility to true and false:
        JEditorPane textPane = new JTextPane;
        // add the textPane to a frame's ContentPane   
     public void test() {
          for(int i = 0; i<100;  i++) {
               testVisibility(true);
               testVisibility(false);
     private void testVisibility(boolean b) {
          // This is were the exception will be thrown if the text pane is visible
          // when making these calls.
          textPane.setEditable(b);
          textPane.getCaret().setVisible(b);
     }The snippet throws an ArrayIndexOutOfBoundsException:
java.lang.ArrayIndexOutOfBoundsException
     at java.lang.System.arraycopy(Native Method)
     at javax.swing.text.BoxView.updateLayoutArray(BoxView.java:197)
     at javax.swing.text.BoxView.replace(BoxView.java:168)
     at javax.swing.text.View.append(View.java:432)
     at javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:412)
     at javax.swing.text.FlowView.layout(FlowView.java:184)
     at javax.swing.text.BoxView.setSize(BoxView.java:379)
     at javax.swing.text.BoxView.updateChildSizes(BoxView.java:348)
     at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:330)
     at javax.swing.text.BoxView.layout(BoxView.java:682)
     at javax.swing.text.BoxView.setSize(BoxView.java:379)
     at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1618)
     at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:946)
     at javax.swing.text.DefaultCaret.setVisible(DefaultCaret.java:952)
     at org.seba.JTextPaneTest.testVisibility(JTextPaneTest.java:38)
     at org.seba.JTextPaneTest.test(JTextPaneTest.java:29)
     at org.seba.JTextPaneTest.main(JTextPaneTest.java:24)

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JTextPane;
public class JTextPaneTest {
     JFrame mainFrame;
     JEditorPane textPanel;
     public JTextPaneTest() {
          textPanel = new JTextPane();
        mainFrame = new JFrame("Test Frame.");
        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainFrame.setSize(640, 480);
          mainFrame.getContentPane().add(textPanel);
          mainFrame.setVisible(true);
     public static void main(String[] args) {
          JTextPaneTest textPaneTest = new JTextPaneTest();
          textPaneTest.test();
     public void test() {
          for(int i = 0; i<100;  i++) {
               testVisibility(false);
               testVisibility(true);
     private void testVisibility(boolean b) {
          // This is were the exception will be thrown if the text panel is visible
          // when making these calls.
          textPanel.setEditable(b);
          textPanel.getCaret().setVisible(b);
}I hope it's ok. You'll have to use Java 5 (1.5.0.11) to compile and run it.
I run into the problem when I made the text pane not editable and the caret was still visible. I needed the caret to hide away too when making the text pane not editable. If I use the setEnabled(boolean) to disable the text pane, all the text is made grey.(I know that there are some methods to make this not happen). I just don't know why this simple test is not working as I would expect.

Similar Messages

  • Power Manager idle timers don't work correctly when set to dim the display in 15 minutes

    Instead of dimming the display to 0 on AC power, Power Manager dims it to 4, which is a normal setting when on DC power. Then when the laptop is resumed by tapping a key, it "restores" the brightness to an incorrect setting of 15, and a few seconds later back to 8, which is the correct setting. I haven't noticed this problem when setting to dim the display below 15 minutes, but the restoration of screen brightness onscreen notification is displayed twice in both cases.

    Hey there lenssd9,
    It seems strange that the Power Manager would be behaving this way, although speaking with some colleagues they also have encountered similar occurences- but instead describing it as if "the engine were warming up with a high idle, and then returning to a standard idle."
    What I can recommend is to first, ensure that your Power Manager Software is up to date. And then try adjusting the configuration within the Power Manager. If you will, see if you encounter this with a idle display under 15 minutes.
    Thank You lnssd9, I look forward to your response.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution".! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.

  • DataGrid when set variableRowHeight=true, the Image in the itemRenderer can't show up

    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=cellrenderer_072_28.html
    the above is the flex example. I did my code almost same as
    this example. But I do different way in renderer code.
    The example:
    <?xml version="1.0"?>
    <mx:HBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    horizontalAlign="center" >
    <mx:Image id="albumImage" height="175"
    source="{data.Cover}"/>
    </mx:HBox>
    My code:
    <?xml version="1.0"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    dataChange="init();">
    <mx:Script>
    <![CDATA[
    public function init():void{
    releasedBox.removeAllChildren();
    if(data.releasedImage){
    var hbox:HBox = new HBox();
    var img:Image = new Image();
    var lbl:Label = new Label();
    img..source = data.Image;
    lbl.text = data.Revision;
    hbox.addChild(img);
    hbox.addChild(lbl);
    releasedBox.addChild(hbox);
    ]]>
    </mx:Script>
    <mx:HBox id="releasedBox">
    </mx:HBox>
    </mx:VBox>
    The different is I add my image in AS code but not in mxml
    code. And the problem is when I set variableRowHeight=true, the
    datagrid can display my label, but image can’t display. And
    when mouse over, the data line is blinking. When you click one
    line, there can show the image for 1 sec.
    If I set variableRowHeight=false. It works fine.
    Anyone knows what’s this problem? Thanks

    Check in the Store menu at the top of your iTunes application on the computer rather than visiting the iTunes Store..

  • HideEffect does not play when setting visible to false

    HY,
    If i set a fade effect on WindowedApplication on hideEffect when i put visible to false, the fade effect does not run anymore. I found this similar problem in the bug tracker: http://bugs.adobe.com/jira/browse/SDK-14615
    I use Flex builder 3 with the sdk 3.2.0, i don't understand why this bug is not resolved at this time.
    thanks for you help

    Hi,
    If you are in a country that permits redownloads, delete track and go to iTunes Store > purchased and redownload. http://support.apple.com/kb/HT2519
    Jim

  • Run time error when set filter on the request id in the output query.

    Hi all,
    I am getting a run time error when I select the request id and set filter on that and  when i am selecting all the request id it contains around 2lacs values in that If i cliked ok on that .
    It popped up a msg like this
    " Run time error 61706
    Insufficient memory to perform operation "

    User was educated not to select the entire data in the filter

  • ArrayIndexOutOfBoundsException when setting a date in a prepared statement

    Hi,
    was wondering if anyone could help. I have a prepared statement, with two "variables" in it. I need to set the first of these to a string (using setString(1, "string)
    and the second to a date, using setDate(2, SQLDate)
    My SQL date is a valid date ass I've run a debugger and checked, but everytime setDate is called an Array Out Of Bound Exception is thrown. Can anyone shed any light on this as I'm rather confused as to why this is happening!
    Thanks in advance

    I havent got a small runnable example to hand, but taking an excert from my code I have:
    for (int i = 0; i < this.columnNames.size();i++)
    singleDateEventFlagSingleArea.setString(1, newAreaName);
    singleDateEventFlagSingleArea.setDate(2, Date.valueOf((String) this.columnNames.get(i)));
    eventFlagsResult = singleDateEventFlagSingleArea.executeQuery()
    }newAreaName is a argument passed to the method. columnNames is a vector of dates/strings, which I parse back into a date to pass to the setDate method
    Where the value of the date in the statement is changed to a preset value each iteration.
    The exception stack I'm getting is:
    exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 1
         at oracle.jdbc.dbaccess.DBDataSetImpl._getDBItem(DBDataSetImpl.java:378)
         at oracle.jdbc.dbaccess.DBDataSetImpl._createOrGetDBItem(DBDataSetImpl.java:781)
         at oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2399)
         at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1134)
         at oracle.jdbc.driver.OraclePreparedStatement.setDate(OraclePreparedStatement.java:2223)
         at treeTableVersion2.TreeTable.updateValuesSingleDateSingleArea(TreeTable.java:393)
         at treeTableVersion2.TestWindow.actionPerformed(TestWindow.java:394)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)Although I think a lot of that is because the process is called by a button press.
    The sql statement thats causing the problem is:
    select h.areaname,
           e.code,
           e.descript,
           ec.date_raised,
           ec.date_progressing,
           ec.date_completed
      from hareas h, evt_type e, evt_core ec
    where h.areaname = ?
       and e.evt_type_id = ec.evt_type_id
       and (h.nblink = ec.area1_nblink or h.nblink = ec.area2_nblink)
       and ec.date_raised = ?
    group by h.areaname,
              e.code,
              e.descript,
              ec.date_raised,
              ec.date_progressing,
              ec.date_completed
    order by h.areanameThanks for your help

  • HT201320 Trying to set up gmail on my iphone 3G, I have an existing Gmail account. when setting up on the iphone it just tells me name or password are not correct.

    I need to set up email on my iphone 3G, I have an existing Gmail account. when i try to set it up on the iphone it just tells me the name or password is incorrect. I have tried this many times and it is not working. All help is appreciated.

    You may need to go here to unlock your account: https://accounts.google.com/b/0/DisplayUnlockCaptcha

  • Multiplot waveform graph plots are different colors when set to be the same with a property node.

    The graphs were working yesterday. I made a few changes to another part of the block diagram and now the graphs do not plot all of the plots the same color. I am using a for loop with a property node with the elements active plot connected to the iteration terminal, and plot color to a color box. My for loop increments programmaticaly from another part of the code to create plots as it runs. I have replaced the graphs with new ones and they will work sometimes.
    I am using Win2k and LV 7.1
    Thanks,
    Brett

    Hi bh3560,
    Have you tried chaging the color by right clicking on the line in the plot legend.  There is an option to change the color of the plot.
    Brian K.

  • Maybe Flex SDK bug: Setting visible of DataGrid item renderers

    Hi all, I'm still a noob at flex but this looks a bit strange to me.
    I've been trying to hide a button renderer in a DataGrid but it just wouldn't hide.  I've been setting visible inside the mxml and also in the the class that extends buttonbut it just wouldn't hide.  I then overloaded the visible property set/get and traced what was setting the property to true and found that inside DataGridBase.as the function setupColumnItemRenderer always sets visible of the renderes to true.
    DataGridBase.as
    protected function setupColumnItemRenderer(c:DataGridColumn, contentHolder:ListBaseContentHolder,
                        rowNum:int, colNum:int, data:Object, uid:String):IListItemRenderer
            var listItems:Array = contentHolder.listItems;
            var item:IListItemRenderer;
            var rowData:DataGridListData;
            item = listItems[rowNum][colNum];
            if (!item || itemToUID(item.data) != uid
                || columnMap[item.name] != c)
                item = createColumnItemRenderer(c, false, data);
                if (item == null)
                    return null;
                if (item.parent != contentHolder)
                    contentHolder.addChild(DisplayObject(item));
                // a space is used if no data so text widgets get some default size
                columnMap[item.name] = c;
                if (listItems[rowNum][colNum])
                    addToFreeItemRenderers(listItems[rowNum][colNum]);
                listItems[rowNum][colNum] = item;
            //[Matt] moved from inside the block above to outside because
            //the item definitely exists at this point, and always needs
            //its data refreshed
            rowData = DataGridListData(makeListData(data, uid, rowNum, c.colNum, c));
            rowMap[item.name] = rowData;
            if (item is IDropInListItemRenderer)
                IDropInListItemRenderer(item).listData = data ? rowData : null;
            item.data = data;
            item.visible = true;
            if (uid && colNum == 0)
                contentHolder.visibleData[uid] = item;
            return item;
    Why does it do this?  Shouldn't it respect the visible property already set for the renderer in mxml and not force it to true on init?

    Renderers use the visible property for recycling.  Invisible renderers are not supported.  The hit detection logic would find it the cell it belongs to even if it was invisible.  You can set alpha=0, but it won't stop the hit detection logic.
    Why are you trying to hide a renderer?
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Report Viewer renders incorrectly when set to "IMAGE"

    I read this;
    http://social.msdn.microsoft.com/Forums/en-US/b4a6eb43-0013-435f-9d11-00ee26a8d017/report-viewer-error-on-export-pdf-or-excel-from-azure-web-sites?forum=windowsazurewebsitespreview
    And after upgrading to "Basic" mode on Azure websites I was able to render PDF, EXCEL and WORD formats.  However when set to IMAGE the rendered binary is entirely black.  No errors are thrown.  The binary contains data (33kB).  I
    have tried changing the deviceInfo settings to include <OutputFormat>JPEG</OutputFormat> and a few other variants.
    I have super verified that when run on my local machine the render works correctly but not on Azure websites.
    I imagine that the class of bug we are dealing with here is a permutation of the API was accidentally not enabled/tested when making the fix for the GDI issue mentioned in the link above.
    This capability is very useful for enabling MVC Restful API's solutions.  I think the business value is very high.  Please help, I figure it will be a quick fix?!

    Thanks for the report.  Can you supply me a sample piece of code that demonstrates the problem, or point me to your web site -> the best way is communicate that is using our new support site. 
    http://azure.microsoft.com/blog/2014/10/08/support-site-extension-for-azure-websites-preview-release/
    Please include enough information so I can repro the scenario myself and see what failed. 

  • After importing images from my card using LR 5.4, the GPS data does not show in the metadata panel. However, when I look at the imported images using Bridge, the GPS data is visible. Anybody know why LR is not seeing the GPS data? Camera is Canon 6D.

    After importing images from my card using LR 5.4, the GPS data does not show in the metadata panel. However, when I look at the imported images using Bridge, the GPS data is visible. Anybody know why LR is not seeing the GPS data? Camera is Canon 6D.

    Ok, the issue seem to be solved. The problem was this:
    The many hundred files (raw and xmp per image) have been downloaded by ftp in no specific order. Means - a couple of files in the download queue - both raw and xmps. Most of the time, the small xmp files have been finished loading first and hence the "last change date" of these xmp files was OLDER than the "last change date" of the raw file - Lightroom then seem to ignore the existence of the xmp file and does not read it during import.(a minute is enough to run into the problem)
    By simply using the ftp client in a way that all large raw files get downloaded first followed by the xmp files, we achieved that all "last changed dates" of the xmp files are NEWER than the related raw files. (at least not older)
    And then LR is reading them and all metadata information has been set / read correctly.
    So this is solved.

  • Files that used to be visible are now hidden in Mavericks. How can I change the setting to view the same files as before? I do not need the hidden files that are typically invisible.

    Files that used to be visible are now hidden in Mavericks 10.9.1. How can I change the setting to view the same files as before? I do not need the hidden files that are typically invisible.
    I am having trouble locating such files as PDF's INDD, AI etc. When I view all hidden files and try to open it in the program..it looks like it is really not on the drive. Has anyone come across a solution?

    You may need to rebuild permissions on your user account. To do this,boot to your Recovery partition (holding down the Command and R keys while booting) and open Terminal from the Utilities menu. In Terminal, type:  ‘resetpassword’ (without the ’s), hit return, and select the admin user. You are not going to reset your password. Click on the icon for your Macs hard drive at the top. From the drop down below it select the user account which is having issues. At the bottom of the window, you'll see an area labeled Restore Home Directory Permissions and ACLs. Click the reset button there. The process takes a few minutes. When complete, restart.   
    Repair User Permissions

  • When I try to iTunes Match I get 'Please Sign In Again' error, I cannot access the songs which are visible in the iCloud in my music library on both iPad and iPhone

    when I try to iTunes Match I get 'Please Sign In Again' error, I cannot access the songs which are visible in the iCloud in my music library on both iPad and iPhone

    Did you try setting itunes to run with administrator privileges? 
    Since I changed that I no longer have this issue

  • My iPhone 5 have the glass popping sound when I press on the top left corner of my phone but I don't know why, I don't see any visibility of the glass coming out. My friends all told me to not exchange.

    My iPhone 5 have the glass popping sound when I press on the top left corner of my phone but I don't know why, I don't see any visibility of the glass coming out. My friends all told me to not exchange because after all the software is perfectly fine.

    My phone just turned 2 months old. But in Singapore as long your phone is under one year warranty I can still go for an exchange at the respective telco, but my friends all suggest me to not change now cause after changing it'll be a refurbished set instead of a brand new one.

  • Setting visible/invisible when menu item is contained/not contained

    Hello All,
    I have a vertical rectangle (the containerButtonsRect) that contains menu items (text). The items slide up and down when using up and down keys. When the items go out the container I want to make them invisible. When they come back in the containerButtonsRect I want to make them visible. The following code does not work:
    override public function create(): Node {
            for (i in [0..sizeof labelButtons - 1]) {
                def menuItem:MenuItem = MenuItem {
                            x: bind containerButtonsRect.x
                            y: bind (containerButtonsRect.y + (i+1)*ySpacing + i*maxButtonHeight)
                            width: bind containerButtonsRect.width
                            height: bind maxButtonHeight
                            content: labelButtons[i]
                            translateY: bind tracker*deltaY
                            visible: bind ((menuItem.y + translateY > containerButtonsRect.y) and ((menuItem.y + translateY + maxButtonHeight) < (containerButtonsRect.y + containerButtonsRect.height)))
                insert menuItem into menuItems;
                if (i == focusedIndexItem) {
                    menuItems[focusedIndexItem].selected = true;
                updateMaxSize(menuItem);
            return Group {
                content: bind [
                    containerButtonsRect,
                    selectionRect,
                    menuItems
        }It is strange that the following line:
    visible: bind ((menuItem.y + translateY > containerButtonsRect.y) and ((menuItem.y + translateY + maxButtonHeight) < (containerButtonsRect.y + containerButtonsRect.height)))does not do the job.
    Is there a better way to set the visible attribute based on the logic described above?
    Thanks.
    Edited by: sacchett88 on Jun 9, 2010 2:10 PM

    Thank for the response.
    The translateY is set to provide vertical motion. A time line is controlling the tracker variable. So when I move arrow up/down the items scroll up/down.
    I agree JavaFX have way complicated the different variables you can set to position components and retrieve width and height. This cause a lot of problems hard to debug.
    Interesting your ideas of setting the clip of the group. I am not to familiar with that attribute as well the description in the docs: http://java.sun.com/javafx/1.3/docs/api/javafx.scene/javafx.scene.Group.html is poor:
    "Specifies a Node to use to define the the clipping shape for this Node."
    Is there any example you could point me out to ?
    Thanks.

Maybe you are looking for

  • HT201317 change order of photos in photo stream album

    How do I change order of photos posted in photo stream album?

  • Any idea why my sent messages are not stored on my Mac?

    When I send mail from my iPhone or iPad, they appear in my sent folder, but not when I send from my MacBook. This even happened when I changed MacBook! Thanks in advance Niall

  • Uninstall leopard on my quicksilver g4 and reinstall tiger

    I have run into serious problems with leopard on my quicksilver mac. I get the kernal panic. I have tried disk warrior and it shuts down.I tried to reinstall tiger, which ran perfectly in the past. It tells me that I have to upgrade panther to 10.3.

  • Release strategy

    Hi all, We have two document types for PO. In one of the document type if user wants to change the PO  once the it is released then system asks user to get the release indicator in Block state & then allows user to change the PO. In another document

  • How to Create a menu for my own project

    I want to create a menu (toolbar like in every software i.e file|edit|view..) for my own project in 8i but i failed to attach that in my project. if some one can tell me how to create and attach my own menu i ll be grateful.