Replace a component by another in a Frame

Hi all!
I've a frame with several component (panels, buttons...) set with a gridbaglayout.
I would like to know if i could replace a component by another.
For instance.
Frame f = new Frame();
button b1 = new button("b1");
panel p = new panel()....
f.add(b1)
/* replace b1 by p
like :
f.remove(b1);
f.add(p);
*/Thanks!

Sure, you can replace any component by enother one.
add f.validate() in the end.

Similar Messages

  • SOLAR02-replace logical component

    Dear Friends,
      I am working with Solution Manager 4.0, patch level SP12. In SOLAR01 i have finalised my business structure. Now in SOLAR02, i have assigned some logical component to link to satellite systems. i am having about 500 transactions in SOLAR02. Later point of time i realized that i have wrongly assigned the logical components to my 500 transactions. Now i want to replace my existing logical component with new one.
    In Sol Man, i am having the option to mass replacement of logical component.
    (Ths path is,  Edit---Replace logical component)
    Here, i am entering, Log. Component to be Replaced &  Replace with logical component. If i do the consistency check, i am getting message that , " Log component SAPR3 can be replaced with ZSAPR3".
    But if i save, i am getting following error.
    <b>The requested object is locked by another transaction</b>
    <b>The details of the error is below:</b>
    The requested object is locked by another transaction
    Message no. MC602
    Diagnosis
    A lock requested by calling an ENQUEUE function module cannot be provided because the object in question has already been locked by its own transaction.
    Technical Information: The C_ENQUEUE routine returns the following values:
    COLLISION_OBJECT =  ESOLARTAB
    COLLISION_UNAME = ZS933SENTHIL
    System Response
    The ENQUEUE function module triggers an appropriate exception. If this exception was not intercepted by the application program, it leads automatically to the active SAP transaction being cancelled.
    Procedure
    Once the ENQUEUE function module is called, the application program should intercept this exception and react to it appropriately.
    Message Text
    The requested object is locked by another transaction
    Technical Data
    Message type__________ E (Error)
    Message class_________ MC (Aggregate: views, matchcodes, lock objects)
    Message number________ 602
    Message variable 1____ ZS933SENTHIL
    Message variable 2____ ESOLARTAB
    Message variable 3____ ZS933SENTHIL
    Message variable 4____ 
    Message Attributes
    Level of detail_______ 
    Problem class_________ 
    Sort criterion________ 
    Number________________ 1
    Please guide me to solve this problem.
    Regards
    senthil

    Hi Senthil,
    you have selected a tab that can contain logical components and then started the replace functionality. Select a tab that does not contain logical components (e. g. the gen. Documentation tab).
    Best regards,
    Michael

  • Replacing layout component

    Dear all,
    I have created a JPanel and set it to GridLayout.......after adding all the components into the layout......i would like replace certain component(e.g. textfield) in the layout with another component (e.g. button)........is there a way that can directly substitute an added component at certain location of the layout without removing all components and adding them all again.....coz this will refresh the whole panel.............
    thx

    if so, how can i determine the index of the deleted component?I'm guessing the index is assigned in the same order the component is added to the container. So save the index when you are building the gui.
    Or you could always write a loop using the getComponent(...) method of Container. When you find a matching component you know the index.
    Not sure if this will work but you could try adding both components making one visible and the other invisible. Then maybe you could just toggle the visible property.

  • How to replace a component in the JPanel?

    Hi,
    I want to replace a component in the JPanel. My panel has GridBagLayout.
    Thanks in advance.

    because my application demands me to use GridBagLayout.No it doesn't, that a choice you made. You are never forced to use a specific layout manager. In fact most layout problems are solved by using combinations of layout managers. You two main choices are:
    a) use a GridbagLayout for the main panel and then a CardLayout for the two components you want to sway, although it may look strange if the components are a different size as the preferred size of the panel will be the size of the largest component
    b) Simulate a card layout using:
    panel.remove(...)
    panel.add(...);
    panel.revalidate(...)

  • How to replace one variable with another in large number of queries

    Hello guys!
    I have this situation: our company needs to use one variable instead of another for certain amount of queries.
    Is there some way to automatically replace one variable with another for a certain characteristic in big number of queries ( like 150 - 200 ) ? Doing this manually would take lots of time)
    Apreciate your help!

    you could try (at your own risk) the following:
    1. search the technical id (ELTUID) of your variable in table RSZELTDIR
    2. see where this variable is used in table RSZELTXREF (by filling RSZELTDIR-ELTUIID in RSZELTXREF-TELTUID)
    3. add similar entries for your new variable
    4. delete the entries for the old variable (they're part of the key, so you can't simply "change" them)

  • Replacement Path Variable with Another Variable

    Hi,
    I am currently trying to create a report that would need me to have the same values for different characteristics (e.g. clearing date, posting date, net due date). I have seen that there is a way in the replacement path variable that would replace its value with another variable that is ready for input. I also looked into SAP help but I can't seem to figure out on how to do it specifically. Does anyone know a step-by-step process on how to do this? How does this work?
    Thank you in advance!

    take an e.g.
    u have characteristic say ch1
    u want to restrict it with replacement path variable
    first of all create a variable var1
    click what it is based upon for e.g. 0calday, 0material etc.
    make it user entry variable
    select single or multiple entry
    make it mandatory
    save it and hit okey
    click on ch1
    right click and say restrict
    in new window create a new variable
    give its name and technical name
    processing path is replacement path
    go to next tab of replacement path
    select several ooptions
    replace variable with another variable
    select a variable called var1
    change the offset length and offset start with different parameters.
    hit okey
    this way u have restricted ch1 with replacement path variable var1
    now when u run report u have to enter value of var1
    which will then further feeded to ch1
    this way u can create replacement path variables at lots of instances and then u can always feed the value from var1 at different time
    make sure as this ur requirement is date
    try to use 0calday as reference infoobject all the times....

  • Since i got the new Iphone 4s it constantly drops calls. Apple have replaced the phone with another new iphone 4s but i am still having the same problem. I have checked with vodapohe that there is no issue from there end, given a new sim, still drops out

    Since i got the new Iphone 4s it constantly drops calls. Apple have replaced the phone with another new iphone 4s but i am still having the same problem. I have checked with vodapohe that there is no issue from there end, given a new sim, still drops out

    Have a look at this it might help
    http://support.apple.com/kb/TS4148

  • Replace Logical Component

    I need to complete a mass change of logical componets on my implementation project.  We initially were on ECC 5.0 with a logical componen on ECC.  We have recently upgraded to ECC 6.0 and have a new logical componeont of ECC_EHP.  In the Edit menu, there is an option to replace a logical component.  I can execute the step where I indicate what logical component I want to find and what logical component I want to replace it with, however, when I run it I receive a message:  "Logical Component Replc. Error".  Has anyone successfully got this to work?  Any help?

    I opened a message with SAP, the steps in their response worked:
    Start transaction SOLAR_PROJECT_ADMIN and open the project where
    you would like to replace the log. component.
    Here change to the tab: 'System Landscape' and select the tab 'Systems'
    Here now select the log. component you would like to replace and
    press the button: 'Replace. log component' at the bottom. (the second
    one from left)
    In the following popup select the desired log component.
    (if the one you are looking for is not visible, please press the
    button 'All logical components' and search for the one you would like)
    After you have selected the componet press the OK button.
    At the end you will receive a message that states that the logical
    component has been replaced.

  • Replace logical component in Solution_directory

    Hi
    We have imported a project to Solution that used the logical component "ERP".
    The second proect was imported with its logical component "ERP2".
    This has turned out to be a wrong approach, and we want to replace the ERP2 component with "ERP".
    Does anyone know if this can be done without checking our productive solution out to the maintenance project and doing it here?
    I have tried, in the Solution to say "replace logical component", but apparently I cannot replace it with a component that is already in the Solution.
    Anyone???
    Kind regards
    Anja

    Hi Anja,
    if you have activated "Check-out/Check-in", it is not possible to replace the logical component in the solution, because it is only available in display mode. If it is possible for you to switch Check-out/Check-in" temporarily off, you can do the replacement via the menu "Edit --> Replace log. Comp...".
    Best regards,
    Michael

  • How to replace a movieclip with another movieclip

    How to replace a movieclip with another movieclip
    Hi,
    I am having a swf called tchild.swf... in this i got a
    movclip 'child1'. i am loading this tchild.swf into another swf
    tparent.swf within 'mcloader' movie clip.. i got another movclip
    called 'picture1'
    i am loading tchild.swf into mcloader movclip.. and i want to
    load 'child1' moviclip into picture1..
    how to replace a picture1 movieclip with child1 mc..
    PS: i dont want to load picture1 from library.. its on the
    stage.

    AWT or Swing?

  • Calling Inbound Plug of one Window of one Component in another WD Component

    Hi All,
        Can anyone please tell me how to call a Window's Inbound Plug of one WD Component in another WD Component.
    Thanks in advance!
    Best Regards,
    Devyani

    Hi Devyani,
        are you calling the view (embeded in a window ) of a component 1 in component 2. If so,
    1. Define the used component(Component 1) in the using component (Component 2)
    Component Use : Comp1
    Component        : Component 1(Name of the component)
    2. On action: using component usage window, window of component can be called as a pop up window in component 2
    If this is not your requirement, let me know. i will try to help
    Regards,
    Sankar

  • Replacing multiple spaces with another character

    i need to replace multiple spaces with another char in a string
    my code is
    Dim text as String="a bit much             a little much" Dim arr As String() = text.Split({" "c}, StringSplitOptions.RemoveEmptyEntries)Dim newtext As String = String.Join(" ", arr)            MsgBox(newtext)           
     it returns to "a bit much  a little much "
    But i want to replace only long spaces with "="  as  "a bit much =a little much"
    How can i do that?

    This version uses two spaces to split the string and then trims any additional single spaces. It returns "a bit much = a little much".
    Dim text As String = "a bit much a little much "
    Dim parts() As String = text.Split({" "}, StringSplitOptions.RemoveEmptyEntries)
    Dim newText As String
    If parts.Length = 2 Then
    newText = parts(0).Trim & " = " & parts(1).Trim
    End If

  • Trying to use a popup window as a component  in another component

    Hi guys,
    I am unable to use a popup component in another component in
    Flex .
    Its not calling the popup compopnent.
    Could anyone plz hel me.
    This is my code.
    This is the parent component TitlWindow where i want to call
    my popup
    component.
    <mx:TitleWindow xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" width="100%" height="100%"
    xmlns:util="userinterfaces.util.*"
    creationComplete="showWindow();"
    title="CREATE PROFILE">
    This is my script where i am writing a function to call a
    component
    whose name is fielupload.mxml
    <mx:Script>
    private function showWindow():void
    pop =
    fileupload(PopUpManager.createPopUp(this,fileupload,true));//
    fileupload.mxml
    is called
    pop.title = "Please enter your login information.";
    pop.showCloseButton =true;
    PopUpManager.centerPopUp(pop);
    pop.addEventListener("close",removeMe);
    </mx:TitleWindow>
    This is the code for fileupload.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" width="100%" height="100%"
    xmlns:util="userinterfaces.util.*" title="File Upload">
    <mx:Script>
    <![CDATA[
    import mx.collections.XMLListCollection;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.events.ProgressEvent;
    import mx.controls.Alert;
    import flash.net.FileFilter;
    import flash.net.FileReference;
    import flash.events.SecurityErrorEvent;
    import mx.controls.Button;
    import mx.controls.TextInput;
    import mx.controls.ProgressBar;
    import mx.core.Application;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import mx.core.UIComponent;
    import mx.managers.PopUpManager;
    public var fileFilterImage:FileFilter = new
    FileFilter("Images","*.png;*.gif;*.jpg");
    public var fileFilterDocument:FileFilter = new
    FileFilter("Documents", "*.txt;*.doc;*.pdf;*.rtf");
    public var fileFilterArchives:FileFilter = new
    FileFilter("Archives", "*.zip;*.tar;*.hqx");
    public var fileFilterAll:FileFilter = new
    FileFilter("All", "*.*");
    public var fileRef:FileReference;
    public var selectedId:String;
    public function init():void {
    fileRef = new FileReference();
    fileRef.addEventListener(Event.CANCEL,
    traceEvent);
    fileRef.addEventListener(Event.COMPLETE,
    completeEvent);
    fileRef.addEventListener(Event.SELECT,
    selectEvent);
    fileRef.addEventListener(IOErrorEvent.IO_ERROR,
    traceEvent);
    fileRef.addEventListener(Event.OPEN, traceEvent);
    fileRef.addEventListener(ProgressEvent.PROGRESS,
    onFileProgress);
    fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    traceEvent);
    public function traceEvent(event:Event):void {
    var tmp:String =
    "================================\n";
    public function
    ioErrorEvent(event:IOErrorEvent):void{
    Alert.show("IOError:" + event.text);
    traceEvent(event);
    public function selectEvent(event:Event):void{
    //var selectedId:String =
    selectButton(event);
    //Alert.show("i am in id" +
    Application.application.winMyProfile.selectedId);
    btnUpload.enabled = true;
    iptFile.text = fileRef.name;
    public function
    selectButton(catchButton:Event):void{
    var newButton : Button = new Button;
    newButton = catchButton.currentTarget
    as Button
    selectedId = newButton.id;
    //Alert.show("i am in id" +
    selectedId);
    public function
    onFileProgress(event:ProgressEvent):void {
    prgBarUpload.label = "Loaded " +
    event.bytesLoaded + " of " +
    event.bytesTotal + " bytes";
    prgBarUpload.setProgress(event.bytesLoaded,
    event.bytesTotal);
    public function
    completeEvent(event:Event):void {
    Alert.show("File Uploaded
    Successfully");
    btnUpload.enabled = false;
    btnBrowse.enabled = true;
    public function uploadFile(url:String):void {
    url = url + "?
    folder="+Application.application.winLogin.userInfo.getUsername();
    var req:URLRequest = new
    URLRequest(url);
    req.method = URLRequestMethod.POST;
    var folder:String =
    Application.application.winLogin.userInfo.getUsername();
    fileRef.upload(req, folder,true);
    ]]>
    </mx:Script>
    <mx:VBox id="vbMain" width="100%" height="60">
    <mx:HBox width="100%" height="22">
    <mx:TextInput height="22" id="iptFile"
    width="100"/>
    <mx:Button id="btnBrowse" label="Browse"
    click="selectButton(event),fileRef.browse([fileFilterAll]);"
    />
    <mx:Button id="btnUpload" label="Upload"
    enabled="false"
    click="uploadFile('fileupload.do');" />
    <mx:Button id="btnCancel" label="Cancel"
    enabled="false"
    click="PopUpManager.removePopUp(this);"/>
    </mx:HBox>
    <mx:ProgressBar width="200"
    source="iptFileResume" height="5"
    id="prgBarUpload" mode="manual"/>
    </mx:VBox>
    </mx:TitleWindow>
    Its not even showing any error , i dont know whats the
    problem with
    it.
    Thanks for your help,
    Mario.

    If I understand, you want to display a popup Titlewindow from
    within another popup TitleWindow? This is possible.
    Simplify your code to get it working first.
    Tracy

  • Replace the component name to universal?

    Hi!
    I have put some code into the "FocusLost" event of the jTextField. Here is it:
    private void jTFprobaFocusLost(java.awt.event.FocusEvent evt) { 
    if(jTFproba.getText().equals("wrong"))
    jTFproba.setBackground(Color.red);
    else
    jTFproba.setBackground(Color.white);
    jTFproba.setText("OK");
    It works, but I have about 20 similar TextBox in my application and I am interested in whether it is possible to replace the name of the component (jTFproba) to something universal like "this"?
    For example:
    private void jTFprobaFocusLost(java.awt.event.FocusEvent evt) { 
    if(this.getText().equals("wrong"))
    this.setBackground(Color.red);
    else
    this.setBackground(Color.white);
    this.setText("OK");
    But it does't work!
    Do you have any ideas to replace the component name?

    See the documentation of FocusEvent. It has a getComponent() method that I assume returns the component that has lost the focus (in your case, a JTextField instance). You can add the same listener to all JTextField instances, and cast the source to JTextField.
    It also has a getOppositeComponent() method that presumably returns the component that has gained the focus, if that matters.
    I assume for a focusGained() callback it's the contrary.
    Edited by: jduprez on Nov 4, 2010 2:55 PM
    Mixed method names, so reverted to a conservative "I assume" description

  • Qosmio X500-10W - Can I replace the HDD with another one?

    Hello
    I have a Qosmio X500-10W with two HDD Toshiba MK5055GSX 500GB 5400RPM 8MB ??SATA II but is one of hs so I wonder if I can be replaced by a more powerful style HDD 750GB 7200tr / min 16MB Toshiba course?
    merci

    Hey,
    Your question is a little bit hard to understand but I think you want to replace the HDD with another (faster) model, right?
    Well, thats no problem. HDDs with 7200rpm will work, they are a little bit louder but they are faster so if you need more performance no problem.
    Also 750GB or more is no problem because SATA interface is not capacity limited. Theoretically 1TB or more should also work.
    Anyway, you can buy the 750GB you mentioned it will work. :)

Maybe you are looking for