B4J Question Tabpanel - Change the Text Color?

Discussion in 'B4J Questions' started by GuyBooth, Jun 7, 2019.

  1. GuyBooth

    GuyBooth Active Member Licensed User

    Can I change the color of the title text of a tabpanel? I know I can change the tab background color … but my efforts with CSS to change the text color have yielded no success.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. GuyBooth

    GuyBooth Active Member Licensed User

    I'm having limited success with this …
    Applying a css stylesheet like this changes the text on all the labels on my tabs:

    Code:
    /* PiecesOnly Tabpane Tab title text Dark Green*/
     .tab .tab-
    label {
        -fx-text-fill: 
    #05A005;
        -fx-
    font-weight: bold;
    }
     .tab:selected .tab-label {
        -fx-text-fill: #05A005;
    }
    So far so good. Now I want to make each one different - so I use this code to ID the tab panes:
    Code:
    tpPiecesOnly.Id = "tpPiecesOnly"
        tpPrimaries.Id = 
    "tpPrimaries"
        tpNowPlaying.Id = 
    "tpNowPlaying"
    and this in my css file:
    Code:
    /* PiecesOnly Tabpane Tab title text Dark Green*/
    #tpPiecesOnly .tab .tab-label {
        -fx-text-fill: 
    #05A005;
        -fx-
    font-weight: bold;
    }
    #tpPiecesOnly .tab:selected .tab-label {
        -fx-text-fill: #05A005;
    }
    /* Primaries Tabpane Tab title text Dark Blue*/
    #tpPrimaries .tab .tab-label {
        -fx-text-fill: #783CF0;
        -fx-font-weight: bold;
    }
    #tpPrimaries .tab:selected .tab-label {
        -fx-text-fill: #783CF0;
    }
    /* NowPlaying Tabpane Tab title text Orange*/
    #tpNowPlaying .tab .tab-label {
        -fx-text-fill: #FFD700;
        -fx-font-weight: bold;
    }
    /*Tabpane Tab title text*/
    #tpNowPlaying .tab:selected .tab-label {
        -fx-text-fill: #FFD700;
    }
    But nothing happens.
    Any ideas?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    Code:
    Sub Process_Globals
       
    Private fx As JFX
       
    Private MainForm As Form
       
    Private TabPane1 As TabPane
       
    Private xui As XUI
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
       MainForm = Form1
       MainForm.RootPane.LoadLayout(
    "1"'Load the layout file.
       MainForm.Show
       
    Dim richtext As B4JTextFlow
       richtext.Initialize
       CreateTab(
    "2", richtext.Reset.Append("Red").SetColor(xui.Color_Red).CreateTextFlow)
       CreateTab(
    "2", richtext.Reset.Append("Green").SetColor(0xFF006204).CreateTextFlow)
       CreateTab(
    "2", richtext.Reset.Append("Blue").SetColor(xui.Color_Blue).CreateTextFlow)
    End Sub

    Sub CreateTab (LayoutFile As String, TextFlow As Pane)
       
    Dim t As TabPage = TabPane1.LoadLayout(LayoutFile, "")
       
    Dim jo As JavaObject = t
       jo.RunMethod(
    "setGraphic"Array(TextFlow))
    End Sub
    Depends on XUI Views.
     
    GuyBooth and Johan Hormaza like this.
  5. GuyBooth

    GuyBooth Active Member Licensed User

    Thanks Erel.
    This is why I still have a day job ….
     
    mangojack likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice