JTabbedPane : Wrong tab is updated

Hi,
I have a JTabbedPane, which has tabs that are added when an user selects a tree-node. Each tab has a split-pane where the top has a few text fields where criteria is entered, and the bottom displays a JTable with respective information. The JTable has a model associated with it.
Now, if i open Tab1 and enter some criteria press OK, the table is shown. I then open Tab2 enter some-other criteria and press OK, a table is displayed and data is shown. NOW i go BACK to TAB1 and enter criteria in the Tab1 criteria field and press OK, i expect that the table on TAB1 is updated, BUT the table on TAB2 is updated!!!!
JtabbedPane
--> addTab( )
--> the split pane is added to the JPanel and then the OkButton is added with its own okAction that goes with it.
--> this okAction calls a model associated with it, which inturn adds data and the JTable to the split pane in the tab.
What i think is happening is that when i go back to a previuosly opened tab,the focus is still on the last tab opened! may be i am wrong, i cant seem to understand why this is happening...
any idea, pointers, or an example on the same lines would help.
thank you,
-U

Hi,
Thank You for trying to help...
I recreate the whole table allover again I KNOW it is a waste and i should do it in a better fashion, your question just enlightened me to this fact.
The code you asked for is below, let me know what i can do differently.
Thank You!
public void addTab(String transName, String[] criteria) {
          this.transType = transName;
          AppendDataModel appModel = new AppendDataModel(this);
          this.okAction = new OkAction(appModel);
          addTab(transName, null, addInfoToTab(transName, criteria, appModel), criteria[0]);
private Component addInfoToTab(String transactionType, String[] criteria, AppendDataModel appModel){
          JPanel criteriaPanel = new JPanel();
          createCriteria(criteriaPanel, criteria, appModel);
          splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
          splitPane.setTopComponent(criteriaPanel);
          splitPane.setDividerLocation(200); //XXX: ignored in some releases
          splitPane.setAutoscrolls(true);
          return splitPane;
private JPanel createCriteria(JPanel criteriaPanel, String[] criteria, AppendDataModel appModel) {
          int len = criteria.length;
          criteriaFields = new JTextField[len];
          for (int i = 1; i < len; i++) {
               criteriaFields[i-1] = addCompForTextField(criteria, criteriaPanel, gbc);
          appModel.storeDataToModel(transType, criteriaFields);
          JButton okButton = new JButton(okAction);
          okButton.setToolTipText("Press Ok AFTER you have entered the criteria if you want to narrow your search");
          criteriaPanel.add(okButton);
          return criteriaPanel;
OKAction:::
protected void _doAction() {
          appendModel.addData();
AppendDataModel:::
public void addData() {
          JSplitPane splitPane = (JSplitPane)((HISTabbedPane)comp).getSplitPane();
          JPanel informationPanel = new JPanel(new GridBagLayout());
          JTable table = setUpTable();
          JScrollPane scrollPane = new JScrollPane(table);
          informationPanel.setLayout(new GridBagLayout());
          GridBagConstraints gbc = new GridBagConstraints();
          gbc.gridx = 0;
          gbc.gridy = 0;
          gbc.gridwidth = 6;
          gbc.gridheight = 6;
          gbc.fill = GridBagConstraints.HORIZONTAL;
          informationPanel.add(scrollPane, gbc);
          JButton button;
          button = new JButton("Commit Changes");     
          button.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e){
                    tableModel.updateDB();
          gbc.gridx = 0;
          gbc.gridy = 6;
          gbc.gridwidth = 1;
          gbc.gridheight = 2;
          gbc.weightx = 0.5;
          gbc.insets = new Insets(10, 30, 10, 30);
          informationPanel.add(button, gbc);
          button = new JButton("Ignore Changes");
          button.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e){
//                    tableModel.updateDB();
          gbc.gridx = 1;
          gbc.gridy = 6;
          gbc.gridwidth = 1;
          gbc.gridheight = 2;
          gbc.weightx = 0.5;
          gbc.insets = new Insets(10, 30, 10, 30);
          informationPanel.add(button, gbc);     
          splitPane.setBottomComponent(informationPanel);
private JTable setUpTable() {
          JTable table = new JTable(tableModel);
//          table = new JTable(tableModel);
          table.getModel().addTableModelListener(new HISTableModelListener());
          table.setSelectionForeground(Color.white);
          table.setSelectionBackground(Color.red);
          table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
          table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          ListSelectionModel rowSM = table.getSelectionModel();
          rowSM.addListSelectionListener(new HISListSelectionListener());
          return table;

Similar Messages

  • How is the Consumption tab will update in the material master?

    Hi Friends,
    How is the Consumption tab will update in the material master?
    what are the customization required if consumption tab wants update with respective the qty?
    Regards,
    Hari Shankar

    Hi Friends ,
    I am very thankful to u all for your quick response,
    I have tested the two materials with two movement types of 601 and 954.
    when i did the 601 movement type the consumption tab in the material master has updated automatically even though  i haven't maintained forecasting tab, but where as for the movement type 954 the consumption tab is not updated even though i have maintained forecasting tab view in the material master.
    Is the consumption view will update based on the Material movement types?
    where is the control parameter for updating consumption tab?
    could you pls help me regarding this?
    Regards,
    Hari Shankar.

  • Overview page opens/highlighted the wrong tab, but the right view

    Hi all,
    I'm Using EP7.0 and SP22.I copied the UWL iView from this location (content provided by Sap --> End User Content --> Standard Portal User --> iViews --> com.sap.netweaver.bc.uwl.iviews --> Universal Worklist).
    Changed the iView Properties:
    Display UWL Overview Page = Yes
    I customized the standard- and webflow.xml files.I created an extra tab with own columns in the UWL.
    That iView works fine.. It displays the Overview look and feel and my extra (invoics) tab. My Problem is
    when i click the link (Tasks, Notification, Alerts and Tracking) in the Oveview page, it opens the corresponding Tab look and feel , but when I click on my extra tab (Invoices) it opens the Task tab instead of my extra (invoices) tab. The view is showing the right items (customize columns), only the wrong tab is highlighted. For the end-user it's a little bit confusing.
    I also like to change the picture on the oveview page.
    what can i do? how to achieve this? please help me..
    thanks in advance,
    Vo.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Wrong VBAP table updation

    Hi
    Facing a problem with wrong VBAP table updation.
    Sales order shows Business Area" A " at both header and Item Level but in VBAP table the business area updated is " B ". can't understand why it is happening.
    Changelog doesn't indicate anything
    Thanks and regards
    Nikhil

    Hi,
    Can you check how the business rule that is assigned at SPRO-> Sales and distribution -> basic functions -> Account assignment/Costing -> Business area account assignment?
    Regards

  • Wrong language after update!!!

    You don't understand, after I updated itunes the language was changed to either dutch or finnish (not english, as is listed between dutch and finnish during the setup in the installation). This does not effect the itunes store, just the language of the header bar where file and edit are supposed to be, so changing the little flag on the bottom of the itunes store doesn't do squat. also, after much translation, I have tried to reset the language to english using the dutch file language. This also didn't work. Apple, something is wrong with the update. This might not be coincidence with the Netherlands trying to shut down itunes. Please look into it!! we have paid for these songs and I would like to continue the use of my expensive media equipment. Anyone else reading this with similar problems BACK ME UP

    In: edit > preferences
    At the bottom there is an option to change the language of iTunes.
    I have a Swedish version of my iTunes, but I discovered that it would be better if I had the English language enabled. It's easier to explain and help.

  • Firefox loads website in the wrong tab when I click a link and change tabs.

    In Firefox when I open a new tab and type in a webpage or click on the homepage button, then change to anoter tab while I wait for it to load, it will load the site in the tab I've switched to instead of the tab that I initially put the address in. This is annoying as it replaces whatever I was working on when it incorrectly loads the new page in the wrong tab. I have a fairly slow internet connection through my phone's hotspot, so it can take a long time to load pages, which is why I try to load something in one tab while working on another.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • JTabbedPane - Catching tab selection change

    I want to catch each tab selection change in my JTabbedPane.
    When I used ChangeListener, my program was unable to correctly
    indicate selected tab in some cases, i.e.:
    JTabbedPane contains two tabs: 0,1.
    Tab 0 was selected.
    Tab 0 was deleted.
    In this case JTabbedPane selects tab 1, but selected index remains
    unchanged and stateChanged is not called. How can I catch this?

    This trick is working, but you see, the problem is more
    complicated. The problem is that stateChanged() doesn't work
    when index remains unchanged. This is also true for insertTab().
    Both insertTab() and removeTabAt() (and maybe smth. else) causes this problem.
    Maybe, possible solution will be to override some method of
    JTabbedPane, responsible for activating a tab like this...?
    tabbedPane = new JTabbedPane {
        activateTab(...) {
            super.activateTab(...);
            firePropertyChange(...);
    }But what is the methods prototype and can it be overriden
    at all??
    In the deep sources of swing :) I've found such tricks:
    In JTabbedPane.insertTab():accessibleContext.firePropertyChange(
        AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
        null, component);In JTabbedPane.removeTabAt():accessibleContext.firePropertyChange(
        AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
        component, null);I'm almost convinced that this is the point. But!
    I've never worked with Accesibility :(
    And I couldn't find out what to do having only swing sources.
    Need help.

  • Help needed - showOneTab component displaying wrong tab

    Hi,
    I have a page with an af:showOneTab component, which contains several tabs, and also a table (that's separate from the showOneTab component).
    When the page is first loaded, the correct tab is disclosed, based on the contents of the table (there's a default tab, when the table is empty). Basically, on any of the tabs, different items can be added to the table, which then disables all of the other tabs. If the items are removed from the table, all the tabs are enabled again.
    This all works fine the first time the page is viewed, but I have a problem with subsequent viewings.
    Example scenario :
    - On load, table is empty, and opens on the default tab (E) (correct functionality)
    - change to tab A and add an item - all tabs except A now disabled (correct)
    - click ok button, return to other page, item from tab A displayed in list (correct)
    - go back to page - opens on tab A with all others disabled, and item in table (correct)
    - remove item from table - all tabs now enabled again (correct)
    - go to tab B and click cancel button - returns to other page, item from tab A still displayed in list (correct)
    but then...
    - go back to page - opens on tab B, with all others except A disabled, and the item from tab A in table. (should have opened on tab A)
    - clicking on tab A reveals that tab B is actually disabled as it should be
    So, the problem seems to be that somehow the showOneTab component is "remembering" the last tab that was disclosed, rather than determining which tab should be disclosed. (Furthermore, refreshing the page does not do anything - the wrong tab is still disclosed).
    I have tried to get this to work in the following ways, but none has worked :
    - binding each of the showDetailItems and using the setDisclosed methods
    - binding the showOneTab component
    - binding all of the "disclosed" and "disabled" attributes of the showDetailItems to boolean methods in the backing bean.
    - using disclosure listeners
    The backing bean for the page is on the session, but it is definitely being cleared before the page is loaded each time, so it can't be something persisting in that.
    I don't know if it makes any difference, but this page is a popup.
    This problem has been around for weeks now, and is extremely frustrating, so any help would be greatly appreciated.

    first I hope that you already solved your problem after one year but in case of I have a solution :
    I have the same problem with the component OADefaultHideShowBean and the function setDisclosed(boolean) ; finally I used this function setDefaultDisclosed(pageContext,boolean) which is working correctly and will not remember the position of the last page downloaded...

  • What is wrong with software update???

    Software update say there's a conection issue, but wifi and internet is fine. What is wrong with software update???
    So I can't upgrade from osx 10.6.6 to anything... no mavericks for me?????

    Drimeister wrote:
    Software update say there's a conection issue, but wifi and internet is fine. What is wrong with software update???
    So I can't upgrade from osx 10.6.6 to anything... no mavericks for me?????
    Prior to upgrading to Mavericks, you must make sure you meet ALL of its system requirements. 

  • The latest headlines tab wont update i have cleared history and cache .

    The latest headlines tab wont update i have cleared history and cache .
    == This happened ==
    Every time Firefox opened
    == 1 week ago

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • Applying wrong imaging driver updates ....

    ZENworks 11.3.2 Windows 2008 R2 SP1
    Last night we upgraded from ZENworks 11 SP3 to 11.3.2
    Applying Imaging Driver Update Feburary 2015 zenworks11.3.2_FRU1_Feb15.zip results in error message 'Applying wrong imaging driver update'
    ZUpdate.sig on primary server where running the update says ZEN_CLIENT_VERSION 112403 - timestamps on certain folders in the tftp directory and in the share\preboot\update folder though indicate that updates did take place at the time of the upgrade.
    Also a seconday server shows ZEN_CLIENT_VERSION 113200.
    'Assuming' that only the ZUpdate.sig file didn't update on the primary server - would it be safe to manually update the ZEN_CLIENT_VERSION and then run the imaging update?
    Thanks.

    Sector osh wrote:
    >
    > ZENworks 11.3.2 Windows 2008 R2 SP1
    >
    > Last night we upgraded from ZENworks 11 SP3 to 11.3.2
    >
    > Applying Imaging Driver Update Feburary 2015
    > zenworks11.3.2_FRU1_Feb15.zip results in error message 'Applying wrong
    > imaging driver update'
    >
    > ZUpdate.sig on primary server where running the update says
    > ZEN_CLIENT_VERSION 112403 - timestamps on certain folders in the tftp
    > directory and in the share\preboot\update folder though indicate that
    > updates did take place at the time of the upgrade.
    >
    > Also a seconday server shows ZEN_CLIENT_VERSION 113200.
    >
    > 'Assuming' that only the ZUpdate.sig file didn't update on the primary
    > server - would it be safe to manually update the ZEN_CLIENT_VERSION
    > and then run the imaging update?
    >
    > Thanks.
    Before doing so... I would run a ZDC, just to check - could me more
    than just this one file...
    Niels
    I have always liked... Cowabunga!
    If you find this post helpful, please show your appreciation by clicking
    on the star below.
    A member must be logged in before s/he can assign reputation points.

  • JTabbedPane setSelectedIndex displays wrong tab

    I have encountered a problem that is identical to Bug ID 6285072 that was submitted back in 2005. It is closed with a workaround that just doesn't work for me.
    Basically, I am creating multiple tabs and populating a table in each. I then set the selected index to the last one. However, the display shows the first tabs data and each previous tab shows the first tabs data until I actually go back and click on the first tab... then each tab shows the correct data. I have tried many things... such as making the tabs opaque... getting the component and setting focus and visibility. Then I discovered the above bug that describes my problem. Any suggested workaround would be appreciated. bug is at... [bug id 6285072|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6285072]

    Seems to me you could just subclass JTabbedPane in that subclass override setComponentAt to provide the fix described in the bug. You just need to grab the changed method from the JDK 6 source.

  • Refresh JTabbedPane when tab is pushed?

    My JtabbedPane is working fine, but the problem is that my last JFrame in my JtabbedPane called arkiv has to get updated everytime its tab is pushed and i cant get to work .I tried repaint() ,removeAll() but cant get it to work...
    Can anyone help me with this?

    I first posted in the wrong spotSo what was wrong the the suggestion given?
    But, I need the table refresh if tab1 data is changed.I said you update the TableModel. Thats all there is to it. No need to repaint or anything, the model is responsible for telling the table to repaint itself.
    You can
    a) update the TableModel directly using setValueAt(...), insertRow(...), removeRow(...) etc, or
    b) recreate the entire TableModel from scratch and then use:
    table.setModel( newlyCreatedModel );
    Where is your SSCCE program. We don't want to see you database code. An SSCCE will hardcord the data to simulate a database query. That way you can post working code.

  • SC DPM 2012 r2 Console Crashes when attempting to Open the Management Tab after Update to RU2

    Recently we Updated our DPM server to DPM 2012 r2 ru2 from ru1.  and after that every time we open the management tab in the console it crashes with the following error
    mmc has stopped working
     Application Name: mmc
      Application Version: 4.2.1205.0
      Module Name: mmc.exe
      Module Version: 6.3.9600.16384
      Exception Name: System.NullReferenceException
      Exception Point: Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.AgentManagement.ProductionServerController.UpdateProtectionStatus
      Other: AC213896
      OS Version: 6.3.9600.2.0.0.400.8
      Locale ID: 1033
    at the same time the following event is logged in the application events
    event ID 999
    An unexpected error caused a failure for process 'mmc'.  Restart the DPM process 'mmc'.
    Problem Details:
    <FatalServiceError>
    <__System>
    <ID>19</ID>
    <Seq>0</Seq>
    <TimeCreated>6/23/2014 4:25:37 PM</TimeCreated>
    <Source>DpmThreadPool.cs</Source>
    <Line>163</Line>
    <HasError>True</HasError>
    </__System>
    <ExceptionType>NullReferenceException</ExceptionType>
    <ExceptionMessage>Object reference not set to an instance of an object.</ExceptionMessage>
    <ExceptionDetails>
    System.NullReferenceException: Object reference not set to an instance of an object.
      at Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.AgentManagement.ProductionServerController.UpdateProtectionStatus()
      at Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.AgentManagement.ProductionServerController.OnUpdateProtectionStatus(Object unUsed)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
      at System.Threading.ThreadPoolWorkQueue.Dispatch()
    </ExceptionDetails>
    </FatalServiceError>
    We have updated the dpm agents on all of the servers that we back up by installing the update on the servers manually and according to the data in the DPM database it has acknowledged that they are indeed updated.
    From what I can tell from the errors is the console is attempting to read the updateprotectionstatus from the database and it is not returning a value and thus causing it to crash.  but I have no clue as to where this might be in the database to even
    check if it simply missing from an update gone wrong.  
    I did notice that the update attempted to install twice through windows update and failed.  The update does show as installed under installed updates in programs and features control panel
    Any help on this would be appreciated as it does make it difficult to manage our dpm server

    Hi,
    See if this is relevant.
    1. Take a DPMDB backup.
    2. Open SQL Management studio and connect to the DPM instance.
    3. Expand the DPM database and go to the table tbl_AM_Server.
    4. Edit the table, and under the "ServerName" column check for the DPM server name. It should be the FQDN. If it is the NetBIOS name then change it to the FQDN. 
    5. Try re-opening the DPM console and navigate to the management tab and see if that works now.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT]
    This posting is provided "AS IS" with no warranties, and confers no rights.

  • Wrong tab switch order after moving tabs

    Photoshop CC 2014
    OS X Yosemite
    Photoshop doesn't update tab index (?) when moving tabs around, causing ctrl+tab and ctrl+shift+tab to jump back and forth.
    Steps to reproduce:
    1) Create a couple of new documents, say 4.
    2) Switch between tabs using ctrl+tab and ctrl+shift+tab. Works nicely from left to right and back.
    3) Move the tabs so the document name order would be something like 4, 1, 3, 2.
    4) Switch between tabs as above. PS switches between tabs based on opening/creation time rather than tab order.
    Read about this in a support article dated some 4 years ago.
    Is it me or does this come across as just plain wrong? Surely must be a bug. Something up with my mac/system/application settings?

    Hello DebbyMcN,
    The Reset Firefox feature may have been the thing you tried previously.
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Cheers, Patrick

Maybe you are looking for

  • Strange error message that won't go away...

    ...and it also crashes Mail for me. The message goes something like this: *Some actions taken while the account "jim@{myemail}.com" was offline could not be completed online.* Mail has undone actions on some messages so that you can redo the actions

  • How to spool only results? (minus system output)

    Hi all, i have 2 problems my script below in italics set linesize 140 set pagesize 1000 set feedback off set echo off spool anotherresults.txt select 'Country Code:"'||a.country_id||'"', 'Country Name:"'||a.COUNTRY_NAME||'"', 'Residing in :"'||a.REGI

  • Unable to bind OS X Mavericks to Active Directory

    Recently I had one of my iMacs lose its trust relationship with Active Directory.  I tried unbinding and then rebinding it but that's where I ran into problems.  Of course, unbinding was simple and easy.  Now, I can't get this bound back to the domai

  • SharePoint Performance Point Decomposition tree Showing values in decimal?

    HI, Actually, In SharePoint Performance Point Decomposition tree Showing values in decimal format. I would like to change as a "Percentage". How could i do it? Is it possible? The value 17.21% shows the same "0.17" in Decomposition tree. How could i

  • Restart is required to mount USB after a kernel upgrade?

    I have problem with required restart after kernel upgrade couse can't use USB. This is common in my two machines (laptop & pc). What can I do with this annoying problem. I've tried to google for an answer but can't find anything usefull. Only reasona