Jcombobox don't refresh the element

When i press on change button, the combo box don't shows the new elements, why?
how i can correct this problem without use the combobox.addItem() method for each element in the arraylist?
package combobox;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class UpdateElement extends JPanel implements ActionListener {
     private static final long serialVersionUID = 1L;
     private ArrayList customerBeanList = null;
     private JComboBox jcb = null;
     public UpdateElement() {
          JFrame f = new JFrame("Test");
          f.getContentPane().setLayout(new FlowLayout());
          f.addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                    System.exit(0);
          customerBeanList = getCustomerBeanListFirst();
          jcb = new JComboBox(customerBeanList.toArray());
          f.getContentPane().add(jcb);
          f.getContentPane().add(createButtonPanel());
          f.pack();
          f.setSize(300, 120);
          f.setVisible(true);
     private ArrayList getCustomerBeanListFirst() {
          customerBeanList = new ArrayList(3);
          customerBeanList.add(new CustomerBean(1, "customer3", "xxx"));
          customerBeanList.add(new CustomerBean(2, "customer2", "yyy"));
          customerBeanList.add(new CustomerBean(3, "customer3", "zzz"));
          return customerBeanList;
     private ArrayList getCustomerBeanListSecond() {
          customerBeanList = new ArrayList(4);
          customerBeanList.add(new CustomerBean(23, "customer9", "aaa"));
          customerBeanList.add(new CustomerBean(36, "customer10", "bbb"));
          customerBeanList.add(new CustomerBean(67, "customer11", "ccc"));
          customerBeanList.add(new CustomerBean(41, "customer12", "dd"));
          return customerBeanList;
     public static void main(String s[]) {
          new UpdateElement();
     private JPanel createButtonPanel() {
          JButton changeJB = new JButton("Change");
          changeJB.addActionListener(this);
          JPanel panel = new JPanel();
          panel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
          panel.add(changeJB);
          return panel;
     public void actionPerformed(ActionEvent e) {
          customerBeanList = getCustomerBeanListSecond();
          jcb = new JComboBox(customerBeanList.toArray());
}

jcb = new JComboBox(customerBeanList.toArray());This creates a new combobox, but you didn't add it to the GUI.
The easiest way is to create a new model and then reset the model of the existing combobox:
ComboBoxModel model = new DefaultComboBoxModel( customerBeanList.toArray() );
comboBox.setModel( model );

Similar Messages

  • Refresh the elements on screen

    Hello,
    I have added lines to JTextArea.
    I want, that when the program is bussy,
    I still see the changes on the JTextArea.
    I have tested :
    repaint(), invalidate(), validate()
    (I don't know what is the different).
    but the changes are not seen on screen.
    Thanks :)

    Here's an example
    * ThreadTest.java
    * Created on 31 August 2007, 14:32
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    /** @author amalcolm */
    public class ThreadTest extends JFrame
        private JTextArea m_textArea=new JTextArea();
        public ThreadTest()
            setSize(300,300);
            setTitle("Thread Test");
            setVisible(true);
            add(m_textArea);       
            Thread thread=new Thread(new Runnable()
               public void run()
                   while(!Thread.interrupted())
                        m_textArea.setText(m_textArea.getText()+System.currentTimeMillis()+"\n");
                        try
                            Thread.sleep(1000);
                        catch (InterruptedException ex)
                            ex.printStackTrace();
            thread.setDaemon(true);
            thread.start();
        public static void main(String[] args)
            new ThreadTest();       
    }

  • LiveOffice don't refreshes the data

    Hello,
    I have several reports (crystal and xcelsius) which use LiveOffice connections to import the data from the crystal reports. That works fine at first..
    For instance my crystal report has 3 optional parameters -> plant, date and cw.
    The User can input the plant and the date in  the first report and in the second report he can input  plant and cw.
    When I first create the report I add the crystal report with live office and map the input parameter to excel cells, the data imported properly. Then I set up the LiveOffice Connection in the Data Manager and fill out the needed parameters.
    Now I start the report in preview and it works great, uploading it to Enterprise and run it over a Dashboard works even great...
    BUT
    Now I need a second xcelsius report in which the user can select the calendar week! I took my old report and change the live office parameter to use my cell with the CW and deleted the date (because its optional for the crystal report).
    The Data regeneration starts and every looks fine, I can change the week and the data updates to the right values.. but if I now start in preview I have the false data! I get data from the old selected day.. and not the given week and if I save and close and reload the report the cell reference for my parameter cw is deleted (in live office object properties).
    I can set up what I want, I can delete the report, reimport and take the right settings.. nothing helps at all! I must open a complete new Xcelsius Report and import my crystal reports and connections from the beginning and need to redo my design over and over for every live office change!
    I've tried so many options but nothing helps, it seems to be a Xcelsius bug and I'm not alone with this, in other forums there a several topics about this problem.
    I use BO 2008 SP3 and Xcelsius with HotFix 3, (I also tested without a hotfix) and
    business objects live office XI 3.1
    All other Reports work perfect and I never had this problem before but I'm very scared to change connections of one of the working reports. My current report is rebuild in 30min because itu2019s very simple, but there are some reports that will take hours or days to rebuild! 
    It would be nice if someone has a workaround for this or can confirm this bug.

    If you are using BO XI 3.1 SP3 on the server side you should make sure that you are using LiveOffice XI 3.1 WITH SP3 also on your client (ie. the machine your XCelsius designer runs on).
    In the case that additional patches (eg. Fix Pack 3.2) are installed on the server, make also sure to update your client.
    SAP recommends to have the same patch level on the server and on your client. My experience is that LiveOffice's behaviour  can be affected even from slight differences in the patch level.
    Regards,
    Stratos

  • ReturnToPortal() doesn't refresh the portal page

    In the community preference page, when finishing changing the preference, calling IPortletResponse.ReturnToPortal() closed the preference page but didn't refresh the portal page. What needs to be done to refresh the portal page so the portlet can be refreshed with the new pref data?
    ALUI 6.1MP1.
    TIA!

    This is why it doesn't work...
    There is a bug that I filed for this, basically that icon on the portlet header works for user and admin preferences... it make sense to add community preferences there too to make it all consistent.
    The problem is: community preferences behaved differently.. in 5.x, the only way to edit them was to go through edit this community... the refresh mechanism is built into the community editor.
    In g6 that didn't change... you still need to go through that route to actually update the portal with the new preferences. going through the icon does nothing. user and admin prefs will work b/c they also worked like that in 5.x.
    Basically, it's a bug b/c community prefs never worked like that... adding it to the button promoted the sense that it should work, which it never did...
    so you have to go through the edit this community route to make it refresh.

  • When I place a post on facebook it disappears when I go back in to check on it. My friend told me to refresh the page but I don't know how to do that.

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [/forum/1/675115]
    Thanks - c</blockquote>
    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    My post on facebook disappear. My friend told me to try refreshing the page but I don't see a refresh button. How can I do this?
    == This happened
    ==
    A few times a week
    == when i began posting on facebook
    ==
    == Troubleshooting information
    ==
    none
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows XP
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
    == Plugins installed
    ==
    *-getplusplusadobe16249
    *nphpclipbook
    *DivX Web Player
    *Office Plugin for Netscape Navigator
    *Adobe Shockwave for Director Netscape plug-in, version 10.2
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Coupons, Inc. Coupon Printer DLL
    *Adobe PDF Plug-In For Firefox and Netscape
    *Default Plug-in
    *Shockwave Flash 10.0 r45
    *iTunes Detector Plug-in
    *Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
    *Next Generation Java Plug-in 1.6.0_17 for Mozilla browsers
    *Npdsplay dll
    *DRM Store Netscape Plugin
    *DRM Netscape Network Object

    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    Some users have reported as many as 8 or 9 attempts were necessary before success.
    If the issue persists...
    Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

  • Strategy 92 don't consumption the Pir for WBS element

    Dear Gurus,
    i insert in the material master MRP3 the group strtegy 92 (Planning with final assembly).
    After we insert in the MD61 the planned indipendent requierement whit the transaction MD61 and
    we set the field "Acct Asst Cat" = Q and the insert the WBS Element.
    After when whit the transaction VA01 we create the sale order position whit the same WBS element the system
    don't consumption the Pir , but propose the double quantità to product.
    I need use the WBS element in the Pir and in the Sale order but i need to consuption the Pir quantity whit the sale order quantity.
    There is the customizing settinG?
    Thanks a lot
    Daniele PIstilli
    PP TEAM

    HI,
    Check your planning strategy 92 in 
    IMG>production>production planning>demand management>PIR-->Planning startergy-> Define stratergy
    Check for your Strategy 92
    Reqmt type of independent reqmts
    Is consumption  is set as 1?
    and also check
    Reqmt type of customer reqmts
    is Allocation Indicator is set as 1?
    IF Not
    maintain in OVZG for your Requirement Class specified in strategy for customer requirement
    for PIR Requirement Class maintain the setting In OMPO

  • Where is the Log and why my Variables don't refresh?

    Hi everyone!
    My first question is:
    The log of the ODI, where is it? Not the logs of the executions or the Scenarios, when or who, by example: The Odi save when me "SUPERVISOR" start a session, or, if me "SUPERVISOR" delete a commponent, or, the ODI try to connect a database, or something like this, i was explain my point??
    The other question is:
    My Varibles don't take their value, when i create a new one, refresh and choose the agent, and then, have nothing, miss the value, example:
    I have this instruction, i use any database (ORACLE 11g):
    SELECT 'sysdate' FROM DUAL;
    When i refresh the variable the result is this:
    SELECT '' FROM DUAL;
    The same behavior happens when use JAVA instruction, i try many things, but i can't resolved the problem, check my enviroment variables, the ODIPARAMS, reainstalling JAVA...

    Hello,
    You right, but the log of the executions is not that i want, the log of the application himsefl, because, the log only save a part of all operation i found logs, but doesn't me something about the actions, i want the behavior of ODI, the reason why is 'cause this do things that i can't explain, one of thoose causes is the many repetitions of sessions, the log only shows that X scenario starts many times but not why, i hope explain myself.
    The other part ... I have two enviroments, one of thoose works perfectly with my variables, but the other one not, i export and import the work and master repository from the first to the second enviroment, but can't work. You say that i will declare and refresh my variable from the package, on the tab behind, i do that but nothing happen, my variable can't be a global variable because it works from the begin, any idea?

  • I am a subscriber of Adobe Creative Cloud, - but I don't see the program Photoshop Elements?

    I am a subscriber of Adobe Creative Cloud, - but I don't see the program Photoshop Elements?
    Where can I find it?

    Hi Haneadino,
    Photoshop Elements is not a part of Creative Cloud. You can download the trial version of Photoshop Elements 12 from the below link.
    http://www.adobe.com/cfusion/tdrc/index.cfm?product=photoshop_elements&loc=us
    Thank you for posting on Adobe Forums.

  • I have Elements 10, Lightroom 5 and PS6.  My mac is saying its "running at or near capacity".  i suspect the problem is the Elements organizer, 875 MB, and I don't believe I can import it into my LR catalogue which is on an external drive.  Any suggestion

    If helpful, here is some additional info:
    I am running OSX version 10.9.4, with 8 GB of memory.

    I don't remember how big mine was, but I had loads of pictures in Elements so I guess it should work anyway -- so I'd first try to convert the full catalog, even if it takes some time.
    If this really is a problem I'd suggest you break up your Elements catalog into two or more smaller ones -- I remember Elements getting a nuisance with big catalogs.
    Btw.: I have the LR catalog on the internal drive, pictures and backups on two external drives. As long as I don't have the money for a big external SSD I think I will keep it that way (my machine is an iMac 21.5 8GB)

  • I am forced to hold shift and refresh the page on 99% of the sites I visit. How do I fix this from happening? If I don't the pages are missing style sheets and etc.

    When ever I go to sites they half load or are missing style sheets. If I view the source for the page and click on a style sheet link I get the following error:
    Content Encoding Error
    The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
    If I hold shift and refresh the page loads as normal.
    It's happening on 99% of the sites I visit. I have disabled my plugins and add-ons.
    I do have some add-ons or plugins that I would like to remove completely but there is no uninstall or remove option, neither in regular or safe mode.

    '''I'm NOT buying a backup Computer till, Firefox will Run on Windows 8 !'''

  • Problem in refreshing the data of the UI element Table

    Hi Experts,
    I am having a problem.
    I have a screen which displays list of variants in table ( variant name , variant desc )
    I am binding the entries of table in WDDOINIT method.
    but when i go back to selection screen view and come back to display variants view, WDDOINIT is not triggering.
    Now if i move the code written in WDDOINIT method to WDDOMODIFYVIEW method, its not retaining the lead selection as the binding happens on every server round trip. if i check with First_time = 'X'. its same as that of having it in WDDOINIT method.
    How do i overcome this problem of refreshing the table data.
    any clue is highly appreciated.
    Regards,
    Ajay

    hi Ajay ,
    create a custom controller for this and when u want to move from selection screen view to display variant ,
    call method of this custom controller
    DATA lo_edit TYPE REF TO ig_edit .
    lo_edit =   wd_this->get_edit_ctr( ).
      lo_edit->edit1(
    here I am calling the edit1 method of my custom controller named EDIT.
    try to move code of ur WDDOINIT here.
    it shud help
    rgds,
    amit

  • How do I make an embedded Javascript element(embedded MS Excel chart) automatically refresh so that viewers do not have to refresh the entire page to get updated information.

    I am creating a web page that features an embedded chart made by MS Excel. I would like the chart to automatically update(refresh) to show viewers live information without having to refresh the entire page. I have found that there is a way to enable this through Excel but with my current subscription cannot access that feature. I am hoping that there is a way to achieve this using Adobe Muse CC. If it is not possible, I would like to know if there is a way to add a "refresh" button that refreshes only the embedded section(Excel Chart) of the page for viewers to use manually. Thank you for your help.

    Update! The embedded spreadsheet is actually embedded using HTML rather than javascript.

  • Somehow, my Referer Header got set to zero, and I'm trying to set it back to 1 or 2, but I don't know how to make it stay like that. Every time I refresh the page, it goes back to zero! Please help!

    Somehow, my Referer Header settings got set to 0 (zero). Because of this, I'm getting an error message on certain sites. I found out that I could reset it to 1 (one) or 2 (two) if I browsed to about:config and typed in the new value, but it doesn't seem to be working. I'm not sure how to "save" this setting, and ever time I refresh the about:config page the setting goes back to zero. Plus, I'm still getting the error messages on the sites I was having trouble with.

    You need to connect the iPod to your computer with iTunes and then restore the iPod via iTunes on the computer.
    Also see:
    http://www.apple.com/support/ipodtouch/getstarted/

  • How to change the Element structure of a DefaultSyledDocument

    Hello,
    I'm trying to override the insertUpdate method of DefaultStyledDocument so that I could build my own Element structure by adding my own BranchElement- and LeafElement-s. If I examine the Element hierarchy everything seems OK. But when I use my document in a JTextPane. I get the error Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location (I add the whole dump at the end of this message), whenever I add a new line to the document (to test this compile and run the included code and press then newline after the 'He' in 'Hello'. I suspect that the error is caused by the fact that the view hierarchy is not updated correctly but I'm not sure. To be honest I have searched for a while for some example code, explaning how you can make your own element hierarchy in a DefaultStyledDocument (without using ElementBuffer), but to no avail.
    Can any of the Text gurus here shed some lights on my code and see what is wrong with it or point me to some example code.
    Thanks a lot in advance.
    Marc Mertens
    Full Stack Dump
    Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
    at javax.swing.text.GlyphView.getText(GlyphView.java:117)
    at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:43)
    at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:537)
    at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:689)
    at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:216)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
    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.getPreferredSize(BasicTextUI.java:812)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
    at javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1227)
    at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
    at java.awt.Container.layout(Container.java:1401)
    at java.awt.Container.doLayout(Container.java:1390)
    at java.awt.Container.validateTree(Container.java:1473)
    at java.awt.Container.validate(Container.java:1448)
    at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:379)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:113)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    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)
    Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
    at javax.swing.text.GlyphView.getText(GlyphView.java:117)
    at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:43)
    at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:537)
    at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:689)
    at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:216)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
    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.repaintNewCaret(DefaultCaret.java:1246)
    at javax.swing.text.DefaultCaret$1.run(DefaultCaret.java:1225)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    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)
    Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
    at javax.swing.text.GlyphView.getText(GlyphView.java:117)
    at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:43)
    at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:537)
    at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:689)
    at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:216)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
    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 javax.swing.text.DefaultCaret.focusLost(DefaultCaret.java:347)
    at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:172)
    at java.awt.Component.processFocusEvent(Component.java:5380)
    at java.awt.Component.processEvent(Component.java:5244)
    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.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1810)
    at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:840)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:530)
    at java.awt.Component.dispatchEventImpl(Component.java:3841)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.SentEvent.dispatch(SentEvent.java:50)
    at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:161)
    at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:188)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:595)
    at java.awt.Component.dispatchEventImpl(Component.java:3841)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Window.dispatchEventImpl(Window.java:1778)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.SequencedEvent.dispatch(SequencedEvent.java:93)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    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)
    java.lang.ThreadDeath
    at java.lang.Thread.stop(Thread.java:698)
    at java.lang.ThreadGroup.stopOrSuspend(ThreadGroup.java:671)
    at java.lang.ThreadGroup.stop(ThreadGroup.java:584)
    at org.netbeans.core.execution.DefaultSysProcess.stop(DefaultSysProcess.java:54)
    at org.netbeans.core.execution.ProcessNodeItem$1.stop(ProcessNodeItem.java:41)
    at org.netbeans.core.execution.ProcessNodeItem$TerminateProcessAction.performAction(ProcessNodeItem.java:69)
    at org.openide.util.actions.NodeAction$3.run(NodeAction.java:531)
    at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:47)
    at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:527)
    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.AbstractButton.doClick(AbstractButton.java:302)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
    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:1778)
    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)
    package Document;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import javax.swing.text.AbstractDocument.*;
    * EditorDocument.java
    * Created on September 10, 2006, 3:58 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    * Document to represent the content of a syntax highlighting editor
    * @author marc
    public class EditorDocument extends DefaultStyledDocument {
        /** List of the white space characters */
        private char[] _whiteSpaceChars;
        /** List of the delimiter characters */
        private char[] _delimiterChars;
        /** Creates a new instance of EditorDocument */
        public EditorDocument(char[] whiteSpaceChars,char[] delimiterChars) {
            _whiteSpaceChars=whiteSpaceChars;
            _delimiterChars=delimiterChars;
         * Updates document structure as a result of text insertion.  This
         * will happen within a write lock.  Since this document simply
         * maps out lines, we refresh the line map.
         * @param chng the change event describing the dit
         * @param attr the set of attributes for the inserted text
        protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr) {
            int begin=Math.max(0,chng.getOffset()-1);
            int end=begin+chng.getLength()+1;
            Element rootElement=getDefaultRootElement();
            int index;
            int m=rootElement.getElementCount();
            AbstractDocument.BranchElement line;
            super.insertUpdate(chng,attr);
            // Add the tokens
            index=rootElement.getElementIndex(begin);
            m=rootElement.getElementCount();
            if (index>=0)
                for (;index<m && (line=(AbstractDocument.BranchElement) rootElement.getElement(index)).getStartOffset()<=end;index++) {
                chng.addEdit(addTokens(line,attr));
            //fireChangedUpdate(chng);
        protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng,AttributeSet attr) {
            int begin=chng.getOffset();
            int end=begin+chng.getLength();
            BranchElement root=(BranchElement) getDefaultRootElement();
            // Find the lines that must be removed
            int indexFirstLine=root.getElementIndex(begin);
            int indexLastLine=root.getElementIndex(end);
            BranchElement[] removeLines=new BranchElement[indexLastLine-indexFirstLine+1];
            for (int i=indexFirstLine;i<=indexLastLine;i++)
                removeLines=(BranchElement) root.getElement(i);
    // Add the lines must replace the removed lines
    int beginFirstLine=removeLines[0].getStartOffset();
    int endLastLine=removeLines[removeLines.length-1].getEndOffset();
    Segment segment=new Segment();
    ArrayList<BranchElement> newLines=new ArrayList<BranchElement>(removeLines.length); // Guess the length of the new lines
    try {
    getText(beginFirstLine,endLastLine,segment);
    char c=segment.current();
    BranchElement line;
    while (c!=Segment.DONE) {
    if (c=='\n') {
    line=new BranchElement(root,attr);
    newLines.add(line);
    addTokens(line,attr,beginFirstLine,segment.getIndex()+1);
    beginFirstLine=segment.getIndex()+1;
    c=segment.next();
    if (beginFirstLine<endLastLine) {
    line=new BranchElement(root,attr);
    newLines.add(line);
    addTokens(line,attr,beginFirstLine,endLastLine);
    // Add the lines to the Root element
    BranchElement[] linesAdded=newLines.toArray(new BranchElement[newLines.size()]);
    root.replace(indexFirstLine,indexLastLine-indexFirstLine+1,linesAdded);
    // Notify listeners
    DefaultDocumentEvent edit=new DefaultDocumentEvent(begin,end-begin,DefaultDocumentEvent.EventType.CHANGE);
    edit.addEdit(new ElementEdit(root,indexFirstLine,removeLines,linesAdded));
    fireChangedUpdate(edit);
    } catch (Exception e) {
    throw new EditorException("Error in insertUpdate, message was "+e.getMessage(),e);
    //super.insertUpdate(chng,attr);
    private void addTokens(AbstractDocument.BranchElement line,AttributeSet attr,int begin,int end) {
    try {
    ArrayList<TokenElement> childTokens=new ArrayList<TokenElement>();
    int strLength=end-begin;
    // Create the new tokens
    Segment segment=new Segment();
    getText(begin,end-begin,segment);
    char c;
    int b=0;
    TokenElement token;
    //System.out.println(str);
    c=segment.current();
    while (c!=Segment.DONE) {
    if (isWhite(c)) {
    // Whitespace character
    if (b<segment.getIndex()) {
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),false);
    childTokens.add(token);
    b=segment.getIndex();
    // Find all the white spaces
    while ((c=segment.next())!=Segment.DONE && isWhite(c));
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),true);
    childTokens.add(token);
    b=segment.getIndex(); // Begin of next token
    } else if (isDelimiter(c)) {
    // Delimiter
    if (b<segment.getIndex()) {
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),false);
    childTokens.add(token);
    token=new TokenElement(line,attr,begin+segment.getIndex(),begin+segment.getIndex(),c);
    childTokens.add(token);
    b=segment.getIndex();
    c=segment.next();
    } else {
    c=segment.next();
    if (b<segment.getIndex()) {
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),false);
    childTokens.add(token);
    Element[] removed=new Element[line.getElementCount()];
    for (int i=0;i<removed.length;i++)
    removed[i]=line.getElement(i);
    TokenElement[] newElements=childTokens.toArray(new TokenElement[childTokens.size()]);
    line.replace(0,line.getElementCount(),newElements);
    } catch (Exception e) {
    throw new EditorException("Unexpected BadlocationException ");
    * Returns a iterator of the tokens starting from the given position
    * @param The position that is covered by the first token returned by this iterator
    * @return A iterator of all the tokens starting at the given position
    public Iterator<IToken> getTokensFrom(int position) {
    return new TokenIterator(position);
    private String getText(Element element) {
    int begin=element.getStartOffset();
    int end=Math.min(element.getEndOffset(),getLength());
    try {
    return getText(begin,end-begin);
    } catch (BadLocationException e) {
    throw new EditorException("Unexpected BadLocationException (this should not happen at all)");
    * Check if a character is a white space
    * @return True if a character is a white space
    private boolean isWhite(char c) {
    if (c=='\n') // End of line is always a white space
    return true;
    for (char whiteChar : _whiteSpaceChars)
    if (whiteChar==c)
    return true;
    return false;
    * Check if a character is a delimiter character (different from a white space character)
    * @return True if a character is a delimiter character
    private boolean isDelimiter(char c) {
    for (char delimiterChar : _delimiterChars)
    if (delimiterChar==c)
    return true;
    return c=='\0';
    * Test code
    public static void main(String[] args) {
    // Display a test frame containing a test document
    try {
    JFrame frm=new JFrame();
    EditorDocument doc=new EditorDocument(new char[] {' ','\n','\t','\r'},new char[0]);
    doc.insertString(0,"Hello",null);
    JTextPane pane=new JTextPane(doc);
    JScrollPane scroll=new JScrollPane(pane);
    frm.getContentPane().add(scroll);
    frm.setSize(200,300);
    frm.setVisible(true);
    } catch (Exception e) {
    * Class that is a iterator over the tokens in the document
    private class TokenIterator implements Iterator<IToken> {
    private int _lineIndex=-1;
    private int _tokenIndex=-1;
    public TokenIterator(int position) {
    AbstractDocument.BranchElement root=(AbstractDocument.BranchElement) getDefaultRootElement();
    _lineIndex=root.getElementIndex(position);
    AbstractDocument.BranchElement line=(AbstractDocument.BranchElement) root.getElement(_lineIndex);
    _tokenIndex=line.getElementIndex(position)-1;
    * Removes from the underlying collection the last element returned by the
    * iterator (optional operation). This method can be called only once per
    * call to <tt>next</tt>. The behavior of an iterator is unspecified if
    * the underlying collection is modified while the iteration is in
    * progress in any way other than by calling this method.
    * @exception UnsupportedOperationException if the <tt>remove</tt>
    *           operation is not supported by this Iterator.
    * @exception IllegalStateException if the <tt>next</tt> method has not
    *           yet been called, or the <tt>remove</tt> method has already
    *           been called after the last call to the <tt>next</tt>
    *           method.
    public void remove() {
    // Do nothing
    * Returns the next element in the iteration. Calling this method
    * repeatedly until the {@link #hasNext()} method returns false will
    * return each element in the underlying collection exactly once.
    * @return the next element in the iteration.
    * @exception NoSuchElementException iteration has no more elements.
    public IToken next() {
    Element root=getDefaultRootElement();
    if (_lineIndex>=root.getElementCount())
    return null;
    Element line=root.getElement(_lineIndex);
    _tokenIndex++;
    if (_tokenIndex>=line.getElementCount()) {
    _lineIndex++;
    if (_lineIndex>=root.getElementCount())
    return null;
    line=root.getElement(_lineIndex);
    if (line.getElementCount()==0)
    return null;
    _tokenIndex=0;
    return (IToken) line.getElement(_tokenIndex);
    * Returns <tt>true</tt> if the iteration has more elements. (In other
    * words, returns <tt>true</tt> if <tt>next</tt> would return an element
    * rather than throwing an exception.)
    * @return <tt>true</tt> if the iterator has more elements.
    public boolean hasNext() {
    int lineIndex=_lineIndex;
    int tokenIndex=_tokenIndex;
    Element root=getDefaultRootElement();
    if (lineIndex>=root.getElementCount())
    return false;
    Element line=root.getElement(lineIndex);
    tokenIndex++;
    if (tokenIndex>=line.getElementCount()) {
    lineIndex++;
    if (lineIndex>=root.getElementCount())
    return false;
    line=root.getElement(lineIndex);
    if (line.getElementCount()==0)
    return false;
    return true;
    * Represents a token in the document
    private class TokenElement extends AbstractDocument.LeafElement implements IToken, Comparable<TokenElement> {
    private boolean _isWhiteSpace;
    private char _separatorChar='\0';
    public TokenElement(Element parent,AttributeSet attributeSet,int offs0,int offs1,boolean whiteSpace) {
    super(parent,attributeSet,offs0,offs1);
    _isWhiteSpace=whiteSpace;
    public TokenElement(Element parent,AttributeSet attributeSet,int offs0,int offs1,char separatorChar) {
    super(parent,attributeSet,offs0,offs1);
    _separatorChar=separatorChar;
    * Returns the separator character if this token is a separator, returns '\0' otherwise
    * @return The separator charactor or null otherwise
    public char getSeparatorChar() {
    return _separatorChar;
    * Compares this object with the specified object for order. Returns a
    * negative integer, zero, or a positive integer as this object is less
    * than, equal to, or greater than the specified object.<p>
    * In the foregoing description, the notation
    * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical
    * <i>signum</i> function, which is defined to return one of <tt>-1</tt>,
    * <tt>0</tt>, or <tt>1</tt> according to whether the value of <i>expression</i>
    * is negative, zero or positive.
    * The implementor must ensure <tt>sgn(x.compareTo(y)) ==
    * -sgn(y.compareTo(x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This
    * implies that <tt>x.compareTo(y)</tt> must throw an exception iff
    * <tt>y.compareTo(x)</tt> throws an exception.)<p>
    * The implementor must also ensure that the relation is transitive:
    * <tt>(x.compareTo(y)>0 && y.compareTo(z)>0)</tt> implies
    * <tt>x.compareTo(z)>0</tt>.<p>
    * Finally, the implementer must ensure that <tt>x.compareTo(y)==0</tt>
    * implies that <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for
    * all <tt>z</tt>.<p>
    * It is strongly recommended, but <i>not</i> strictly required that
    * <tt>(x.compareTo(y)==0) == (x.equals(y))</tt>. Generally speaking, any
    * class that implements the <tt>Comparable</tt> interface and violates
    * this condition should clearly indicate this fact. The recommended
    * language is "Note: this class has a natural ordering that is
    * inconsistent with equals."
    * @param o the Object to be compared.
    * @return a negative integer, zero, or a positive integer as this object
    *           is less than, equal to, or greater than the specified object.
    * @throws ClassCastException if the specified object's type prevents it
    * from being compared to this Object.
    public int compareTo(TokenElement o) {
    return getStartOffset()-o.getStartOffset();
    * Indicates this is a white space token
    * @return true if this is a white space token false otherwise
    public boolean isWhiteSpace() {
    return _isWhiteSpace;
    * Returns the string this token is representing
    * @return The string behind this token
    public String getText() {
    return EditorDocument.this.getText(this);
    class SearchToken implements IToken {
    private int _offset;
    public SearchToken(int offset) {
    _offset=offset;
    * @return The start of the token used in comparisation operations
    public int getEndOffset() {
    return _offset;
    public int getStartOffset() {
    return _offset;
    public boolean isWhiteSpace() {
    throw new EditorException("May not be called");
    public String getText() {
    throw new EditorException("May not be called");
    public char getSeparatorChar() {
    throw new EditorException("May not be called");

    I am trying to add primitive syntax highlighting to my JTextPane and have serious problems which I already stated in this forum. Now I read from uncle_alice that the text package from swing is not ment for that and that I need to write my own JTextPane and my own document and view.
    Can you explain what you mean by "writing my own JTextPane and View and Dcoument".
    My own Document I already have in order to provide SQL-highlighting.
    But what exactly do you mean by suggesting to write my own View! Whoever uses JTextPane doesnt really have much to do with its view. Can you give me a hint as I am completely stuck with an Exception : "javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Length must be positive"
    can you pinpoint the standard text-package's deficiency? it lacks what? what is the best work around?
    cheers
    ioannis

  • Error while refreshing the BO WebI report

    Dear Friends,
    I have created BO report on top of BICS Query in BO 4.0(have used aroung 15 BICS queries in to the report) and able to see the correct data.
    I have used hierarchies and also selected levels in to webI report. Last week I am able to refresh the report but since two days I am getting some strange errors.
    Errors:
    1) Unable to run the empty Query.
    2) When trying to invoke the method com.sap.ip.bi.bics.dataacess.consumer.queryview.results.et.IRsAxisTupleelement.Getcharateristicmember() of an object loaded from Local Variable 'element'(WIS00000)
    Can you please help me on this isse.
    Regards,
    Eswar

    Hi,
    Was there any recent Patch up/downgrade done in your environment?
    What is the current Patch level?
    Also, did you get a chance to look into the Fixed Issue ADAPT01626356?
    Regards,
    Muthulakshmi Ramanathan

Maybe you are looking for