Change the color of a particular row in a jtable

I have a jtable and i want to change the color of one particular column and few rows to blue and underline the text depending on some condition. In my view class if a condition is true
for( count=0;count<grdTest.getRowcount;count++)
if(some condition true)
grdTest.getColumnModel().getColumn(0).
setCellRenderer(new MyTestCellRenderer(count));
And my cell renderer
public class MyTestCellRenderer extends DefaultTableCellRenderer {
int rowIndex=-1;
public MyTestCellRenderer(int rowcount) {
super();
rowIndex=rowcount;
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value,
isSelected, hasFocus, row, column);
if(row == rowIndex)
setText("<html> <u> <font color='blue'>" + value.toString());
return this;
This is behaving very wierd . If suppose there are 50 rows and all of them have the condition true then only the last one in the row color is changes.
However if only one out othe say10 has the condition true then it changes the color and underlines the particular row,column.
Is there any other way to do this or what i am doing wrong
Thanks

if(row == rowIndex)Your code is a shambles because of the lack of tags, but I don't believe I see anything being called when this boolean condition is not true. That would be a problem.                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How can i change the color of an entire row of a JTable ?

    Hi all,
    I have a JTable with 4 columns; I have to change the background color of the rows which have a certain value contained on the fourth column.
    So, if a row has, on its fourth column, a particular value...this row must change background color.
    Any suggestion ?
    Cheers.
    Stefano

    Hi,
    this is a good solution that works fine for me :
    the Object "resources" is a List of String.
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
              JLabel retValue;
              retValue = ( JLabel ) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
              if (column == 0) {
                   String s = (String)table.getModel().getValueAt(row, 3);
                   if ( !"".equals(s) && resourcers.contains(s) ) {
                             setBackground(table.getSelectionBackground());
                   } else {
                             setForeground(table.getForeground());
                             setBackground(table.getBackground());
         return retValue;
    Cheers.
    Stefano

  • Jtable: How to change the color of an entire row?

    How can I change the color on an entire row in a Jtable based upon the value in one of the cells in that row.
    For example: Lets say:
    I have 5 rows. Each row has 4 columns.
    If column 4 has a value "A" in any of the rows, all the text in that row should be red.
    If column 4 has a value "B" in any of the rows, all the text in that row should be blue.
    Just point me in the right direction and I will try to take it on from there.
    Thanks

    In the future, Swing related questions should be posted in the Swing forum.
    But there is no need to repost because you can search the Swing forum for my "Table Prepare Renderer" (without the spaces) example which shows how this can be done.
    But first read the tutorial link given above.

  • To change the font of a selected row in a Jtable

    Hello,
    Is it possible to change the font of a selected row in a jtable?
    i.e. if all the table is set to a bold font, how would you change the font of the row selected to a normal (not bold) font?
    thank you.

    String will be left justified
    Integer will be right justified
    Date will be a simple date without the time.
    As it will with this renderer.Only if your custom renderer duplicates the code
    found in each of the above renderers. This is a waste
    of time to duplicate code. The idea is to reuse code
    not duplicate and debug again.
    No, no, no there will be NO duplicated code.
    A single renderer class can handle all types ofdata.
    Sure you can fit a square peg into a round hole if
    you work hard enough. Why does the JDK come with
    separate renderers for Date, Integer, Double, Icon,
    Boolean? So that, by default the rendering for common classes is done correctly.
    Because its a better design then having code
    with a bunch of "instanceof" checks and nested
    if...else code.This is only required for customization BEYOND what the default renderers provide
    >
    And you would only have to use instanceof checkswhen you required custom
    rendering for a particular classAgreed, but as soon as you do require custom
    renderering you need to customize your renderer.
    which you would also have to do with theprepareRenderer calls too
    Not true. The code is the same whether you treat
    every cell as a String or whether you use a custom
    renderer for every cell. Here is the code to make the
    text of the selected line(s) bold:
    public Component prepareRenderer(TableCellRenderer
    renderer, int row, int column)
    Component c = super.prepareRenderer(renderer, row,
    , column);
         if (isRowSelected(row))
              c.setFont( c.getFont().deriveFont(Font.BOLD) );
         return c;
    }It will work for any renderer used by the table since
    the prepareRenderer(...) method returns a Component.
    There is no need to do any kind of "instanceof"
    checking. It doesn't matter whether the cell is
    renderered with the "Object" renderer or the
    "Integer" renderer.
    If the user wants to treat all columns as Strings or
    treat individual columns as String, Integer, Data...,
    then they only need to override the getColumnClass()
    method. There is no change to the prepareRenderer()
    code.
    Have you actually tried the code to see how simple it
    is?
    I've posted my code. Why don't you post your solution
    that will allow the user to bold the text of a Date,
    Integer, and String data in separate column and then
    let the poster decide.Well, I don't see a compilable, runnable demo anywhere in this thread. So here's one
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Arrays;
    import java.util.Date;
    import java.util.Vector;
    public class TableRendererDemo extends JFrame{
        String[] headers = {"String","Integer","Float","Boolean","Date"};
        private JTable table;
        public TableRendererDemo() {
            buildGUI();
        private void buildGUI() {
            JPanel mainPanel = (JPanel) getContentPane();
            mainPanel.setLayout(new BorderLayout());
            Vector headerVector = new Vector(Arrays.asList(headers));
             Vector data = createDataVector();
            DefaultTableModel tableModel = new DefaultTableModel(data, headerVector){
                public Class getColumnClass(int columnIndex) {
                    return getValueAt(0,columnIndex).getClass();
            table = new JTable(tableModel);
    //        table.setDefaultRenderer(Object.class, new MyTableCellRenderer());
            table.setDefaultRenderer(String.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Integer.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Float.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Date.class, new MyTableCellRenderer());
            JScrollPane jsp = new JScrollPane(table);
            mainPanel.add(jsp, BorderLayout.CENTER);
            pack();
            setLocationRelativeTo(null);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        private Vector createDataVector(){
            Vector dataVector = new Vector();
            for ( int i = 0 ; i < 10; i++){
                Vector rowVector = new Vector();
                rowVector.add(new String("String "+i));
                rowVector.add(new Integer(i));
                rowVector.add(new Float(1.23));
                rowVector.add( (i % 2 == 0 ? Boolean.TRUE : Boolean.FALSE));
                rowVector.add(new Date());
                dataVector.add(rowVector);
            return dataVector;
        public static void main(String[] args) {
            Runnable runnable = new Runnable() {
                public void run() {
                    TableRendererDemo tableRendererDemo = new TableRendererDemo();
                    tableRendererDemo.setVisible(true);
            SwingUtilities.invokeLater(runnable);
        class MyTableCellRenderer extends DefaultTableCellRenderer{
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                 super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if ( isSelected){
                    setFont(getFont().deriveFont(Font.BOLD));
                else{
                    setFont(getFont().deriveFont(Font.PLAIN));
                if ( value instanceof Date){
                    SimpleDateFormat formatter =(SimpleDateFormat) SimpleDateFormat.getDateInstance(DateFormat.MEDIUM);
                    setText(formatter.format((Date)value));
                if(value instanceof Number){
                   setText(((Number)value).toString());
                return this;
    }Hardly a "bunch of instanceof or nested loops. I only used the Date instanceof to allow date format to be specified/ modified. If it was left out the Date column would be "18 Apr 2005" ( DateFormat.MEDIUM, which is default).
    Cheers
    DB

  • How to change the background and font color of a particular row in table

    Hi,
       i need to change the background and font color of a particular row. I am using textview as table columns. I tried to do it using semanticColor property of textview  but the font color get changed for the whole column. But i want to change the color of a particular row only.
       If anybody knows please help me(give an example if possible).
           Thanks and regards.
            Pankaj Kumar.

    Hi Pankaj,
    In your data source context node (context node which is bound to dataSource property of Table UI elemennt) do following:
    If data source node is model node: create a value node under data source node, cardinality 1..1, selection 1..1, singleton false. In this new node add value attribute and set property readOnly=true, calculated=true, property com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor .
    If datasource node is value add value attribute and set property readOnly=true, calculated=true, property com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor.
    In calculated getter method put your color calculation depending on conditions, like:
    return <condition>
      ? WDTextViewSemanticColor.CRITICAL
      : WDTextViewSemanticColor.STANDARD;
    Bind new created attribute with property semanticColor of textview.
    Best regards, Maksim Rashchynski.

  • Can you change the color of a row in a SUD

    Is it possible to change the color in a selected row in a SUD? I have multiple tables in my SUD were the user can select multiple rows from each table. The problem is that when the user selects rows in another table the last one selected in the previous table is not hi-lighted. I thought that if I change the color of the row when selected the user can see all the selections once he/she goes to another table.
    Thanks,
    AJL

    Hi AJL,
    There is no way to color rows of the table control in a SUDialog. You could consider using the ActiveX container control and using the Microsoft ActiveX table control, which might have that functionality. Note though, that then you need to either ensure that control is always on all your client machines or make provisions for it to be installed/registered.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Chart: Changing the color of a bar

    Hello Experts,
    We would like to change the color of a particular bar in the chart. Can someone share a code snippet to achieve the same? If we use color-pallete aggregation then color change is getting reflected to all the bars.
    We are using makit library, please note that we had tried the same with viz library also.
    Snippet from XML view:
    <ma:Chart id="idChart1" height="50%" width="100%" type="Column"
      rows="{/}" showRangeSelector="true"
      showTableView="false" showTotalValue="false">
      <ma:category>
      <ma:Category column="type" displayName="Product" />
      </ma:category>
      <ma:values>
      <ma:Value expression="tickets" displayName="Gross Value"
      format="number" />
      </ma:values>
      <ma:columns>
      <ma:Column name="type" value="{BillCycle}" />
      <ma:Column name="tickets" value="{Volume}" type="number" />
      </ma:columns>
      </ma:Chart>
    Regards,
    DR

    annajus wrote:
    Hello
    I am having trouble changing the color of a line chart. I can change colors in bar charts, but it does not let me change the colors for the same data set in a line chart format.
    Do you mean that you want to have different parts of the same line to appear in different colors?
    When I move the chart to Pages it won't let me put the chart legend actually in the chart (which I need based on the APA guidelines).
    Print the Chart to PDF and import the PDF to Pages, with the Legend wherever you want it.
    Finally - any thoughts on how to adjust the X axis so that the first data point doesn't start right on the Y axis?
    Set the Axis Minimum to some other value.
    Regards,
    Jerry

  • Changing the color of a single field in a row of a table

    Is it possible to change the color of text of a single field within a single column. If field 'C' in a row is negative number change the text color to red. Is this possible?

    Hi Champion,
    Please Do search before posting.. you get lots of threads here...
    Re: color for a particular column in table
    Re: Color a table row
    Please go through this..
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/707fb792-c181-2d10-61bd-ce15d58b5cf1?QuickLink=index&overridelayout=true

  • How to change the color of specific row in ALV tree

    Hi,
    I m using method set_table_for_first_display of a class CL_GUI_ALV_TREE.
    The req is to change the color of specific row. Now can anybody tell me how to change the color of ALV tree. As in ALV tree and in this method 'set_table_for_first_display', there is no parameter IS_Layout.
    Pls suggest...

    hi
    hope this code will help you.
    Reward if help.
    REPORT zsharad_test1.
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    line_color(4) TYPE c, "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype = 'CURR'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
    gd_layout-info_fieldname = 'LINE_COLOR'.
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    is_variant = z_template
    TABLES
    t_outtab = it_ekko
    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.
    ENDFORM. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    DATA: ld_color(1) TYPE c.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekko.
    *Populate field with color attributes
    LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
    i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
    IF ld_color = 8.
    ld_color = 1.
    ENDIF.
    CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
    MODIFY it_ekko FROM wa_ekko.
    ENDLOOP.
    ENDFORM. " DATA_RETRIEVAL

  • Changing the text in each dataGrid row to a different color

    Okay I am going to try and be as clear as possible with this,
    so bare with me.
    What I am trying to do is make it so that when my
    arraycollection objects that I have retrieved from a web service
    are loaded in (by using the "dataProvider" attribute) my dataGrid
    that some sort of code will take place changing the color of each
    line of text (all the objects stored in the array collection are
    string types) and display each rows text in a different color.
    Now after looking into it, it seems the only way to alter the
    color of the text is to use some sort of style or format but it
    seems it only effects text in a "textArea, textField, textInput"
    etc... SOOO I figured why not create a itemRenderer that contains
    one of those and put it into the dataGrid... Which I did and still
    can't figure out a way to make it so you can dynamically alter the
    color based on a set of rbg values stored in a array the same size
    as the rowCount of the datagrid.
    so I am rather stumpped in what to do.. I DON'T want to
    change the background color of each row, so alternatingItemColor is
    out of the question, I just want the text displayed in each row to
    be a different color.... And I want all this color changing to
    happen either before the data is inputted into the dataGrid
    (manipulating the arraycollection some how..) or when its all
    already in there, it all needs to happen in code no user
    interaction.
    I was thinking perhaps maybe I could create a item Renderer
    object that contains the compenent (the textArea in it) and just
    make a array of item Renderer objects and pass those into the
    dataGrid, but I don't think that is possible.
    ANY IDEAS AT ALL!! On how to change the color of the text in
    each row of the datagrid to a different color would be a HUGE,
    HUGE!!! help. Or any info on how to setup a datagrid listener that
    listens for when a object (a row) from the arraycollection is added
    to the datagrid... Perhaps I could use that info some how to my
    advantage.
    email me, if you like I don't care I just need a answer to
    this its driving me crazy! I can change the background row color
    based on a array of rgb values but I can't change the color of the
    item in that row based on array of rgb values, ARG!
    [email protected]
    thanx in advanced.

    <mx:itemRenderer>
    <mx:Component>
    <mx:Label color = "red" />
    </mx:Component>
    </mx:itemRenderer>
    want to make it so I can change the color of the label on the
    dynamically by calling some sort of method I have created.. is that
    possible? if so coudl you please give a example, thanx!

  • Ow to change the color of row in Datagrid view

    How to change the color of row in Datagridview. Eg. Am getting a remote server services by get-service.  I want to change the color of services that are not running. Am using the below function to get the services.
    Please help me it would be useful
    function Get-SystemInfo
        $array = New-Object System.Collections.ArrayList
    $Script:SystemInfo = Get-WmiObject win32_service -ComputerName $textbox1Computername.text | select DisplayName,Name,state,status,startmode | Sort-Object state,startmode,DisplayName
    $array.AddRange($SystemInfo)
    $datagridview1.DataSource = $array

    Thanks.
    Can you simply my code for Memory usage to Show Computer name, TotalMem,UsedMem,FreeMem, used Mem %, Free Mem %
    Am using the below code :
    $buttonMemory_Click= {
    if($textbox1Computername.text -ne "")
    $script:Object =@()
    $script:array = New-Object System.Collections.ArrayList      
    $Object =@()
    $SystemInfo = Get-WmiObject -Class Win32_OperatingSystem -computername $textbox1Computername.text | Select-Object csname, TotalVisibleMemorySize, FreePhysicalMemory
    $TotalRAM = $SystemInfo.TotalVisibleMemorySize/1MB
    $FreeRAM = $SystemInfo.FreePhysicalMemory/1MB
    $UsedRAM = $TotalRAM - $FreeRAM
    $RAMPercentFree = ($FreeRAM / $TotalRAM) * 100
    $RAMUsedPercent = (100 * $UsedRAM) / $TotalRAM
    $TotalRAM = [Math]::Round($TotalRAM, 2)
    $FreeRAM = [Math]::Round($FreeRAM, 2)
    $UsedRAM = [Math]::Round($UsedRAM, 2)
    $RAMPercentFree = [Math]::Round($RAMPercentFree, 2)
    $RAMUsedPercent = [Math]::Round($RAMUsedPercent, 2)
    $TotalVirtualMemorySize=[Math]::Round($SystemInfo.TotalVirtualMemorySize/1MB, 3)
    $FreeVirtualMemory=[Math]::Round($SystemInfo.FreeVirtualMemory/1MB, 3)
    $FreeSpaceInPagingFiles=[Math]::Round($SystemInfo.FreeSpaceInPagingFiles/1MB, 3)
    $NP=$SystemInfo.NumberofProcesses
    $NU=$SystemInfo.NumberOfUsers
    $Object += New-Object PSObject -Property @{
    #ComputerName = $textbox1Computername.text
    TotalRAMGB = $TotalRAM;
    FreeRAMGB = $FreeRAM;
    UsedRAMGB = $UsedRAM;
    FreeRAMPercentage =$RAMPercentFree;
    UsedRAMPercentage =$RAMUsedPercent;

  • How to change the Color of a string using swings/awt concept.

    Hi friends,
    How can i change the Color of a string.
    For ex:
    If i have a string "Welcome to the Java World",I want one particular Color for the string "Welcome to the" and a different Color to the "Java World" string.
    So please kindly help me out to resolve this issue.
    Thanking u in advance.

    "Text Component Features"
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

  • How can i change the color of a field in a table depence of a value

    Hi forum
          Is this possible to change the color of a row in a specific field of a table depends of the value of this field,,, for example if the value is equal or greather than 1.
    Thnks
    Josué Cruz

    Josue,
    Yes this is possible if you use the fillColor method. It requires R,G,B value of color.
    //Sample code which highlights cell2 in my table which has two rows.
    frm1.Table1.Row2.Cell2.fillColor = "120,120,120";
    // If you want highlight complete row.
    frm1.Table1.Row2.fillColor = "120,120,120";
    So now just apply an if loop which reads the input value as greater than 1 and use the code shown above.
    Chintan

  • How can I change the color of the new tab button?

    Hi,
    I was wondering if there was a way to change the color of the new tab button, list all tab button, and tab groups button. I have been searching for personas that don't make it hard to see those particular buttons for days now, but since I can't seem to find any I was hoping there was a way to change those buttons' colors to make them more visible with the personas.
    [http://i54.tinypic.com/2ui9351.jpg Here's a picture of the situation]
    I want to change those 3 buttons (and the "show more bookmarks" button that appears when the window is too small to show them all) to white or some other more visible color. I know there's a way to change the background of those buttons, but I'd prefer if I could change the '+' button itself in the new tab button for example. Is there any way to do it? Because it's so hard to find personas that don't make it hard to see text or buttons.
    Thanks.

    jus an example
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    Blinking_Indicator_2003.vi ‏27 KB

  • HOw can i change the color of a cell

    How can I change the color of a cell when it is selected. I select the cell by pressing enter, then I want the text in the cell to change color to red, but all the cells in the table change color. Please I would be grateful for some help

    Subclass DefaultTableCellRenderer.
    public class MyCellRenderer extends DefaultTableCellRenderer
    Override
    public Componet getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    JLabel lab = new JLabel(String)value);
    lab.setOpaque(true);
    return lab;
    if(isSelected)
    lab.setBackground(Color.red);
    else
    lab.setBackground(Color.white);
    Set the columns in your table:
    table.getCoulumModel.getColumn(0).setCellRenderer(new myCellRenderer());
    table.getCoulumModel.getColumn(1).setCellRenderer(new myCellRenderer());
    etc. for each column in your table.

Maybe you are looking for

  • Saving a file - Save as type

    I would like to have a file-save dialog with the standard drop-down list with pre-defined file types as seen in most programs today. However, in LabVIEW I cannot find a simple way of doing this. Any suggestions?

  • Payment terms - net due date same as credit days?

    Dear all, I need to set up a payment term with 20 credit days, 2%. Invoices should be due also after 20 days. I would like the payment term to be set up as follow: Term           Percentage           No of days 1.                2                    

  • Multiple Oracle Homes - Oracle Listener failes to start after installation

    Just in case the listener fails to start after an oracle installation, please check the oracle ports in the listener.ora and tnsnames.ora, both of which are present in the following directory: ...\oracle\<SID>\<Ver>\NETWORK\ADMIN All installations sh

  • Trying to resolve a DHCP conflict involving Airport Extreme

    I have my LAN set up so that the router hands out addresses with DHCP in the 192.168.1 range. Also on the network is an Airport Extreme (an older 11g model running the 5.7 firmware). I am having a terrible time trying to configure it so that it hands

  • Button highlights display in preview and show on computer but not set top players

    Hi I know this has been a problem debated in previous threads, but I'm posting afresh as it's happening to me now and I can't see that anyone discovered a solution (other than to do it in DvdStudio instead!). The issue is that button highlights won't