How to address a component in a background tab in a JTabbedPane

Hello and greetings for everybody, this is my first post here. I have a question:
I want to write a simple little chat program, which makes use of a JTabbedpane, and if the user gets a private message from another user, it would open a new tab with the given user's nick in the tab title, and would create a JTextArea on the opened tab and write the message to that specific JTextarea. My question: Is it possible to write on the JTextarea, while the given tab is in the background? How can I address that specific JTextarea on the specified tab?
Thank you very much in advance for the answers, and I wis you all a nice day!

// create a Map<String, JTextArea>
public static void privMsg(String nick) {
        if (mainwindow.tabpane.indexOfTab(nick)==-1) {  // look for the nick in the map, not on the tabbedpane (if map.get(nick) != null
            javax.swing.JScrollPane panel=new javax.swing.JScrollPane();
            javax.swing.JTextArea msgBox=new javax.swing.JTextArea();
            msgBox.setEditable(false);
            msgBox.setAutoscrolls(true);
            msgBox.setLineWrap(true);
            panel.setViewportView(msgBox);
            mw.tabpane.addTab(nick,panel);
            mw.tabpane.setSelectedIndex(mw.tabpane.indexOfTab(nick));
            msgBox.append("Private conversation: "+nick+"\n");
            // add the nick and the msgBox to the map
        // if the nick already has been added to the map, (meaning there's already a tab open for that nick), then get that textpane and write to it. That's the basic idea behind MVC, which you'd do yourself a huge favor by reading into. You separate the display of the data from the data itself. That way when you update the data (Model), you don't have to deal with gui code (View). The actions the user takes are also separated into the Controller.

Similar Messages

  • How to Address This scenerio ( Automobile Industry)

    Dear All,
    We are Implementing Automobile manufacturing Industry. In this Industry they have one Mould for preparing Bumber.
    Here In single Mould they charging all Raw materials and geting Two Output Bumper Means Right bumper and Left Bumper in same time.
    Means in Single shot they getting both Right and left bumper always.
    They want both Right and left bumper in seperate material but order is single?
    How to address this
    Regards,
    sakthivel

    Dear Sakthivel,
    Check this process,
    1.Assume you have 3 different material codes,one for the input material say R and the other 2 for the main products say X and Y.
    2.Create the BOM for X and assign the input material R with quantity 1 or the related quantity and maintain another component as
    Y with the indicator co-product set for this material Y in the material master as well in the BOM under Basic Data tab page and this
    should be listed with a negative quantity.
    3.Prerequisite for the main product:
    The indicator Co-product must be activated in the material master of the main product (MRP area)
    Prerequisites for a co-product:
    The indicator Co-product must be activated in the material master of the co-product (MRP area)
    The co-product must be listed as an item in the bill of material of the main product
    On the Basic data tab page of the BOM item, the indicator Co-product must be activated in the field group General data.
    Also check this link,
    http://sapfunctional.com/PP/Co&BiProducts.htm
    But if you are going to map this under REM scenario,then you cant treat the material as co-product.
    As co-product scenario is not supported in standard SAP  in Repetitive manufacturing scenario.
    Regards
    S Mangalraj
    Edited by: Mangalraj.S on Oct 29, 2010 3:21 PM

  • How to construct the component tree in my custom component?Help!

    Hi, i am writing a custom component like this:
    public class HtmlCategory extends HtmlPanelGrid
         public void processRestoreState(javax.faces.context.FacesContext context,
                java.lang.Object state)
              setColumns(1);
              HtmlCommandLink link=new HtmlCommandLink();
              link.setValue("Let's Bingo");
              MyUtil.setActionListener(context,link,"#{temp.mytest}");
              UIParameter param=new UIParameter();
              param.setName("name");
              param.setValue("Robin!");
              link.getChildren().add(param);
              param.setParent(link);
              getChildren().add(link);
              link.setParent(this);
              super.processRestoreState(context,state);
    }         you see, i want to construct the compont tree at Restore View phase this way,because the structure of the component tree will always be the same, so i don't the user to write extra code.
    But the children of the component are not rendered,the renderer of the HtmlCategory component just extends the HtmlGridRenderer(myfaces) directly,and always calls the "super" methods in the encode methods of the renderer.
    I got a message from the console:
    Wrong columns attribute for PanelGrid id0:id4: -2147483648
    but i have set the columns attribute in the code above, so what's happening? or please give some advice about how to render the component tree by myself in Restore View with the tree constructing code in the custom component class code,just lke the code above.
    Best Regards:)
    Robin

    Well, i don't know if i have got my question clear.
    usually, according to the tags you use in the jsf page, a component tree will be created at the Restore View phase,for example:
    <f:form>
      <h:panelGrid ...........>                         
              <h:dataTable ................>
              </h:dataTable>
       </h:panelGrid>
    </f:form>but because i am writing a component for my web app, all the child components and their attributes are not likely to change. so i want to reduce the tags into one custom tag, and construct the component tree internally by myself.But it is not the case of backing bean.So i wrote the the code in the method:
    public void processRestoreState(javax.faces.context.FacesContext context,java.lang.Object state)as it is shown in my orginal message.But it seems that it is not right way to construct my component tree.So where should i put the code that construct the component tree?Overriding the method :
    public void processRestoreState(javax.faces.context.FacesContext context,java.lang.Object state)is not the right way?
    Best Regards:)
    Robin

  • How do I stop Firefox unloading background tabs?

    Hi there,
    Can anyone tell me how to stop firefox for android unloading tabs it thinks are in the background and not being used?
    Here's the situation - I had about 5 tabs open in firefox on my Galaxy Note (around 1GB memory) and no other applications open. 4 were from a forum site (few/no graphics, nothing fancy in the page layout, shouldn't have large RAM requirements). I was writing a long post, I opened the fifth tab and performed a google search, dipped into wikipedia to check something, then went back to my post. I went through each of the other tabs to get there as the thumbnails all looked the same. Each one had been unloaded from memory (zombified) and was reloaded fresh, losing all the stuff I had been writing and seemingly knocking the others out of memory. This meant that by the time I found the right tab again what I had been writing was lost.
    This behaviour is annoying, not just because you lose form data, but also for slow connections and metered connections it re-grabs the entire page, wasting time and data allowance. The entire point of background tabs (for me) is that the data is there waiting to be read, it is not just a bookmark.
    I understand why the developers did this, to save memory on android devices, but it's far too aggressive.
    Is there an about:config setting that allows me to stop this behaviour? Is there any way to stop firefox doing this?

    I have had this problem for quite some time through many versions of Firefox. It has also done this on the stock browser. Actually very irritating. I often at times will have multiple tabs open (About 3) and sometimes I will be writing something,, stop...then go to another tab to check something on Google or copy sone text...start to go to the other tab, it's still there but the entire page reloads and I lose the message/comment I was writing. I have made a habit of using the copy/paste function for fear of losing all of what I wrote..happened one too many times. And in the case of copying from another page, you just have to hope your text is still there......:/

  • How do I set FF to always open links in a background tab? (as if ctrl-left click is always on)

    I used to have FF set to to this, but since upgrading to a new laptop, I cannot figure out *how* I set it up to open all links as background tabs. I do have TabMix installed, and obv. I can ctrl-click, but I want that to be the default setting.

    Thanks, that was the first thing I did, never worked as I thought it would. I ended up using about:config and finding "browser.tabs.loadDivertedInBackground," switched that to true and things are back to normal.

  • How many addresses can i send an e mail to in one go? is there a limit?

    I am trying to send a mail to all my contacts in one go. is there a limit on how many addresses can be entered into the to/cc or bcc lines in one go?

    Every mail service provider imposes such limits. The limits for iCloud are given here:
    iCloud: Mail specifications
    For legitimate bulk mailing, you should use a hosted service such as "MailChimp."

  • How to display the Component view in the Pop up

    HI.
    I created one Z Component.
    In that i put one Button name as a POPUP.
    when i press that Button i want open an another component View or Same Component another View.
    How it is possible.
    I am writing the code in Event Handler.
    CALL METHOD COMP_CONTROLLER->IF_BSP_WD_WINDOW_MANAGER~CREATE_POPUP
      EXPORTING
        IV_INTERFACE_VIEW_NAME = 'ZKRI_NAVIGATION/DetailsOV' 
        IV_USAGE_NAME          =  'ConfigStdAlone'
        IV_TITLE               = 'Hello'
      RECEIVING
        RV_RESULT              =  confirm_popup.
    confirm_popup->set_on_close_event( iv_event_name = 'POPUP_CLOSED' iv_view = me ).
      confirm_popup->open( ).
    But i did not get the Popup with the view.
    How it is possible. Please expalin how to call another view in pop up with in the Same Component.
    How to call another component view

    Hi,
    Did you create a component usage of the Z component in the Run time Repository ?
    You can look into any of the standard fields with an F4 help for sample code..like Business Partner etc.,
    Regards,
    Masood Imrani S.
    Edited by: Masood Imrani on May 12, 2009 4:23 PM

  • Three Numbers questions:how do you change the auto default background or fill color from white to another color to use in multiple succeeding operations?  what is the formula to express the ratio of two numbers as a percent?

    Numbers questioons:
    -how do I change the automatic default background fill color so it stays a non white color?
    -what is the formula to express the ratio of two numbers as a percentage?
    -how do I create a signal formula to be sue against an entire column of data (for example, if I wanted to multiply the each cell in the column by the number 10)?
    -I have created a spreadsheet in Numbers with header and rows labelled and it contains formulas as well.  I now want to create a new 'blank' of this template with same header and row names and formulas, but without the cell entries from my earlier exerciser so I can use again in the future. How do I do this?

    Hi Matt,
    For short columns, the easiest method is to select the cell containing the formula, then grab the fill handle (small circle at the botom right of the selected cell) and drag down.
    For long columns, use either Jerry's suggestion (copy/paste) or Insert > Fill > Fill Down.
    Copy/Paste:
    Select the cell containing the formula. Copy
    Select from the cell containing teh formula to the end of the column. Paste.
    Fill Down:
    After entering the formula, and pressing enter...
    Click on the column reference tab to select the whole column.
    Command click on each cell above the one containing the formula to remove it from the selection.
    When cell with the formula is the top cell in the selection, go Insert > Fill > Fill Down.
    Pick whichever is easiest.
    Regards,
    Barry

  • How to address this critical scnerio

    Dear All,
    We are implementing SAP in one PET manufacturing Industry.
    Here they Manufacturing PET Bottles, Actually for Making PET bottles they procured Raw Materials from outside through Purchase order and same time the same customer is also giving same Raw Materials (Free of cost) for the production.
    Currently they are not maintaining separate stock for own purchase and customer raw materials, everything they keeping in single material code and output also single material code. End of the year they using material reconciliation and getting some credits from customer.
    How to address this scenario in SAP, whether we have to create separate material codes for RM purchase and RM customer and separate material codes for FG also.
    Or single code for RM and FG.
    Kindly give your valuable suggestions, actually user not ready for seperate codes for seperate code for RM and FG
    Regards,
    Sakthivel.S

    I think for costing purpose, in consideration of logistics side, the valuation split for Finished goods may sound right for your scenario.
    You may want to create two BOMs, one for own raw material.  Another, you can use the different code for raw material provided by customer and unflag costing relevancy.  You can use mixed cost estimate to perform standard cost estimate per valuation type.  The benefit of this is to separate the costs per FG using own or customer raw material.  You may also want to activate batch management for FG as well (therefore, can be monitored easier and able to do batch determination).
    However, you must separate production orders since one production order can have only one valuation type.
    If you can't do that, then you may want to split only raw material via valuation type as well.  You maintain BOM as normal, FG is valuated per moving avg. of raw material at the time of planning (or may use other method for example, planned price).   You may need to develop customized report to calculate FG/rm owned by customer report.  Alternatively, it is recorded in material documents so you can simply use MB51.
    Hope it helps.

  • How to change material component for a Purchase Order?

    How to change material component for a Purchase Order?
    I need FM .
    PLEASE help

    Dear ,
    Create PO with item category L....There in Item detail you will get tab for material.
    There click in component Button, it will take you to the component screen there you can assign and deassign components.
    Hope this helps.
    Regards
    Utsav

  • How to extract every component in an array?

    Hello everyone!
    Do you know how to extract every component from an array field?
    For example:
    The following is the defination of a table:
    CREATE TABLE test (
    id NUMBER PRIMARY KEY,
    name VARCHAR2(32),
    shape MDSYS.SDO_GEOMETRY
    And then I insert a new record:
    INSERT INTO test VALUES(
    1,'first',
    MDSYS.SDO_GEOMETRY(
    2003,
    NULL,
    NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
    MDSYS.SDO_ORDINATE_ARRAY(1,1, 5,7)
    The Question is I want to read the every component (for example 1,1,5,7) in the sdo_ordinate_array one by one. Who knows how to write the SQL?
    I have tried "select a.shape.sdo_ordinates(1) from test a". But it can't work.
    Thank you very much!

    One solution is to read each ordinate from a cursor ina SQL block. Here is an example:
    set serveroutput on
    SET serveroutput on SIZE 1000000
    set concat on
    DEFINE layername = 'LAYER';
    DEFINE geomcolname = 'GEOM';
    DECLARE
    id varchar2(10);
    longitude number;
    latitude number;
    logmile number;
    i number;
    theLayer varchar2(32);
    theGeomCol varchar2(32);
    BEGIN
    FOR rec IN (SELECT ROWID, id, &geomcolname FROM &layername ) LOOP
    id := rec.id;
    i := 1;
    while i < rec.geom.sdo_ordinates.count loop
    longitude:=rec.geom.sdo_ordinates(i);
    latitude:=rec.geom.sdo_ordinates(i+1);
    logmile:=rec.geom.sdo_ordinates(i+2);
    dbms_output.put_line(id || ',' || longitude || ',' || latitude || ',' || logmile);
    i := i + 3;
    end loop;
    END LOOP;
    commit;
    END;
    Maybe that will help.
    Dave
    David R. Miller
    Michael Baker Jr., Inc.
    3601 Eisenhower Avenue
    Alexandria, VA 22314
    [email protected]
    www.mbakercorp.com

  • Urgent !please help!! how to get children component in encodeBegin()?

    hello all
    how can get children component in encodeBegin()?because when encodebegin the tree is not constituted so i can't get children component,how to solve?
    please help!

    You aren't providing enough information to know for sure what is going on, but a likely problem is that you're rendering a JSP page with a new component tree for the first time, so the components are getting built as the page executes.
    In the EA3 release, this caused a problem, because encodeBegin() was called from the doStartTag() method of the JSP tag (i.e. before the child components have been created). However, in EA4 the call to encodeBegin() was moved to doEndTag(), so the child components should now be getting created already.
    In order to debug this any further, we'll need a specific example of what you're doing, and what version of JavaServer Faces you're trying it with.
    Craig

  • How to delete Software Component in XI ?

    Hi,
    I have created a Software component with a NameSpace Containing Some Scenarios. Now i would like to delete this Software Component as a whole from the IR.
    I tried deleting :
    1.From the SLD Software catalog - Deleted the s/w product and associated component , it was deleted in the SLD s/w catalog but no effect in the IR Side.
    2.Deleted all the XI Objects and NameSpace in IR , but still empty software component exist in IR.
    Any help in this Regards will be appreciated...

    See this
    /people/siva.maranani/blog/2005/05/22/how-to-delete-software-component-from-integration-builder
    Regards,
    Prateek

  • How do I get a full screen background on my site?

    How do I make a resize-able background in my iweb site so that it's full screen no matter the browser size?

    https://discussions.apple.com/thread/3183484

  • How to set a image as a background in a frame

    How to set a image as a background in a frame

    The following code works well in Notepad command prompt but it is not working on netbeans
    I want to set a background image in a frame(awt or swings ny will do) or a panel through netbeans
    1. import java.awt.*;
    2. import java.awt.event.*;
    3.
    4. public class ImageFrame extends Frame
    5. { 
    6. private ImageCanvas c;
    7. private Image i;
    8. ImageFrame( Image i )
    9. { 
    10. this.i = i;
    11. c = new ImageCanvas( i );
    12. add( c );
    13. }
    14.
    15. public static void main( String[] args )
    16. { 
    17. Toolkit tk = Toolkit.getDefaultToolkit();
    18.
    20. Image im = tk.getImage( "WashuChan.gif" );
    21. ImageFrame f = new ImageFrame( im );
    22. f.addWindowListener( new WindowAdapter()
    23. { 
    24. public void windowClosing( WindowEvent e )
    25. {  
    26. System.exit( 0 );
    27. }
    28. } );
    29. f.setSize( 300, 300 );
    30. f.show();
    31. }
    32.
    33. private class ImageCanvas extends Canvas
    34. { 
    35. Image i;
    36.
    37. public ImageCanvas( Image i )
    38. { 
    39. this.i = i;
    40. }
    41.
    42. public void paint( Graphics g )
    43. { 
    44. g.drawImage( i, 0, 0, this );
    45. }
    46.
    47. public Dimension getPreferredSize()
    48. { 
    49. int w = i.getWidth( this );
    50. int h = i.getHeight( this );
    51. return new Dimension( w, h );
    52. }
    53. }
    54. }

Maybe you are looking for