JTabbedPane: Contents changes in different tab.

My applet consists of a jtabbedpane with 3 tabs. each tab consists of a panel, which in turn consists of a jComboBox and jTextArea. my problem is when i click on an item in jComboBox of tab 1, nothing happen with jTextArea in tab 1, but changes are in jTextArea of tab 3. actionlistener of the jComboBox cant cannot be compile if i put jTextArea as local var. so my jTextArea is a global var. please advice.

Im implementing RMI application btw, this is the client code:
public class Client extends JApplet
JTabbedPane tabbedPane;
JTextArea txt;
JComboBoc jcb;
String str;
public void init()
try
tabbedPane = new JTabbedPane();
JComponent tab1 = setPanel("ABC");
tabbedPane.addTab("ABC",tab1);
//tab2 and tab3
//setting layout
catch (Exception ex)
protected void getPanel()
try
//RMI connection to server goes here
//RMI accessing server objects goes here
//s.getText() is server object
//JTextArea is set for different content type for diff tab
txt.setText(s.getText());
catch (Exception ex)
protected JComponent setPanel(String input)
JPanel pnl = new JPanel();
txt = new JTextArea(20,60);
txt.setLineWrap(true);
txt.setWrapStyleWord(true);
getPanel();
jcb = new JComboBox(itemList);
jcb.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
JComboBox cb = (JComboBox)e.getSource();
str = (String)cb.getSelectedItem();
getPanel();
//setting layout
return pnl;
When the applet is initialize, everything goes fine. what i mean is tab1 has its own content of JTextArea, so do tab2 and tab3. but when i click on an item of JComboBox in tab1 or tab2, changes made are at JTextArea of tab3.
If JTextArea is declared as local in setPanel, the getPanel would not access the JTextArea.

Similar Messages

  • Multiple tabs open, will not show content on a different tab when clicking on it.

    When I have multiple tabs open on Firefox and click on one of the other tabs, it will not change to the newly clicked tab. It will continue to show the previous tab that was open. If I move the mouse around the page, then some of the pictures will appear on top of the previous page.
    The only way that I have been able to correct this is to reopen a different tab and then open the tab that I wanted open in the first place. Once I do the back and forth, the tab will show the content that is displayed on that tab.

    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

  • Version 5.0 on a MAC will not let me switch between tabs. I can open a new tab, but when I try to go to a different tab, it just shows me the contents of the tab most recently opened. Help!

    Version 5.0 on a MAC will not let me switch between tabs. I can open a new tab, but when I try to go to a different tab, it just shows me the contents of the tab most recently opened. Help!
    Also, pop up blocker works for some time and then just stops working. I have to close and restart Firefox to get it to work again. Help!

    I had the same problem, but with Firefox 4.0. My first thought was to update Firefox (after of course restarting FF), but that didn't help it and I had the same problem.
    Among others, I had an extension installed and enabled called Tile Tabs 4.10 that I thought could feasibly creating this problem. So I went into my add-ons manager and disabled it, restarted Firefox and the tabs worked properly again. Unfortunately, the Tile Tabs extension is my favorite Firefox add-on and I use it almost every day for managing my web work tasks. I went to the add-on page for Tile Tabs and saw that there was a notice that version 4.10 didn't work properly on Mac OS, and to install version 4.9 of the extension. I saw they had a new, not-yet-reviewed version 4.11 that addressed the Mac OS problem, installed it, and everything seems to be working properly.
    I have no idea why all of a sudden I had this problem, as I hadn't updated Firefox or the Tile Tabs extension recently. Also, obviously this might not address your problem, especially if you don't have that add-on installed and enabled. But our problem started at the same time for both of us it appears based on your post time, so its probably not coincidence.
    But its worth a look, and you might want to check out other extensions if you don't have Tile Tabs that could be causing the problem.

  • Sharing objects between different tabs on a JTabbedPane

    Does anyone know how to share objects on different tabs of a JTabbedPane? I.e., I want the same buttons/corporate logo to appear on each tab in the same location, and thus the same functionality, locations, look, etc...
    Currently, if I invoke the add(Component) method for the same component but for different panes, only the pane that had the last add() method called contains the object.
    Thanks,
    adam

    An instance of a GUI component can only be in one place in the GUI (visible or not).
    You could make your own component class (extending JPanel and containing other components you want) and then create an instance of this for each tab.

  • JTabbedPane and content placement on the tab

    Hello,
    I created a tabbed pane using JTabbedPane. Added two tabs to it using addTab. One of the tab's content is quite tall while other tab's content is quite short. Contents of both tab are created and added to JPanel which is then added to the tab.
    When that window is displayed, contents in the short tab shows at the center of the screen. How do I make contents from short tab display at top....kind of like bind to the top.

    Of the many possible ways, the one that first comes to mind is to add the panel containing your "short" contents to a panel with a BorderLayout at NORTH, and add the outer panel to the tabbed pane.
    db

  • My tabs change when i sign into something else so instead of different tabs they all become the same

    I play a myspace game and open a tab to one of my games. I sign out of that acct and log into another acct. The tab that I opened changes to the new login and so I cannot get more then one acct up on the tabs. It has not done this before and it does not do it with Opera, I can open more then one acct with different tabs.

    Try the Multifox extension. <br />
    http://br.mozdev.org/multifox/

  • Changing BP data to different tabs in transaction BP

    Hi everyone,
    I'm trying to swap around some data in the bp screen.
    Mainly, when an account is entered I want some of the information that I currently have showing up under a tab 'marketing attributes' to show in a different tab 'customers', which I also want to rename.
    If anyone could point me in the right direction to doing this it would be much appreciated.
    Have been digging around but no luck so far.

    Hi Kieran,
    Sorry for that incomplete reply ! The text editor just suddenly quit !
    Here's a link-
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/309bff90-d36f-2910-c9b2-fe8ab0d547e9]
    You can also see the documentation for the screen configuration tool through the path -
    Transaction SPRO -> SAP Reference IMG-> Cross-Application Components -> SAP Business Partner -> Business Partner-> Basic Settings-> Screen Configuration-> Configure Screens
    The 'Execute' button takes you to BUC0, the documetation button opens up a lot of good info docs.
    There are also many documents on SDN that you could search for using terms VCT and screen configuration.
    Cheers,
    Rishu.

  • How can i set different font for different tabs/pages

    I want to set different fonts for different tabs/pages?
    is it possible to do the same? If yes how?
    I can change the fonts under tools>options>contents>advanced. but that changes global settings.
    tried some add ons too- but that too changes the global settings.
    some pages like tweetdeck do not display icons etc properly under custom fonts.
    when i check "allow pages to select their own font" tweetdeck shows up fine but a number of other pages show fonts that are too big or some non standard fonts.
    Is there a way where i can select site default fonts for some sites/tabs, and custom fonts for other sites/tabs?
    otherwise i have to open different sites in different browsers- say i use my custom fonts- which apply globally, and open tweetdeck etc in Internet Explorer or Chrome etc. if i can have all tabs in one window/browser, that would be great.

    It's not a built-in feature to override a page's styles on a tab-by-tab or site-by-site basis, but perhaps someone has created an add-on for this?
    It also is possible to create style rules for particular sites and to apply them using either a userContent.css file or the Stylish extension. The Greasemonkey extension allows you to use JavaScript on a site-by-site basis, which provides further opportunity for customization. But these would take time and lots of testing to develop and perfect (and perfection might not be possible)...
    Regarding size, does the zoom feature help solve that part? In case you aren't familiar with the keyboard and mouse shortcuts for quickly changing the zoom level on a page, this article might be useful: [[Font size and zoom - increase the size of web pages]].

  • Download to excel in different tabs from bsp page

    Hi all,
    I have a requirement in which I have to download to xl-sheet in different tabs based on some conditions from a bsp page.
    I am successful in downloading data into different tabs.
    Now I had written the piece of code required to download to xl in a function module
    and I am calling that function module when pressing a button in bsp page.
    When I run the fm seperately its working but when I run it from bsp page its not working.But while debugging I found that the fm is being called and executed perfectly without any errors.
    But the xl is not being created on our side.
    Can anyone suggest me how to proceed on this.
    Helpful answers will be rewarded.
    Thanks,
    Uga

    Hi Raja,
    Yes I am using ole objects.
    For more clarity I am alos pasting my code.
    If this is not possible then please guide how to achieve this in BSP.
    *******************CODE*****************************************
    include ole2incl.
    data: w_cell1 type ole2_object,
    w_cell2 type ole2_object.
    *--- Ole data Declarations
    data: h_excel type ole2_object, " Excel object
    h_mapl type ole2_object, " list of workbooks
    h_map type ole2_object, " workbook
    h_zl type ole2_object, " cell
    h_f type ole2_object, " font
    gs_interior type ole2_object, " Pattern
    worksheet type ole2_object,
    h_cell type ole2_object,
    h_cell1 type ole2_object,
    range type ole2_object,
    h_sheet2 type ole2_object,
    h_sheet3 type ole2_object,
    gs_font type ole2_object,
    flg_stop(1) type c.
    Internal table Declaration
    data:gt_kna1 type standard table of kna1,
         gt_knvv type standard table of knvv,
         wa_kna1 type kna1,
         wa_knvv type knvv.
    types: data1(1500) type c,
    ty type table of data1.
    data: it type ty with header line,
    it_2 type ty with header line,
    it_3 type ty with header line,
    rec type sy-tfill,
    deli(1) type c,
    l_amt(18) type c.
    data: begin of hex,
    tab type x,
    end of hex.
    field-symbols: <fs> .
         constants cns_09(2) type n value 09.
    assign deli to <fs> type 'X'.
    hex-tab = cns_09.
    <fs> = hex-tab.
    data gv_sheet_name(20) type c .
    SELECT kunnr name1
      INTO corresponding fields of table gt_kna1
      FROM kna1
    UP TO 1000 ROWS.
    SELECT kunnr vkorg
      INTO corresponding fields of table gt_knvv
      FROM knvv
    UP TO 3 ROWS.
    loop at gt_kna1 into wa_kna1.
    concatenate  wa_kna1-kunnr  wa_kna1-name1 into it separated by deli.
    append it.
    clear it.
    endloop.
    loop at gt_knvv into wa_knvv.
    concatenate wa_knvv-kunnr wa_knvv-vkorg into it_2 separated by deli.
    append it_2.
    clear it_2.
    endloop.
    if h_excel-header = space or h_excel-handle = -1.
    *start Excel
    create object h_excel 'EXCEL.APPLICATION'.
    endif.
    call method of h_excel 'Workbooks' = h_mapl.
    set property of h_excel 'Visible' = 1.
    *add a new workbook
    call method of h_mapl 'Add' = h_map.
    gv_sheet_name = 'KNA1'.
    get property of h_excel 'ACTIVESHEET' = worksheet.
    set property of worksheet 'Name' = gv_sheet_name .
    *--Formatting the area of additional data 1 and doing the BOLD
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 50.
    call method of h_excel 'Range' = h_cell
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    *CALL METHOD OF gs_cells 'Select' .
    get property of h_cell 'Font' = gs_font .
    set property of gs_font 'Bold' = 1 .
    data l_rc type i.
    call method cl_gui_frontend_services=>clipboard_export
    importing
    data = it[]
    changing
    rc = l_rc
    exceptions
    cntl_error = 1
    error_no_gui = 2
    not_supported_by_gui = 3
    others = 4.
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 1.
    PERFORM err_hdl.
    call method of h_excel 'Range' = range
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    call method of range 'Select'.
    *PERFORM err_hdl.
    call method of worksheet 'Paste'.
    ****for second sheet**********
    GV_SHEET_NAME = '2ND SHEET'.
    gv_sheet_name = 'Knvv'.
    get property of h_excel 'Sheets' = h_sheet2 .
    call method of h_sheet2 'Add' = h_map.
    set property of h_map 'Name' = gv_sheet_name .
    get property of h_excel 'ACTIVESHEET' = worksheet.
    *--Formatting the area of additional data 1 and doing the BOLD
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 50.
    call method of h_excel 'Range' = h_cell
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    get property of h_cell 'Font' = gs_font .
    set property of gs_font 'Bold' = 1 .
    call method cl_gui_frontend_services=>clipboard_export
    importing
    data = it_2[]
    changing
    rc = l_rc
    exceptions
    cntl_error = 1
    error_no_gui = 2
    not_supported_by_gui = 3
    others = 4.
    call method of h_excel 'Cells' = w_cell1
    exporting
    #1 = 1
    #2 = 1.
    call method of h_excel 'Cells' = w_cell2
    exporting
    #1 = 1
    #2 = 1.
    PERFORM err_hdl.
    call method of h_excel 'Range' = range
    exporting
    #1 = w_cell1
    #2 = w_cell2.
    call method of range 'Select'.
    PERFORM err_hdl.
    call method of worksheet 'Paste'.
    Can you people give me inputs so that I can proceed further.
    Thanks,
    Uga

  • Webi 3.1 Input Controls on Different Tabs

    Hi,
    I have a requirement to pass an input control value to another tab of same report i.e, Same iDocID but different tab.
    For example, say input control in Tab 1 is filtered for a specific date, same date has to be filtered in Tab 2 too. i.e, I need to reuse the input control in Tab 1 in Tab 2, so as to avoid duplication in multiple reports.
    Highly appreciate your help.
    Thanks in advance.

    I was able to make it works. Just try this dummy report to know how :
    - Create a custom query
    select '1','MyNumber1'
    union
    select '2','MyNumber2'
    union
    select '3','MyNumber3'
    For this example, 1st col will be [MyNumber] and 2nd col [Desc]
    - Duplicate the default report
    - On the 1st tab ("Report 1"), add a new Input Control
    - Parse ReportFilterSummary("Report 1") to retrieve the filtered value in a variable named [Filtered]
    =Trim(If (Pos(ReportFilterSummary("Report 1");"MyNumber Equal ") > 0) Then Substr(ReportFilterSummary("Report 1");Pos(ReportFilterSummary("Report 1");"MyNumber Equal ") + Length("MyNumber Equal ");1) Else "")
    - Create a boolean variable [Filter] based on [Filtered]
    =If([Filtered]="" Or [Filtered]=[MyNumber];1;0)
    - On the 2nd tab ("Report 1 (1)"), add the variable [Filter] in your table
    - Add a Quick Filter on this column. Select 1 as value.
    So it's where everybody seems to stuck.
    If we go to the first tab and select a value, we see that [Filter] value changed but the table it's not filtered until we do a refresh
    If we select a value and then a different value, now the table is filtered in the second tab....but it's really annoying...and it doesn't work in Infoview...
    To make it works :
    Before, go to the 1st tab and reset your input control. You also need to refresh the report to make sure that the 2nd tab is ok.
    So...
    - Create a null measure by creating a custom query
    SELECT null
    For this example, this col will be [MyNull]
    - On the 2nd tab, add a dummy section by creating a variable [Section] ="" and dragging it over your table
      You can remove this cell after but DON'T DELETE THE SECTION
    - Create a [Filter Measure] variable - Like I said...it's a MEASURE
    = If ([Filter]=1) Then [Filter] Else [MyNull]
    - On the 2nd tab ("Report 1 (1)"), add the variable [Filter Measure] in your table
    - In the table properties, set the "Show rows with empty dimension values" to Yes (This one sounds really weird but IT MAKE IT WORKS)
    AND HERE WE GO....
    Just test it...go back at the 1st tab and change your Input control value....the table will change immediatly on the 2nd tab...and it works perfectly in Infoview...
    You can remove the [Filter] col but not the [Filter Measure] col but you can "blank" it by removing borders and putting white color as backgroun color (to do this, you need to change it to another color first and then in white)

  • Issue after Migration: ID and Content-ID are different in SOAP Payload

    Hi Experts,
    I am facing a strange issue in the PI landscape after the migration from XI 3.0 to PI 7.1.
    The scenario is from R/3 system to TIBCO System (Proxy-to-SOAP). The TIBCO system receives the file in SOAP Format. The message is sent from PI via SOAP adapter to TIBCO System.
    There is a attachment coming from the R/3 System along with the main message and the main payload/message has a "attachment-ID" as a field. Earlier what used to happen in XI 3.0 that the "Attachment-ID" used to equal to the "Content-ID" when the SOAP payload was generated at the TIBCO end. Now after migration, in PI 7.1 the "Attachment-ID" and "Content-ID" are different. We have control over the "Attachment-ID" as it is coming from the source payload but we do not have any control over the "Content-ID" as we are not creating it.
    Can anyone of you please let me know how the SOAP Payload is created and how the content-ID gets populated in the Header of the SOAP Envelope? Also, can anyone help me to fix this issue? Is it something which needs to be handled by us or the BASIS Team?
    Thanks,
    Arkesh
    Edited by: Arkesh Sharma on Dec 16, 2011 12:53 PM

    Hi Ramesh,
    Thank You for the very Helpful Answer. Before I proceed and close this thread, I have one more question which comes to my mind:
    I create my own SOAP Header if I apply the solution provided by you then will the rest of the details in the SOAP Header payload will change or do I need to customize it for myself? For e.g., there is a field named MessageId in the SOAP Header. If I write a Java Mapping, do I need to manually populate the MessageId field in the SOAP Header of my java code or will it be automatically populated?
    My requirement is to change only the content ID of the SOAP Header Payload and the rest of the fields should remain the same as it is. Is it possible with the approach that you mentioned above?
    Thanks,
    Arkesh

  • Change Excel sheet tab color using Open XML dll

    Hi,
    I want to change the sheet tab color of an excel Xlsx  document. I am using the following code but it does not set the sheet color. I get object reference exception when I set the sheet tab color.
    public static string filepath = @"C:\Test\Book1.xlsx";
    private static void ChangeSheetcolor()
    try
    using (SpreadsheetDocument spreadSheetDocument = SpreadsheetDocument.Open(filepath, false))
    WorkbookPart workbookPart = spreadSheetDocument.WorkbookPart;
    IEnumerable<Sheet> sheets = spreadSheetDocument.WorkbookPart.Workbook.GetFirstChild<Sheets>().Elements<Sheet>();
    //my code
    WorksheetPart worksheetPart =
    GetWorksheetPartByName(spreadSheetDocument, "Sheet1");
    if (worksheetPart != null)
    // worksheetPart.Worksheet.SheetProperties.TabColor.Rgb = DocumentFormat.OpenXml.HexBinaryValue.FromString("Red");
    worksheetPart.Worksheet.SheetProperties.TabColor.Rgb = DocumentFormat.OpenXml.HexBinaryValue.FromString("#CCCCCC");
    // Save the worksheet.
    worksheetPart.Worksheet.Save();
    catch (Exception ex)
    private static WorksheetPart
    GetWorksheetPartByName(SpreadsheetDocument document,
    string sheetName)
    IEnumerable<Sheet> sheets =
    document.WorkbookPart.Workbook.GetFirstChild<Sheets>().
    Elements<Sheet>().Where(s => s.Name == sheetName);
    if (sheets.Count() == 0)
    //does not exist
    return null;
    string relationshipId = sheets.First().Id.Value;
    WorksheetPart worksheetPart = (WorksheetPart)
    document.WorkbookPart.GetPartById(relationshipId);
    return worksheetPart;
    How to change the sheet tab color using Open XML dlls.
    Thanks
    Ashok

    Hi J_Prasanna,
    I'm afraid that it's not possible with OpenXML SDK, but it's possible if you use Excel PIA along with Internet Explorer. Use the Internet Explorer COM object to render the HTML content, then copy the document, use the Paste method of the Worksheet object
    to paste the text with format.
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    With IE
    .Visible = False
    .Navigate "about:blank"
    .document.body.InnerHTML = Sheets("Sheet1").Range("A1").Value
    .document.body.createtextrange.execCommand "Copy"
    ActiveSheet.Paste Destination:=Sheets("Sheet1").Range("A1")
    .Quit
    End With
    The code is similar if you use managed project.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • GGB0 Asset Master Validation of fields on different tabs, on SAVE button

    Hi, Experts.
    For the the validation step in GGB0,  I need to trigger the validation step when the SAVE button clicked in AS01.
    The point is, you have to trigger the validation step with ANY tab-screen in AS01 is ACTIVE ( General , Time-dependent, Allocations ...)
    Requirement:
    When following 2 conditions are satisfied, show error message and let the user to change the Capitalization date.
    Cond.1:  the Capitalization date ( ANLA-AKTIV ) on 'General' tab  is one specific value, YYYYMMDD , not Blank.
    Cond 2 : the City(ANLA-GDLGRP) on 'Allocations' tab includes one special value XXXXX, not Blank.
    I implemented the check and activated with OACV,
    with FGT  = 'A' and logical field group is 002 ( Posting information ) .
    The prerequsite on GB00 is as follows.
    [ (ANLA-GDLGRP <> 'XXXXX' ) AND ( ANLA-GDLGRP <> '' ) ]
    The check  is as follows.
    [ ANLA-AKITIV  <> 'YYYYMMDD' ]
    The current behavior on AS01 is as follows:
    The check works well only when  you click SAVE with 'General' tab active.
    However, it  does NOT work on different tabs ( Allocations, Time-dependent, and so on... )  are active.
    Normally, the users hop around different tabs in AS01, and finally SAVE.
    So  I can not expect which tab is active when the 'SAVE' was clicked....
    Need help & thank you lot in advance

    The link mentioned by you ToonS is not acessible.
    Here is the link:
    http://msdn.microsoft.com/en-us/library/office/gg615466(v=office.14).aspx
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Tab content is empty when tab is dragged

    I have two TabPanes which can move tabs each other. This is the code of the TabPane which receives the dragged tabs from the user:
    tabPane.setOnDragDropped(new EventHandler<DragEvent>()
                @Override
                public void handle(DragEvent event)
                    final Dragboard dragboard = event.getDragboard();
                    if (dragboard.hasString()
                            && TAB_DRAG_KEY.equals(dragboard.getString())
                            && DragBuffer.getDraggingTab().get() != null
                            && DragBuffer.getDraggingTab().get().getTabPane() != tabPane)
                        final Tab tab = DragBuffer.getDraggingTab().get();
                        tab.getTabPane().getTabs().remove(tab);
                        tabPane.getTabs().add(tab);
                        tabPane.getSelectionModel().select(tab);
                        event.setDropCompleted(true);
                        DragBuffer.getDraggingTab().set(null);
                        event.consume();
    I noticed that when I drag the tab into the target TabPane the content of the tab is empty. But when I swith to the next tab of the target tabPane and return back I can see the content. This is couced by this line:
    tab.getTabPane().getTabs().remove(tab);
    Can you tell me how I can change the logic in order to prevent the empty tab body?
    Ref javafx 2 - Tab content is empty when tab is dragged - Stack Overflow

    This looks like a bug; I see the same thing in the context of your other thread. I can't seem to find a workaround. I have some sample code below which demonstrates the same problem without cluttering the code with drag and drop. This should move the selected tab in the bottom tapPane to the top tabPane ("Up" button) or the selected tab in the top tabPane to the bottom tabPane ("Down" button). When a tab is moved it is automatically selected; moving a tab to the top tabPane fails to show its content. (Strangely, moving a tab to the bottom tabPane works fine.) You should probably file a JIRA; reference this thread ("discussion" in the new forum-speak).
    import java.util.Random;
    import javafx.application.Application;
    import javafx.beans.binding.Bindings;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.control.Tab;
    import javafx.scene.control.TabPane;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.Pane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class TabSelectionTest extends Application {
    @Override
      public void start(Stage primaryStage) {
      final TabPane tabPane1 = new TabPane();
      final Random rng = new Random();
      final int NUM_TABS = 4 ;
      for (int i=1; i<=NUM_TABS; i++) {
        tabPane1.getTabs().add(createTab(rng, i));
      final TabPane tabPane2 = new TabPane();
        for (int i=1; i<=NUM_TABS; i++) {
          tabPane2.getTabs().add(createTab(rng, i+NUM_TABS));
      final Button moveToPane1Button = new Button("Up");
      final Button moveToPane2Button= new Button("Down");
      final HBox buttons = new HBox(10);
      buttons.getChildren().addAll(moveToPane1Button, moveToPane2Button);
      moveToPane1Button.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            Tab selectedTab = tabPane2.getSelectionModel().getSelectedItem();
            tabPane2.getTabs().remove(selectedTab);
            tabPane1.getTabs().add(selectedTab);
            tabPane1.getSelectionModel().select(selectedTab);
        moveToPane2Button.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            Tab selectedTab = tabPane1.getSelectionModel().getSelectedItem();
            tabPane1.getTabs().remove(selectedTab);
            tabPane2.getTabs().add(selectedTab);
            tabPane2.getSelectionModel().select(selectedTab);
        moveToPane1Button.disableProperty().bind(Bindings.isEmpty(tabPane2.getTabs()));
        moveToPane2Button.disableProperty().bind(Bindings.isEmpty(tabPane1.getTabs()));
        VBox root = new VBox(10);
      root.getChildren().addAll(tabPane1, buttons, tabPane2);
      primaryStage.setScene(new Scene(root, 600, 500));
      primaryStage.show();
      private Tab createTab(Random rng, int i) {
        Tab tab = new Tab("Tab "+i);
        Pane pane = new Pane();
        pane.setMinSize(600, 400);
        String style = String.format("-fx-background-color: rgb(%d,  %d, %d);", rng.nextInt(256), rng.nextInt(256), rng.nextInt(256));
        pane.setStyle(style);
        pane.getChildren().add(new Label("This is tab "+i));
        tab.setContent(pane);
        return tab ;
      public static void main(String[] args) {
      launch(args);

  • How to place content between header and tabs?????

    i have header part which has to be constant through out the portal but below that i have 3 links
    like I AM employee,employer,broker..
    which has to be shown only in home page above tabs..
    how can i achieve this..
    how to place content between header and tabs..:(kindly help..

    Hi Samiran
    Try these approaches and see if that works.
    1. In the Header Section, you header footer shell and add a Header Portlet. This Header Portlet associated JSP file will have all static content in the top section. In the bottom section, add these 3 links say to right hand corner. Show these links only based on some request property like isHome. Now for the main book having Home and other page associate a BackingFile. Within this backing file in the lifecycle methods like preRender or handlePostBack, get instance of BookManager and all the pages and see which page is Active. For that active page check its page definition label which will be always unique. IF the page def label is like home_page_def (this is page def label you give for home page), then set the key value in the request property like isHome=true. By only doubt is after Book backingfile is triggered, the header has to be reloaded, because only then it can pick up the request attributes.
    2. Create a brand new portlet like HomePageLinks portlet. Make its Title Property Not Visible, and other user interface properties like NoBorder, NoTheme etc. The associated JSP will have the 3 links you mentioned right aligned. You can use css styles to make it right etc. Now drop this portlet in the Header Shell area. You already have HeaderPortlet in the top, below that you will have this HomePageLinks portlet. Now associate a backing file for this Portlet to show, only if the Books current active page is Home page by comparing the def label etc as mentioned above.
    In both scenarios, only concern is when we click on different Pages, the entire portal has to be rendered right from the Top Header. Only then the backing file will set the key, and the HomePageLinks portlet can show or hide accordingly.
    Try firing an Event when the Home page is clicked. This listener for this Event can be the HomePageLinks Portlet. I guess Event mechanism should work irrespective of where the portlet is placed. In the event listner, see if you can show/hide this portlet.
    The only challenge is Header section needs to reloaded everytime you click on a Tab.
    Start putting some backing files and System.out.printlns to see if the Header section gets reloaded on click on any Tabs.
    These are just my thoughts over the top of my head. Other forum users can have better alternatives or a different version of above approaches.
    Thanks
    Ravi Jegga

Maybe you are looking for

  • By-passing Airport to print through Ethernet

    I loaded Snow Leopard yesterday and could not find my HP Color LaserJet 5500dn, which is connected via Ethernet. Then I discovered it wouldn't recognized or communicate with it while I had Airport on. After turning Airport off, low and behold it reco

  • Sales Order/Delivery for particular customer From his Reserve stock?

    Dear Couleague, There is one scenario that faulty material from customer Co. get back by Return Order (RE), Then return Delivery --& post goods receipt, Of the sold material, Now co. (PP/QM) do rework Process (assemble, dismantle ...... whatever on t

  • Web sharing works in Safari, but not Firefox?

    Have created a simple website in Sites folder with Snow Leopard (10.6.8). Appears to work fine in Safari, but when open address http://192.168.1.111/~username/ in Firefox, the old "Your website" html appears - even through that file has been replaced

  • Formatting an XML string that has a date

    Hi All - new to this forum! Not familiar with XML operations and seeking some advise. I have a field that contains XML text that has a date within that I want to extract and format appropriately for some reports. Getting to the date portion of the fi

  • Aperture 3.3 now adding duplicate photos to iPad

    Since updating to Aperture 3.3  my iPad now has duplicate photos on it that it never had before. I have always (and have to for professional reasons) kept my RAW file and my processed TIF files in a stack with the TIF as the visible file. My iPad has