How to change an existing JScrollPane table

Hi there,
I have defined a JScrollPane panel. I call the class "NorthCenterPanel " this the first time with "defaultPanel". This shows me a correct table. Next time I calle the same class from the class=Listen(see below) with "createPanel", because I want to change the table.
This I cannot get to work. When the new table is shown I have to click on the JScrollPane to have it to change the table of which is done, but the column names do not change.
Any suggestions?
Thanks
Geir
public class NorthCenterPanel extends JPanel
public NorthCenterPanel(String newPanel)
System.out.println("Function=" + newPanel);
if (newPanel == "defaultPanel")
colNames [0] = "Logon-ID";
     colNames [1] = "Name ";
     colNames [2] = "Not Used ";
     outData [0][0] = "login ";
     outData [0][1] = "Jogn Doe";
     outData [0][2] = "NotWorking";
title = BorderFactory.createTitledBorder(outArea);
setBorder(title);
     System.out.println("NortCenterPanel...." + outArea);
     table = new JTable(outData, colNames);
     table.setPreferredScrollableViewportSize(new Dimension(200,100));
     table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
     table.setBackground(new Color(252,255,240));
     outPut = new JScrollPane(table);
     add(outPut);
     }else if (newPanel == "createPanel") {
     colNames [0] = "Next ID ";
     colNames [1] = "Full Name";
     colNames [2] = "Reserved ";
     outData [0][0] = "logout";
     outData [0][1] = "Jane Doe";
     outData [0][2] = "N/A ";
     System.out.println("NortCenterPanel...." + outArea);
     System.out.println("her er jeg....");
     table = new JTable(outData, colNames);
     outPut.add(table);
pack();
public class Listen implements ActionListener
public void actionPerformed(ActionEvent e)
if (e.getSource() == updateButton)
createButton.setSelected(false);
deleteButton.setSelected(false);
outPut.remove(table);
add(new NorthCenterPanel("createPanel"));
table.repaint();
outPut.revalidate();
}

1) Use the "Code" formatting tags when posting code so the code is readable
2) In the future, Swing related quesitons should be posted in the Swing forum.
3) don't use "==" to compare Objects, use the equals(...) method
In general, when you add or remove a compont from a panel then you need to revalidate() the panel.
The easiest way to replace a table it to simply replace the data in the table. So you just do something like:
DefaultTableModel model = new DefaultTableModel(....);
table.setModel(...);
Now there is no need to remove and add the component or revalidate the panel.

Similar Messages

  • How to change records in standard tables ?

    how to change records in standard tables ?

    HI,
    If you are asking from program..Then you can use BDC or BAPI to update the records in teh standard tables..
    OR
    use the corresponding tcode to update the record
    Thanks
    Naren

  • [HTML DB] How to use the existing database table?

    [HTML DB] How to use the existing database table?
    I installed Oracle 10g database in Computer A(Windows 2000), and I already create all the tables with data and the data size is about 300MB.
    In Computer B(Windows 2000), I installed HTML DB 1.6.
    How can I use /get the existing database table (in computer A) for HTML DB?
    Could anyone help me on this? I am newbie and I need some detail instructions. or Where can I find the examples.....
    Thanks

    Well I guess if you wish to retain that architecture, i.e. HTMLDB on one machine and your data on another, you will have to establish database links to access the data. Oracle documentation will describe how to achieve that.

  • How to change tablespace for a table in 10g?

    Does anyone know how to change tablespace for a table (like changing tablespace for an index [alter index ... rebuild tablespace ... ])? Many thanks in advance.

    alter table tablename move tablespace newtsname;
    You need to rebuild the indexes after the move.

  • How to change GUI title in Table maintenance generator?

    How to change GUI title in Table maintenance generator?
    Thanks
    Pankaj

    Hi,
    In table maintenance goto
    Environment>Modification>Maintenance screen
    Click on layout button
    Make editable form
    change the text property of column.
    save and activate it.
    check in sm30 headings.
    Pankaj

  • HT2204 how to change the existing ID form App Store

    how to change the existing ID form App Store

    You can tap on the id in Settings > iTunes & App Stores and log out of the account and you can then log in with a different account. But any content that was downloaded via the currently logged in account will remain tied to that account (so only that account can download updates to its apps), and if you turn on automatic downloads for an account, use iTunes match or re-download past purchases then you risk tying the device to that account for 90 days : http://support.apple.com/kb/HT4627

  • URGENT - How to change data in a table

    I have created the basic table to display some data. But how do I change some of the data in the table. I generate the data within my program and then need to display the new table data in the same original table.

    So far I am just testing with the example codes from the sun website. How would I change the name Mary to say Kate? Do I have to implement an abstract table model? Can I just change the value in the array or something?
    Thanks in advance
    // create the table
                   Object[][] tableData =
                {"Mary", "Campione",
                 "Snowboarding", new Integer(5), new Boolean(false)},
                {"Alison", "Huml",
                 "Rowing", new Integer(3), new Boolean(true)},
                {"Kathy", "Walrath",
                 "Chasing toddlers", new Integer(2), new Boolean(false)},
                {"Mark", "Andrews",
                 "Speed reading", new Integer(20), new Boolean(true)},
                {"Angela", "Lih",
                 "Teaching high school", new Integer(4), new Boolean(false)}
              String[] columnNames = {"First Name",
                                    "Last Name",
                                    "Sport",
                                    "# of Years",
                                    "Vegetarian"};
              final JTable table = new JTable(tableData, columnNames);
            table.setPreferredScrollableViewportSize(new Dimension(500, 100));
              //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
              //Add the scroll pane to this window.
            //getContentPane().add(scrollPane, BorderLayout.CENTER);
              displayPanel.add(scrollPane);

  • OIM: How to change user search results table?

    Hello,
    My customer wants to change the search results table to add/delete columns or move around the existing columns. Is there a way to configure or customize this? If so how? Please let me know.
    Thanks

    This jsp uses the table generator.jsp which shows the data in the form of table. You have to make your own action class to do this after extending their class (provided by oracle) tcSearchUserAction.java and you can show data as per your client requirement.

  • How to change stored procedure with Table Valued Parameter

    I am not sure how to change the normal stored procedure with Table Value Parameter.Do I have to create a separate Table or do I have to create a datatype. Can you please help me with this
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
    @dp_id char(32),
    @dv_id char(32),
    @em_number char(12),
    @email varchar(50),
    @emergency_relation char(32),
    @option1 char(16),
    @status char(20),
    @em_id char(35),
    @em_title varchar(64),
    @date_hired datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    MERGE [dbo].[em] AS [Targ]
    USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
    AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
    ON [Targ].em_id = [Sourc].em_id
    WHEN MATCHED THEN
    UPDATE
    SET dp_id = [Sourc].dp_id,
    dv_id = [Sourc].dv_id,
    em_number = [Sourc].em_number,
    email = [Sourc].email,
    emergency_relation = [Sourc].emergency_relation,
    option1 = [Sourc].option1,
    status = [Sourc].status,
    em_title = [Sourc].em_title,
    date_hired = [Sourc].date_hired
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
    VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
    END;

    It's not clear how you would change the procedure. But assuming that you want to replace the existing scalar parameters with tabular input, this is how you would do it. You first create a table type:
    CREATE TYPE  Insertor_type AS TABLE
        (dp_id                char(32),
         dv_id                char(32),
        em_number            char(12),
        email                varchar(50),
        emergency_relation   char(32),
        option1              char(16),
        status               char(20),
        em_id                char(35),
        em_title             varchar(64),
        date_hired           datetime)
    Then you change the procedure header:
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF] @tvp Insertor_type READONLY AS
    And finally you change the USING clause:
       USING (SELECT dp_id, dv_id , em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired
              FROM   @tvp) AS [Sourc] ON [Targ].em_id = [Sourc].em_id
    The rest is fine as it is.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to change the existing sap logon ticket

    HI
    I did the System copy from my production server to Quality server.
    Now everthing is working except Single Sign On.  This is due to SAPlogon ticket.
    the SAPlogon ticket show the PRD sid. I am not able to change the existing sid in ticket.
    Tell me how to chage the old saplogon ticket with new one.
    Workaround i did in my server.
    generated the new certificate for Quality server  and try to import in R/3 000 client.  but not successful.

    Hello Lee,
    You dont have to import the certificate from R/3 into portal
    we have to generate the certificate in portal and then import in R/3
    To generate the portal certificate in quality Portal system and uploading in R/3,please find the method:
    Log on to the Visual Admin of Portal with administrator id and password. Go to the following node: Server 0 1_34158->services and then Key Storage
    In Key Storage, go to TicketKeyStorage
    Under Entry, choose Create.
    The Key and Certificate Generation dialog appears
    Enter the Subject Properties in the corresponding fields
    CN=<Common Name>, OU=<Organization Unit Name>, O=<Organization Name>, L=< Locality Name >, ST=<State/Province>, C=DE. give SID of portal in CN
    Give the Entry name as SAPLogonTicketKeypair.
    Select Algorithm as DSA,also click on store certificate and then generate
    You will see along with SAPLogonTicketKeypair, SAPLogonTicketKeypair-cert will also get generated.
    Now we will have to import this SAPLogonTicketKeypair-cert in the ABAP systems
    First we will have to download the certificate from the portal.
    Now logon to the SAP Netweaver Portal with user administrator
    Go to System Administration->System Configuration and then Keystore Administration.
    In the Content tab you will find the list of certificates
    We have to download SAPLogonTicketKeypair-cert .Click on Download verify.der file
    To your desktop
    Now we have to import the certificate in ABAP system.
    Log on to the ABAP system 000 client and use T-Code STRUSTSSO2
    Under Certificate, click on Import certificate
    Give the path of verify.der file. The file format should be Binary
    And upload it.
    Now you can see the certificate has been uploaded. Check for the validity
    Now click on Add to certificate to add this.
    Now click on Add to ACL.
    Enter System ID as the portal SID(i.e is SPQ) and client as 000 and click on Ok
    Then save your entries
    Hope this makes it clear
    Rohit

  • How to change settings for insert table

    I use DW CS4. Don't know how this changed but now when i click insert>table the result is insertion of a table with width of 960 and 8 columns and 8 rows?
    Where can i change this back to what it was so that in properties i can set the width, the number of columns, the number of rows, etc.
    thanks for your help,
    Jim Balthrop

    JBWebWorks wrote:
    I use DW CS4. Don't know how this changed but now when i click insert>table the result is insertion of a table with width of 960 and 8 columns and 8 rows?
    Where can i change this back to what it was so that in properties i can set the width, the number of columns, the number of rows, etc.
    Dreamweaver should remember the last table definition you put on the page.
    Insert>table>Specify Rows/Columns/Width
    That should then be the default until you specify something else.

  • How to change the limitation of Table name's length?

    The length of table's name or field's name is limited to 30 characters.
    Can I change it? If I want to create a long name table,then how can I do?
    Thanks in advance!

    This is a duplicate of another question
    How to change Table name's length?
    The short answer is no, you cannot.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to change an Existing  Purchase Requisition Document in MM.

    Hi Folks,
    I want to write a program to change a existing  Purchase Requisition in MM.
    I found two BAPI's BAPI_PR_CHANGE and BAPI_REQUISITION_CHANGE , which could be used to change PR document in  ECC.
    I have following question:
    1) why we have two seprate BAPI's for changing PR.
    2) Do we need to use both BAPI's to change PR, depending on what value we are trying to change.
    3) Is it optional to use any of these two BAPI's
    Or do we have any other way to implement this PR change process.( Bcoz of when i tried to debug standard PR change process, none of these two BAPI's has been called)
    Which FM or method is called when, we try to change and save PR document manually.
    I would appriciate, if some one has any sample code to implement this PR change process.
    Regards
    PG
    Edited by: PG on Aug 23, 2010 3:10 PM

    >
    PG wrote:
    > I have following question:
    > 1) why we have two seprate BAPI's for changing PR.
    BAPI_REQUISITION_CHANGE is the older BAPI, the one based on the older ERP transaction (ME5x family), while BAPI_PR_CHANGE is the newest one, referring to the "recent" Enjoy transaction (ME5xN family).
    They both satisfy you task probably, but if you can chose, I'd go for BAPI_PR_CHANGE.
    >
    PG wrote:
    > 2) Do we need to use both BAPI's to change PR, depending on what value we are trying to change.
    > 3) Is it optional to use any of these two BAPI's
    You can use the first or the second one, it's indifferent. The newest one will also trigger user exits from ME5xN family. Which transactions are used by the users on the ERP? Choose with regards to the transactions used during the normal activity.
    >
    PG wrote:
    > Or do we have any other way to implement this PR change process.( Bcoz of when i tried to debug standard PR change process, none of these two BAPI's has been called)
    Normal PR change operativity doesn't use BAPI. BAPIs are used to create/modify docs from "external" systems (it's not properly true, but let assume it), they provide a simple interface to populate with PR data and the process of creation/modification will trigger every check/userexit already defined for the standard transactions on the ERP.
    In example, suppose that in ME51N you defined a custom check in a specific userexit which don't allow an user to create a material item which have odd quantity (odd example, I know ). Then using BAPI_PR_CREATE you will not be able to create a PR with items with odd quantity, because the same check will be executed.

  • How to change an existing BOMGroup with ABAP

    Hi!
    Is there a way to change an existing BOMGroup? I found the BAPI "BAPI_MATERIAL_BOM_GROUP_CREATE" which is ok to create BOMGroups. But I couldn't find a BAPI to change them. If this is not possible, is there a way to delete a BOMGroup and create it again with the new values? I can delete a BOMGroup within the SAPGui by deleting all BOMs attached to it. To do this by code, I need a way to get/find all attached BOMs of the BOMGroup and then delete them one by one... Then I can create the BOMGroup again.
    Thanks,
    Konrad

    Hi Konrad,
    There are no BAPI's available but you can acheive using other function modules:
    To do changes using change number
    CS_CL_P_BOM_MASS_CHANGE                 
    CS_CL_S_BOM_CHANGE                              
    CS_CL_S_BOM_CHANGE_COMPLETE                                                                               
    To delete BOM      
    C162_BOM_DELETE  
    To create/change the BOM using the Category
    CS_OV_BOM_EDIT                
    Thanks
    Lakshman

  • How to change data in decision table using excel file in operating system?

    Hello, BRF Experts
    I now brf + for the first time in the current project is being developed.
    Now, project has been facing a big problem.
    Develop system that was developed in the history of decision table in the operating system can be used to update excel file, etc. I do not know whether.
    So, I was tested, but can not change data in decision table.
    [ error message : system is not change allowed ].
    The operating system itself to the current system setting is immutable and check it
    : changes and transports for client-specific object -> no changed allowed
    : cross-client object changes -> no changes to repository and cross-client customizing object.
    Decision table in the operating system can update the details if I want to know what to do.
    Maintenance view can be modified in the operating system as a decision table, I wonder if you can create a view.
    Edited by: Sung-Wook Ha on Jan 13, 2012 2:02 PM

    Hi ,
    Exchanging data with Microsoft Excel is done with the help of the XML-based file format (file extension .XSLX) introduced with Microsoft Excel 2007. If you are using an older version of Microsoft Office, you can download the Microsoft Office Compatibility Pack to upgrade the supported file formats from the Microsoft Download Center ([Exchanging Decision Table Data With Microsoft Excel |http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466]). Once you have downloaded the Compatibility Pack, you have to install it on every workstation that has an older version of Microsoft Office installed.
    Please refer the link-
    [BRFplus-Data exchange with MS Office 2007|http://help.sap.com/erp2005_ehp_05/helpdata/en/b8/e03486d1df48c6baa3c4354f5198ee/frameset.htm]
    Hope this helps.
    Thanks,
    Ajay

Maybe you are looking for