How to give backgound color

H All :
I am using collection in my application for textbox
HTMLDB_ITEM.TEXT(2,null,30,500,''style="background-color: RED"'')
i am using this which give me the red in color background effect
i am using
HTMLDB_ITEM.DISPLAY_AND_SAVE(2,null,30,500)
how to give a background or a fore ground color this item
please suggest
Thanks
Sudhir

It's actually quite easy.
What you have to do is write a custom tree cell renderer which extends DefaultTreeCellRenderer. In that class, your getTreeCellRenderer() method should do something like the following:
public Component getTreeCellRendererComponent(
    JTree tree, Object value, boolean selected,
    boolean expanded, boolean leaf, int row, boolean hasFocus )
        Component treeCellRenderer =
              super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
        if (selected) {
            setForeground(Color.WHITE);
            setBackground(BACKGROUND_SELECTION_COLOR);
        } else {
            treeCellRenderer.setForeground(Color.RED);
        return treeCellRenderer;
Then you'll need to make sure that you call myTree.setCellRenderer(new CustomTreeCellRenderer());
cheers,
Greg

Similar Messages

  • How to give some color to a Node in a JTree

    Hi there,
    I have built a JTree that is now ALMOST ready to be the way I want... but ONE thing is missing : I want to be able to put some color on the leaves of my tree, well on the String objects that are just right to their icons. I searched almost all day! Why is it so hard to find some function to accomplish this task when this task is a common one.
    Well please if anyone knows how to do that in a simple way please write back.
    Mr. Big

    It's actually quite easy.
    What you have to do is write a custom tree cell renderer which extends DefaultTreeCellRenderer. In that class, your getTreeCellRenderer() method should do something like the following:
    public Component getTreeCellRendererComponent(
        JTree tree, Object value, boolean selected,
        boolean expanded, boolean leaf, int row, boolean hasFocus )
            Component treeCellRenderer =
                  super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
            if (selected) {
                setForeground(Color.WHITE);
                setBackground(BACKGROUND_SELECTION_COLOR);
            } else {
                treeCellRenderer.setForeground(Color.RED);
            return treeCellRenderer;
    Then you'll need to make sure that you call myTree.setCellRenderer(new CustomTreeCellRenderer());
    cheers,
    Greg

  • How do i change the backgound color for the "file edit view history bookmark tools help" bar in Firefox 29.0

    how do i change the backgound color for the "file edit view history bookmark tools help" bar in Firefox 29.0

    You can add a solid color theme to change the color of the top of the browser window, which includes the Menu Bar.
    https://addons.mozilla.org/en-US/firefox/themes/solid

  • How to give colors to the top-of-page in ALV Grid

    How to give colors to the top-of-page in ALV Grid
    in table GT_LIST_TOP_OF_PAGE i am filling 3 rows ,i need 3 different colors to be displyed on top-of-page(one color to one row)
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    I_LOGO = 'ENJOYSAP_LOGO'
    IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
    please help mee

    HI Kranthi,
    Check out teh foll. link,
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    Hope this helps.

  • How to give colors to the top-of-page in ALV List Display

    how to give colors to the top-of-page in ALV List Display....

    Check this blog.........
    It provides your required output...........
    /people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
    See the point 7 for complete code...
    Regards,
    Pavan

  • How to select a color of cell in REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Hi.
    I need to select a color of a cell in REUSE_ALV_HIERSEQ_LIST_DISPLAY.
    I have found an example, but 
    It shows how to select a color of sell in REUSE_ALV_LIST_DISPLAY.
    Can you give me an example of code?
    Thanks.

    Here ia a simple example of the method how to paint a cell / line / column using REUSE_ALV_HIERSEQ_LIST_DISPLAY  function.
      Programm:    zalv_hierseq_color
      Paint a line, a colomn, or a cell
      using REUSE_ALV_HIERSEQ_LIST_DISPLAY
      Victor Stupin, Russia 2009
    REPORT zalv_hierseq_color.
    TABLES: spfli.
    TYPE-POOLS: slis.
    SELECTION-SCREEN BEGIN OF BLOCK rad1.
    PARAMETERS:
            p_row TYPE i,
            p_col TYPE i.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN ULINE.
    SELECTION-SCREEN COMMENT /1(50) comm1.
    SELECTION-SCREEN COMMENT /1(50) comm2.
    SELECTION-SCREEN COMMENT /1(50) comm3.
    SELECTION-SCREEN END OF BLOCK rad1.
    INITIALIZATION.
      comm1 = 'Paint a line: fill ONLY p_row (p_col is empty)'.
      comm2 = 'Paint a colomn: fill ONLY p_col (r_row is empty)'.
      comm3 = 'Paint a cell: fill P_COL and R_ROW'.
      DATA:
            t_fieldcat TYPE slis_t_fieldcat_alv,
            fs_fieldcat LIKE LINE OF t_fieldcat,
            fs_layout TYPE slis_layout_alv ,
            w_color(4) ,
            w_row TYPE i,
            w_fieldname(20),
            w_prog TYPE sy-repid.
      DATA:
      BEGIN OF t_spfli OCCURS 0,
            color(4),
            checkbox ,
            cell     TYPE slis_t_specialcol_alv,
            carrid   TYPE spfli-carrid,
            connid   TYPE spfli-connid,
            cityfrom TYPE spfli-cityfrom,
            cityto   TYPE spfli-cityto,
            distance TYPE spfli-distance,
            keyln    TYPE int4,
            box      TYPE char1,
            lineno   TYPE int4,
      END OF t_spfli.
      DATA:
      fs_cell LIKE LINE OF t_spfli-cell.
      DATA: gt_item    LIKE TABLE OF t_spfli WITH HEADER LINE,
            gt_header  LIKE TABLE OF t_spfli WITH HEADER LINE,
            gs_keyinfo TYPE slis_keyinfo_alv.
    START-OF-SELECTION.
      SELECT *
      FROM spfli
      INTO CORRESPONDING FIELDS OF TABLE t_spfli.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 1.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'CARRID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 2.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'CONNID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 3.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'DISTANCE'.
      fs_fieldcat-key = ' '.
      fs_fieldcat-edit = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 4.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'CITYFROM'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = ' '.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 5.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'CARRID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 6.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'CONNID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 7.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'DISTANCE'.
      fs_fieldcat-key = ' '.
      fs_fieldcat-edit = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 8.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'CITYFROM'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = ' '.
      APPEND fs_fieldcat TO t_fieldcat.
      p_col = p_col + 4.
      LOOP AT t_fieldcat INTO fs_fieldcat WHERE tabname = 'GT_ITEM'.
        IF fs_fieldcat-col_pos EQ p_col.
          fs_fieldcat-emphasize = 'C600'.
          w_fieldname = fs_fieldcat-fieldname.
          IF p_row IS INITIAL AND p_col GT 0.  " <---- paint only column if p_row is empty
            MODIFY t_fieldcat FROM fs_fieldcat TRANSPORTING emphasize.
          ENDIF.
        ENDIF.
      ENDLOOP.
      fs_cell-fieldname = w_fieldname .
      fs_cell-color-col = 6.
      fs_cell-nokeycol = 'X'.
      APPEND fs_cell TO t_spfli-cell.
      IF p_row IS NOT INITIAL AND p_col IS NOT INITIAL.  " <---- paint a cell
        MODIFY t_spfli INDEX p_row TRANSPORTING cell.
      ENDIF.
      fs_layout-info_fieldname = 'COLOR'.
      fs_layout-coltab_fieldname = 'CELL'.
      fs_layout-f2code = '&ETA'.
      gs_keyinfo-header01 = 'KEYLN'.
      gs_keyinfo-item01   = 'KEYLN'.
      LOOP AT t_spfli INTO gt_item.
        gt_item-keyln = 1.
        gt_item-lineno = gt_item-lineno + 1.
        APPEND gt_item.
      ENDLOOP.
      READ TABLE t_spfli INDEX 1 INTO gt_header.
      gt_header-keyln = 1.
      gt_header-lineno = 0.
      APPEND gt_header.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          is_layout                      = fs_layout
          it_fieldcat                    = t_fieldcat
          i_tabname_header               = 'GT_HEADER'
          i_tabname_item                 = 'GT_ITEM'
          is_keyinfo                     = gs_keyinfo
        TABLES
          t_outtab_header                = gt_header
          t_outtab_item                  = gt_item
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
      IF sy-subrc = 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • In BSP how to give the input field as mandatory?

    Hi friends,
    In BSP how to give the input field as mandatory?
    In BSP i want to validate the input field (example checking the material no is valid or not)
    if this material no doesnot exit means i want to pass error message.What is the code for that.
    Moosa

    hi
    try this
    in LAYOUT
    <htmlb:inputField id = "vname"  disabled = "False" value = "<%= v_visitor %>"/> <font color="red" size="2"><b><%= page->messages->assert_message( 'vname' ) %></b></font></td>
    in DO_HANDLE_EVENT
    in oninputprocessing
    CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
    IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
      DATA: event TYPE REF TO CL_HTMLB_EVENT.
      event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
      IF event->name = 'button' AND event->event_type = 'click'.
        DATA: button_event TYPE REF TO CL_HTMLB_EVENT_BUTTON.
        button_event ?= event.
      ENDIF.
        case event->id.
            when 'select'.
               if v_visitor = ''.
                 page->messages->add_message(
                 condition = 'vname'
                 message   = 'Visitor Name can not be blank'
                 severity  = page->messages->CO_SEVERITY_ERROR ).
              ELSE.
                    here u can write ur when ur field getting filled
            endif.
         endcase.
    endif.
    give marks if it is helpful
    thanks

  • How to download background color of ALV with button "Export to Excel"

    Dear Experts:
    I can download the data of ALV in webdynpro for ABAP, but the color is missing.
    Does anybody know how to download background color of the ALV cells also by "Export to Excel" button?
    Could anybody help on this?
    Thanks in advance!
    Best Regards
    Lingxing Meng

    never experienced that...
    [chk this link|Download colored ALV output in to EXCEL sheet;
    a couple of intersting posts, they talk abt general ALV...
    try one of the last post ...when downloading
    use local file->HTML only.. but while choosing the file location to save give extension as XLS.

  • Title: How to give transparency effect to JFrame?

    Hai,
    we are developing stand alone application using java swing. In our application we need to show an image in JFrame. We draw an image in JPanel using JPanel's paintComponent method. Then we place this JPanel into JFrame. The image is having transparent effect. But we are not able to give transparency effect to JFrame so we couldn't see desktop we are seeing only JFrame's background. *{color:#0000ff}How to give transparency effect to JFrame?*
    *{color}*
    Thanks for your help.

    It's not a commited part of the standard API yet, but as of 1.6_10 you can add transparency effects to a window through the use of
    com.sun.awt.AWTUtilitiesI think this was the original article on the release. If you google, you will find many creative ideas that people have come up with using this particular feature.

  • How to print different colors of Strings into JEditorpane?

    How to print different colors of Strings into JEditorpane?
    Can any body give me answer ...

    JEditorPane contain HTML. So write your HTML using the color attribute.
    Start by read the the API description of JEditorPane. you will find a link to the Swing tutorial on "Using Text Components" which has working examples of using a JEditorPane. It also has an example of using a JTextPane where you can dynamically change the attributes of individual pieces of text.

  • How to give the points??

    hi all
    pls let me tell how to give the point to our friends??

    please check the rules engagement found in the begining of the questions page. Out of that the 4 th step is the following.
    Step 4: Thank Others by Giving Points
    SDN/BPX has a Contributor Recognition Program. Which in short text means that for each question you have 10 points, which can be given to the person that answers your question. 6 & 2 points should also be given for helpful answers. For every question you later award points for, you in turn receive 1 point for.
    you would find three radio buttons on the left hand side of your query with marked with 3 colors. Choose the suitable one based on the merit of the answer.
    regards
    sadhu kishore

  • How to change group colors

    How to change group color in ical

    To change group colors:
    highlight 'desired' group,
    under <Edit>, choose <Get Info>,
    this should give you a smaller window:
              'desired' Info
              Name: desired                    Box with color choices
                                                       (dropdown colors; 'other' accesses other color palettes)
              Description: (can be added)
              Box ' Ignore alarms'
              'Publish...'                    'Cancel'                    'OK'
       4. make color choice,
       5. choose <OK> to complete color change, or <Cancel> original color remains.
    I do hope I've gotten this correct.

  • Im only starting and cant work out how to give a black and white photo blue eyes

    im a beginer and cant figer out how to give a black and white portrat photo blue eyes

    - If the original is B&W first change the picture's mode to color. In my PSE version with is done by Image > Mode > RGB Color. 
    - Add a blank layer and set it's Blend Mode to Overlay or Color.
    - Activate the Brush tool, choose a dark blue color, and paint the eyes. If the result is too dark lower the layer's Opacity. Use the Eraser to remove excess color around the eyes.

  • How do i disable color managment Pro-100

    This printer has been nothing but a headache and I'm not sure how others can get it to work...anyway. The problem is the color(specificly oranges and red). It's way off from the color on my monitor. So, I purchased a ColorMunki Dispaly and calibrated my monitor.  That didn't help. Next I downloaded the Canon Print Studio Pro and when I access it through Photoshop CC, it (canon print studio) tells me the driver isn't installed for the printer....HOWEVER can print to the PRO-100 from every program on my Mac, so clearly the driver IS installed. Now I think I will try getting a custom ICC profile but in order to do that I need to disable the color management, but when I look for a  radio button or some thing like that I end up just raising my blood pressure! 
    Can some one direct me on how I can disable color management in the PRO-100? Or if you could direct me on how to fix the color that would be great too but it seems to be much more complex issue.

    See here and give this a try.
    http://community.usa.canon.com/t5/Professional-Photo-Printers/how-do-I-calibrate-my-canon-pixma-pro-...
    John Hoffman
    Conway, NH
    1D Mark IV, Rebel T5i, Pixma PRO-100, MX472

  • How can I disable color print when using airprint?

    How can I print from my iPhone or iPad in black and white only, so as to save my color ink?  I am using HP Photosmart 5510.  I can't see how airprint gives that option. Is there an app out there for this?

    That is a function of your printer, you can set your printer to be B&W via it's front panel settings.

Maybe you are looking for

  • I have lost my cd's and screen became gray i can not boot what should i do?

    Hi all i have lost my cd's and screen became gray i can not boot what should i do? i have tried to reset Vram tried to run safe boot but nothing happends i have a macbook pro core 2 duo 2GB ram 160 gb hard disk

  • Invalid Web service URL

    Hi All, While creating a model in VC7.0 based on an external webservice(ex: http://api.google.com/GoogleSearch.wsdl), I ended-up with Invalid Web service URL error. Note: When I access the same  WSDL URL using browser it didn't ask me for user authen

  • Spilt Water on Macbook Pro - I turned it off - What do I do next?

    - Spilt Water on Macbook Pro - Turned it off immediately, flipped it over and dried it the best I could (towell + blowdryer) - Haven't turned it on yet - should i even try or should i just take it to the repair shop?  I live in Singapore making thing

  • Tables used in ESS

    hi experts , I need the details of tables used in all the ESS services. where can i find this .help me

  • Undefined index error in checkbox update form

    Hi! i have a problem with my update form Notice:  Undefined index: accepte_oiseaux in C:\wamp\www\weziwezo\voiturier\mod_vehicule.php on line 96 Notice:  Undefined index: accepte_chien in C:\wamp\www\weziwezo\voiturier\mod_vehicule.php on line 97 i n