Changing a panel in a frame at runtime

I have a frame setup with buttons on the BorderLayout.WEST area. Now for each clicked event those buttons generate I want to add a panel to the SOUTH area depending on which button was pressed.
I have all the action listeners setup, and when a button is clicked the following code is executed
getContentPane().add(new buttonPanel(),BorderLayout.SOUTH)
The code seems to be executing but nothing will show up in my JFrame.....
The buttonPanel object works and if I add to the SOUTH section during design time it will show up ok. But I need to be able to change this panel to buttonPanel2() whenever the user clicks the appropriate button...

okay that worked, the correct panels will come up, but when I click on one of the buttons that was just created, one of the previous buttons will come onto the foreground. Do I need to destroy the previous panel?
and if so, how do i do that generically? So that I can destroy any object in the BorderLayout.SOUTH region.

Similar Messages

  • Changing panels on a frame depending on what the user clicks

    I'm making a small application with a JFrame and some JPanels.
    When the application starts a start panel is added to the frame where the user can press two buttons. If he presses a button, then a new panel must be painted on the frame. In the new panel there is a button for going back to the starting panel.
    How can I accomplish this changing of panels? How does one panel give control to another panel? How can I let the frame control everything (if I should do that)?

    I guess just use CardLayout, CardLayout will solve your problem

  • Resize block-frame at runtime?

    Hello,
    is it possible to resize and reposition a block´s frame at runtime? We want to implement a configurable form. Why is the frame not a "block-element" but a "canvas-element"? Is there any posibility to change boilerplates at runtime?
    thanks in advance
    Anna

    You can't change boilerplate elemenets at runtime. As such you can't change the block frame.

  • While trying to change a BOM with transaction CS02, a runtime error appears

    While trying to change a BOM with transaction CS02, a runtime error appears.
    In intial screen he entered material ,plant BOM usage and date valid from  after executed then id displayed item list in that he wantu2019s delete one item, he has been deleted selected item after that when he was saving he is getting runtime error
    Developer trace
    ABAP Program SAPLKED1_WRITE_CE4_BPS1                 .
    Source LKED1_WRITE_CE4_BPS1U01                  Line 30.
    Error Code SAPSQL_ARRAY_INSERT_DUPREC.
    Module  $Id: //bas/640_REL/src/krn/runt/absapsql.c#17 $ SAP.
    Function HandleRsqlErrors Line 775.
    RABAX: level LEV_RX_STDERR completed.
    RABAX: level LEV_RX_RFC_ERROR entered.
    RABAX: level LEV_RX_RFC_ERROR completed.
    RABAX: level LEV_RX_RFC_CLOSE entered.
    RABAX: level LEV_RX_RFC_CLOSE completed.
    RABAX: level LEV_RX_IMC_ERROR entered.
    RABAX: level LEV_RX_IMC_ERROR completed.
    RABAX: level LEV_RX_DATASET_CLOSE entered.
    RABAX: level LEV_RX_DATASET_CLOSE completed.
    RABAX: level LEV_RX_RESET_SHMLOCKS entered.
    RABAX: level LEV_RX_RESET_SHMLOCKS completed.
    RABAX: level LEV_RX_ERROR_SAVE entered.
    RABAX: level LEV_RX_ERROR_SAVE completed.
    RABAX: level LEV_RX_ERROR_TPDA entered.
    RABAX: level LEV_RX_ERROR_TPDA completed.
    RABAX: level LEV_RX_PXA_RELEASE_RUDI entered.
    RABAX: level LEV_RX_PXA_RELEASE_RUDI completed.
    RABAX: level LEV_RX_LIVE_CACHE_CLEANUP entered.
    RABAX: level LEV_RX_LIVE_CACHE_CLEANUP completed.
    RABAX: level LEV_RX_END entered.
    RABAX: level LEV_RX_END completed.
    RABAX: end RX_RFC
    In sm21
    Perform rollback
    Run-time error "SAPSQL_ARRAY_INSERT_DUPREC" occurred
         Short dump "090618 110101 donalda 11557 " generated
    Runtime Error          SAPSQL_ARRAY_INSERT_DUPREC
    Exception              CX_SY_OPEN_SQL_DB
           Occurred on     18.06.2009 at   11:01:01
    The ABAP/4 Open SQL array insert results in duplicate database records.
    What happened?
    Error in ABAP application program.
    The current ABAP program "SAPLKED1_WRITE_CE4_BPS1" had to be terminated because
    one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    What can you do?
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    Error analysis
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was
    neither
    caught nor passed along using a RAISING clause, in the procedure
    "RKE_WRITE_CE4__BPS1" "(FUNCTION)"
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.
    The reason for the exception is:
    If you use an ABAP/4 Open SQL array insert to insert a record in
    the database and that record already exists with the same key,
    this results in a termination.
    (With an ABAP/4 Open SQL single record insert in the same error
    situation, processing does not terminate, but SY-SUBRC is set to 4.)
    How to correct the error
    The exception must either be prevented, caught within the procedure
    "RKE_WRITE_CE4__BPS1"
    "(FUNCTION)", or declared in the procedure's RAISING clause.
    To prevent the exception, note the following:
    Use an ABAP/4 Open SQL array insert only if you are sure that none of
    the records passed already exists in the database.
    You may able to find an interim solution to the problem
    in the SAP note system. If you have access to the note system yourself,
    use the following search criteria:
    "SAPSQL_ARRAY_INSERT_DUPREC" CX_SY_OPEN_SQL_DBC
    "SAPLKED1_WRITE_CE4_BPS1" or "LKED1_WRITE_CE4_BPS1U01"
    "RKE_WRITE_CE4__BPS1"
    If you cannot solve the problem yourself, please send the
    following documents to SAP:
    1. A hard copy print describing the problem.
       To obtain this, select the "Print" function on the current screen.
    2. A suitable hardcopy prinout of the system log.
       To obtain this, call the system log with Transaction SM21
       and select the "Print" function to print out the relevant
       part.
    3. If the programs are your own programs or modified SAP programs,
       supply the source code.
       To do this, you can either use the "PRINT" command in the editor or
       print the programs using the report RSINCL00.
    4. Details regarding the conditions under which the error occurred
       or which actions and input led to the error.

    Hi ,
    you are getting beacuse u are trying to do mass update to database.
    Please check that below note are applicable to your system.
    Note 453313 - DBIF_RSQL_ERROR_INTERNAL for mass insert
    Note 869534 - AFS MRP doesn't work properly with all BOM item categories
    Thanks Rishi Abrol

  • How to change a labels text which created at runtime?

    hi,
    i am creating label controls in runtime dynamically and adding them to a group component. this group component is in another custom component and i have lots of custom comp. in my app.
    my question is how can access (via id) and change a labels text whict created at runtime?
    i can change like this but i am setting id's and want to reach via id.
    var lbl:mx.controls.Label = mx.controls.Label(subMenu5.group_subMenu5.getElementAt(1));
    lbl.text = "good job";
    thank you, have a good day.

    First off, if you are already using a Spark Group, I would suggest you use a Spark Label instead of an MX Label. If you want to reference the Labels from the group, loop through the group's elements and check the if the element id matches the Label you want to assign text to.
    var lbl:Label;
    var n:int = myGroup.numElements;
    for (var i:int = 0; i < n; i++)
         lbl = myGroup.getElementAt(i) as Label;
         if (lbl && lbl.id == "myLabel")
              lbl.text = "newText";

  • Change the size of a chart in runtime in LV7.1?

    Is it impossible to change the size of a chart in runtime in LV7.1? I can only see that the properties width and height is readable. It would be very neat to have these properties writable so one can change the size of for instance charts in run-time.Is it impossible to change the size of a chart in runtime in LV7.1? I can only see that the properties width and height is readable. It would be very neat to have these properties writable so one can change the size of for instance charts in run-time.
    Regards/Lars

    Thomas,
    You wrote,
    "Yes, you are right, it has just effect to the plot area." (bold added).
    That is not the case I found. Those properties do change the plot area BUT the rest of the chart adapts around that area so the WHOLE chart re-sizes.
    See attached.
    Confused,
    ben
    Message Edited by Ben on 11-09-2005 07:37 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Re-size chart.JPG ‏30 KB

  • Hello everybody, Problem with Two panel in a Frame

    This is my first mail in this forum.I'm trying to learn java myself & have a problem in adding more than one panel in a JFrame.
    i should be able to add one panel which occupies 3/4 of a frame and another panel occupies the rest.
    Thanx in advance for anyone who helps me in sorting out this problem.

    You can use for example the GridLayout
    In your JFrame constructor, add lines below, it will add 2 colored panel in your frame
    Container container = getContentPane();
    container.setLayout(new GridLayout(1,2)); // 1 row, 2 cols
    JPanel panel1 = new JPanel();
    panel1.setBackground(Color.red);
    container.add(panel1);
    JPanel panel2 = new JPanel();
    panel2.setBackground(Color.green);
    container.add(panel2);

  • Frame Moving Runtime using Look and Feel

    Hi All,
    I need creating Frame Moving runtime using Look and feel (Oracle forms 10 g with swing concept). If any bodies know give me a idea and demo files.
    Thanks and Regards
    M.Sathiya

    Dear Francois,
    Thanks all are working good and result also perfect but frame and DnD is not properly working compile time no problem only problem is run time it given error :java.lang.VerifyError:(class:oracle/forms/fd/frame$FrameBorder;methed <init> Signature:(Loracle/forms/fd/frame;)V) please tell me how can solve this problem.
    Regards,
    M.Sathiya

  • Adding a panel to a frame

    Hi! All,
    I'm new to java and i have a little problem here. I have created a frame and i want to put two panels inside it. well, i managed to put the first one, but i'm having problems with the second one. I want this second one to be added when I click on a button.
    The button that I will click is the new JButton i have defined. it is called draw. I really do not know what the problem is. I will apprecite any help. Below is my code.
    // My Code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.util.*;
    public class Main extends JFrame {
    //all components I'll need
    public JButton draw;
    public JButton addFormula;
    public JButton modelCheck;
    /** Creates a new instance of Main */
    public Main () {
    super("Graphical Model Checker for Knowledge");
    //content pane is the main panel where i'll put everything
    JPanel contentPane = new JPanel();
    draw = new JButton("Draw");
    draw.addActionListener(
    new ActionListener() {         
    public void actionPerformed(ActionEvent event) {
    if(event.getActionComman().equals"Draw")) {               
    JPanel drawing = new JPanel();
    drawing.setBackground(Color.BLUE);
    drawing.setSize(100, 100);
    drawing.setLayout(new FlowLayout
    FlowLayout.CENTER));
    add("North", drawing);
    drawing.setVisible(true);
    contentPane.add(draw);
    addFormula = new JButton("Add Formula");
    contentPane.add(addFormula);
    modelCheck = new JButton("Model Check");
    contentPane.add(modelCheck);
    Canvas canvas = new Canvas();
    canvas.setSize(40, 40);
    canvas.setBackground(Color.white);
    contentPane.add(canvas);
    repaint();
    //add panel to the frame
    add("South", contentPane);
    //colours for window
    contentPane.setBackground(Color.yellow);
    //set layout manager
    contentPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    addWindowListener(new CloseWindow());
    pack();
    setVisible(true);
    String [] fileItems = {"Open", "Save", "Rename"};
    String [] editItems = {"Copy", "Cut", "Paste"};
    //instantiate a menu bar object
    JMenuBar bar = new JMenuBar();
    JMenu file = new JMenu("File");
    for (int index=0; index != fileItems.length; index++)
    file.add(fileItems[index]);
    bar.add(file);
    setJMenuBar(bar);
    JMenu edit = new JMenu("Edit Graph");
    for (int index=0; index != editItems.length; index++)
    edit.add(editItems[index]);
    bar.add(edit);
    setJMenuBar(bar);
    public static void main(String args []) {
    JFrame window = new Main();
    }

    Don't forget to use the "Code Formatting Tags",
    see http://forum.java.sun.com/help.jspa?sec=formatting,
    so the posted code retains its original formatting.
    add("North", drawing); The "North" means nothing when adding a component to a panel using a FlowLayout. You should just be using:
    add( drawing );After you add the component to the container you need to use:
    frame.validate();

  • How to change a connection with the database in Runtime?

    How to change a connection with the database in Runtime?
    My connection was made using ADF Business component (ApplicationModule).
    ADF Swing.
    JDeveloper Studio 11.1.1.4.0.

    When deploying ADF applications with database connection, you should be using JDBC data sources configured in the weblogic server.
    You could change the JDBC data sources to a different DB instance or location - by changing the JDBC data source and restarting the weblogic server.
    For more details, check
    http://techiecook.wordpress.com/2010/12/02/oracle-weblogic-adf-datasources/
    Thanks,
    Navaneeth

  • Display 3 Panels in one frame.....

    Hi
    I need to display 3 different panels in one frame.
    The first panel will contain a JXTreeTable [North]
    The second Panel will contain a Tree [Center]
    The third Panel will contain a JXTreeTable [South]
    I am unable to get this working as the components to be displayed
    are not being placed properly.
    The JXTreeTable is being displayed only at the NORTH.
    Is it better to create 3 different panels or create just one panel with GridLayout(as I have done)
    Have I overlooked something in the code below?
    Thnx
    This is my code:
    public class PositionCostingView {
         public PositionCostingView(){
              initComponents();
         private void initComponents(){
              final JFrame frame = new JFrame("Position Costing");
              frame.setPreferredSize(new Dimension(450, 300));
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // First,testing my model
              TreeTableModel model = new OpTreeTableModel();
              JXTreeTable treeTable = new JXTreeTable(model);
              // Add the TreeTable to a Scroll Pane.
              JScrollPane scrollPane = new JScrollPane(treeTable);
              JPanel players = new JPanel(new GridLayout(3, 0));
              players.add(scrollPane);
              players.add(MyTree);
              players.add(scrollPane);
              JPanel content = new JPanel();
              content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
              content.add(players);
              frame.getContentPane().add(content);
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              new PositionCostingView();

    Please ignore my code on top.I am trying something else.....
    No offence meant please.

  • I want the title on the browser to change when one of the frames changes in the Frameset.

    I am using frames (please don't tell me off!) and PHP.
    I want the title on the browser to change when one of the
    frames changes in the Frameset.
    Normally the title of the browser comes from the Frameset,
    But I am sure I have seen websites where the title changes
    depending on one of the frames... how is this done?
    C

    Then don't use frames.
    > Normally the title of the browser comes from the
    Frameset, But I am sure I
    > have seen websites where the title changes depending on
    one of the
    > frames...
    > how is this done?
    Show us one and we'll tell you.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "colinwalton" <[email protected]> wrote in
    message
    news:epuu1t$kgv$[email protected]..
    >I am using frames (please don't tell me off!) and PHP.
    >
    > I want the title on the browser to change when one of
    the frames changes
    > in
    > the Frameset.
    >
    > Normally the title of the browser comes from the
    Frameset, But I am sure I
    > have seen websites where the title changes depending on
    one of the
    > frames...
    > how is this done?
    >
    > C
    >

  • Sizing two panels in a frame

    Hi,
    i would like to set the size of two panels which are next to each other in a frame.
    The left one should be about 5 times wider than the one on the right.
    splitPane.setPreferredSize(new Dimension(1000,500));This one is not working.
    Thx:
    james

    SplitPane is my right panel in the frame, this should
    be 5x wider than the right panel, It should be 5x wider than itself?
    So it is nothing to do with Splitpane, the problem is
    that 1 add the splitpane and the buttonPanel to
    mainPanel, and these 2 panels are which are added are
    the same wide!You should have posted a Short,Self Contained, Compilable and Executable, Example Program.

  • Change values in File physical schema during runtime?

    Is there any way to change the Directory in physical schema
    during runtime?
    This is needed so that we can dynamically get the files from
    different locations.
    Any help is highly appreciated.

    Hi,
    Yes there is:
    Create your physical schema to a parent directory and, at Physical Resourse (File Datastore) use a variable before the name of the file.
    Compose the variable with the "child" directory. I like to create the path on execution time.
    Does it help you?

  • Change Search Panel Name

    Hi All,
    Request you to help me to change search panel name. By default it shows, "SEARCH". I want to change it to "Search Goals". I have tried the following things. Its not working.
    OAQueryBean goalQueryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN");
    goalQueryBean.setText("Search Goals");
    goalQueryBean.setLabel("Search Goals");
    goalQueryBean.setCustomizePanelTitle("Search Goals");
    goalQueryBean.setShortDesc("Search Goals");
    Regards,
    Subhra

    Hi All,
    Please ignore this thread. I am able to dot it.
    Regards,
    Subhra

Maybe you are looking for

  • Lost my printer while trying to read Mac OS 10.4 install directions

    So there I was - happily living and working with Mac OS 9.2.2 on my 450 Ghz G4 - and I decided it was finally time to upgrade to OS 10.4 Tiger for the new bells and whistles. After reading about other people's problems with upgrading I went to my loc

  • Issues in Value Mapping...

    Hi Experts, I have an issue in Value mapping. For 2 to 3 target data  I have assigned same Group ID of source. 1) It is not allowing to segregate based on Group ID in the target area. 2) If I want to change the group Id of one of the assigned target

  • Advice for damaged jack? Intermittent sound

    I bought my Zen Micro on Ebay so I have no warrenty. I am wondering if anyone has come across any electronics repair places that repair this type of thing? All of the repair places I can find are for TVs and such. Or, can anyone advise me on how to g

  • Exchange 2013 2 Node Multi role Servers with DAG issues connecting OWA users

    Hi I am on a job at the moment whereby I have 2 exchange 2013 multi role servers. Both are CAS and Mailbox servers. I have 2 databases, 1 called MBXDB01 and the other MBXDB02. MBXDBX01 is on Server 1 and 02 on Server 2. I have created a DAG and inclu

  • GroupWise Help Required || Urgent

    hi Experts, please help me on below queries - (A) Create Contacts in Global Address book in Novell GroupWise server manually. i have exchange servers in my Organization and i want to view my exchange mailboxes in GroupWise Address book so that my use