How to change color in table header

I have a table model like below I can change column colors (background or foreground ) but I couldn't change table headers color in my application . Basicly I want to change color of "Grup Adı","Kişi Sayısı" column headers.
Please help
thanks
class MyTableModel extends AbstractTableModel {
public String[] columnNames = {
"Grup Adı","Kişi Sayısı",
public int getColumnCount() {
return columnNames.length;
public int getRowCount() {
return data.length;
public String getColumnName(int col) {
return columnNames[col];
public Object getValueAt(int row, int col) {
return data[row][col];
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
public boolean isCellEditable(int row, int col) {
return true;
public void setValueAt(Object value, int row, int col) {
if (DEBUG) {
System.out.println("Setting value at " + row + "," + col
+ " to " + value
+ " (an instance of "
+ value.getClass() + ")");
data[row][col] = value;
fireTableCellUpdated(row, col);
if (DEBUG) {
System.out.println("New value of data:");
printDebugData();
}

You have to implement a TableCellRenderer and affect it to your columns with:myTable.getColumnModel().getColumn(0).setHeaderRenderer(myTableCellRenderer);

Similar Messages

  • How to change colors of table col and row header?

    Could I change table header colors when run vi ? Is such a thing possible?
    ex: Header words color from black changed to green in column 2 of table.

    cloud a écrit:
    ...But I mean is "How to change header words color" not changed cell words color.
    tst gave you the answer ! A header cell is just a cell with a -1 value as index...
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to change color of tables and regions in OA Framework pages

    Dear all
    I want to change colour of tables and regions of oracle standard pages.One way to do it is that I can add code for tables and regions CSS definitions in for each page in correspoding CO,which is not feasible since we have large number of COs in standard pages.I heard that oracle has provided some method to change look and feel of the pages.If anybody knows about it ,plz do let me know.
    Thanks in advance
    Bhupendra

    Check personalization guide and read out "Customizing Look-and-Feel (CLAF)" Topic.

  • Can any one tell me how to change the current row header in FB1LN tcode

    Hi,
    can any one tell me how to change the current row header in FB1LN tcode.
    I want to show input date also in the layout.
    Regards
    Mave

    Hi
    I know two ways:
    - transaction obvu: here you can insert new fields, but only if these fields are included in certain table (like BKPF, BSEG, BSIS.....
    - if your field isn't included in those table, you have to modify the structure RFPOS and manage it in the BTE 1650. After updating RFPOS you have to run the program RFPOSXEXTEND to update the structure RFPOSXEXT.
    Max

  • How to change colors of LCD/VFD controls from SGC-Tek?

    Hi Anybody got idea how to change colors of LCD/VFD controls from SGC-Tek?
    I have tried but could not. When I try to make myself a nest cluster of clusters of LEDs, I can change colours but I can't do the same thing with LCD/VFD controls.
    Please check at LCD/VFD controls
    Clement

    I suspect this repsonse is somewhat mis-leading, the code has no effect on the control other than setting its state, although the route is somewhat tedious for the mod.
    I would imagine that the control is set up so that the pixels didn't move around when they are being used as controls.
    There are nested groups and locks on the controls, which might make the ordering in the cluster easier to manage.
    The following should work....... ;-) it did for me
    Open  your own new VI
    Open the main LCD VI
    Open the Browse VI Hierachy
    Drag and drop the LCD VI onto your own diagram
    Create a cluster from the LCD VI's connector
    Now ungroup the clusters and unlock them (this is tedious) if you create your own then you could be more imaginative in the structure, I leave that for homework.
    Then import a new bitmap (gif) into the control
    Now update the modified contol back into the master control
    ........ Told you it could be done, but I am not sure the pain was worth it.
    BUT
    Try the alternative control..... with colour settings as well, ANY colour and even some size control.
    It was here http://members.lycos.co.uk/sgctek/

  • How to change colors of individual column bar in the same data series

    in mac numbers, how to change colors of individual column bar in the same data series. The entire column series gets selected in the column bars and cannot select to change colors of specifc bars.

    Hi Kiran,
    no its not possible through Theme editor also ,because these colors are coming from Compiler which u are using.
    Regards,
    Govindu

  • How to change colors in Auction monitor

    Hi Experts,
    Could you please help me on below requirement,
    In Auction Monitor , need different darker colors for tracking bids  because some colors cannot be seen on the screen.
    Could you please guide me how to change colors in Monitor.
    Thanks,
    Pavan.

    Hi Vinay.
    I would like to suggest a couple of references, quite similar to your requirement,
    [SDN - Reference for Different Colors in Single Graphical bar|About Different Colors in Single Graphical bar;
    [SDN - Reference for changing colors for graphs|Anyone used colors in VC?;
    [SAP HELP - Standard Reference for Assigning Colors to Parts of a Graph|http://help.sap.com/saphelp_nw04/helpdata/en/39/cca358576911d1896f0000e829fbbd/content.htm]
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • How to change color of a button for specific time interval in jsp

    How to change color of a button for specific time interval in jsp.
    Please help.
    Thanks in advance.

    This was driving me crazy, too--and the previous answers did not seem to work. I eventually found that if I click one of the data symbols in the graph in exactly the right spot (see below), it selects only the data symbols and not the line. I can tell this because the little selection dots will be around each data symbol, but no selection dots will be on the line between the data symbols - like the graphic in Yvan's answer. Then and only then will the color symbol in the tool bar show the color of the data symbol, instead of the color of the line. I believe that you then have to first click on the color swatch in the toolbar and then select your color (or choose Show Colors and select from the color tool). Just clicking a color in the crayon box, for example, did not seem to work unless I first clicked on the color swatch in the toolbar, then clicked Show Colors on that dropdown, and +only then+ clicked the crayon or whatever.
    _The right spot to click_ seems to be just above the exact center of the data symbol, at least for the diamond shape symbol that I prefer. Sometimes it takes several tries to hit the right spot. If I miss it, the whole line is selected, which is indicated by the little selection dots on the line, between the data symbols. When I click the right spot, those selection dots go away, leaving only the data symbols selected. Then I can change the color, as described above.
    I hope this works for you too.

  • How to change color in BEx Browser?

    Hello Friends,
    How to change color in BEx Browser?
    My browser shows all the report description with pink color. I want to change the color.
    Please let me know.
    Thanks in advance.

    Hello Bhavin,
    It seems the patches for BW Add-On are being kept pretty much in sync for 6.20 and 6.40 (i.e they seem to be released at around the same time, even that the patch level numbers are different).
    However, at BW Add-on Patch level 4 on a SAPgui640 machine, we didn't have the "pink font" problem.
    It may be that BW 3.5 Add-On patch 6 will have a similar effect for you - it may be worth trying.
    Here is the link to the BW3.50 patch 6... https://smpdl.sap-ag.de/~swdc/012002523100000108232005D/bw350_6-10001615.exe?_ACTION=DL_DIRECT
    The patch 6 referred to above is for the BW3.50 Add-On - the SAPgui patch is typically a different number (the 11 that you mention is the SAPgui patch level).
    Best regards,
    Pat M.

  • How to change color in the title line?

    Hi experts, How to change color in the title line, i show an image for explained better
    !http://img688.imageshack.us/img688/9259/imagenjar.png!
    thanks

    in Views.css file
    file below object.and change border-color as you desired to reflect.
    .TitleTable {
         font-family: arial, helvetica, sans-serif;
         border-width: 0 0 4px 0;
         border-style: solid;
         border-color: #6666cc; ----> change here.
    hope this helps !
    -Niranjan K

  • How to change color of text is value is equal to 0

    how to change color of text or background if value is equal to 0

    HI,
    In Template Builder,Insert the conditional region,there you select the column and give condition is equal to 0 and in advanced enter the following code
    <?if:XMLfield=0?><xsl:attribute xdofo:ctx="block" name="background-color">red</xsl:attribute><?end if?>
    try this it works.
    Regards
    Uday

  • How to add color only in header

    how to add color only in header and arrange a background color selected from desktop

    You can place rectangle in header section on master page which would be applied on sub pages and then fill rectangle with color.
    If you are after a specific color then simply use color code and fill.
    Thanks,
    Sanjit

  • HOW TO CHANGE COLOR ON LITTLE SUB TITLE BAR UNDER THE HEADING?

    Hi,
    I was successfully able to change the background color on the templates headed, but that little bar under it, that displays the links to your other pages within the site did not change with it, and I have tried everything but have not been successful. How do I do this?
    Thanks
    Jennifer

    Those navbar links are generated by javascript and are not user editable. You can create your own navbar using a Text Based Navbar and then have complete control over font (stick with the Web Safe Fonts), color, size and rollover colors.
    Cyclosaurus has posted an HTML snippet that can change the font style of the navbar of each page that the snippet is applied to. You can find it here: http://discussions.apple.com/message.jspa?messageID=8596966#8596966. This page tells how tol change the navbar test to all caps: http://discussions.apple.com/thread.jspa?messageID=8523772#8523772.
    And the following code, again courtesy of Cyclosaurus will change the rollover color of the navbar on any page the snippet is added to:
    HTML Widget to change rollover color for this page in the navbar above to orange The code used, courtesy of Cyclosurus, is:
    <script type='text/javascript'>
    styleCSS = 'div#widget0 li a:hover{color: orange;}'; // change color to your liking;
    eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[func tion(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'e(c)'\\b','g'),k[c]);return p}('1=2.3.5(\'6\');1.4.7=\'8/9\';1.4(\'a\',\'b\');1.c=d;2.3.e(\'f\')[0].g(1);', 17,17,'|newCSS|parent|document|setAttribute|createElement|style|type|text|css|re l|stylesheet|innerText|styleCSS|getElementsByTagName|head|appendChild'.split('|' ),0,{})); </script>
    You can see an example of that in this demo page: Misc. Items.
    OT

  • Change color of tableView header.

    Hi All,
    How can we change the color of the header in a table view.
    Searched the forum , but could not find a relevant solution.
    My TV code is :
    <htmlb:tableView id            = "errtab"
                               table         = "<%= itab_message %>"
                               width         = "930"
                               footerVisible = "FALSE"
                               design        = "STANDARD" 
                               headerText    = "Please correct the following errors"
                               headerVisible = "TRUE" >
                <htmlb:tableViewColumns>
                  <htmlb:tableViewColumn columnName = "typ"
                                         title      = "Severity"
                                         width      = "20"
                                         type       = "image" >
                  </htmlb:tableViewColumn>
                  <htmlb:tableViewColumn columnName = "msg"
                                         title      = "Message" >
                  </htmlb:tableViewColumn>             
                </htmlb:tableViewColumns>
              </htmlb:tableView>
    Thanks,
    Anubhav.

    Hi Anu,
    several ways to do this. If your requirement is as simple as you state it look at this thread Change the background colour in BSP for an example you can draw from.
    This example modifies a style that is set using the cascading style sheet - CSS. For details on how to use styles look to http://www.w3schools.com
    Cheers
    Graham Robbo

  • How to change color of selected label from list of labels?

    My Problem is that I have a list of labels. RowHeaderRenderer is a row header renderer for Jtable which is rendering list items and (labels).getListTableHeader() is a method to get the list. When we click on the label this code is executed:
    getListTableHeader().addMouseListener(new MouseAdapter()
    public void mouseReleased(MouseEvent e)
    if (e.getClickCount() >= 1)
    int index = getListTableHeader().locationToIndex(e.getPoint());
    try
    if (((ae_AlertEventInfo)theAlerts.values().toArray()[index]).ackRequiredFlag)
    AcknowledgeEvent ackEvent = new AcknowledgeEvent(
    this, (ae_AlertEventInfo)theAlerts.values().toArray()[index]);
    fireAcknowledgeEvent(ackEvent);
    ((HeaderListModel)listModel).setElementAt(ACK, index);
    catch(Exception ex) {;}
    Upon mouse click color of the label should be changed. For some period of time ie. Upto completion of fireAcknowledgeEvent(ackEvent);
    This statement is calling this method:
    public void handleAcknowledgeEvent(final AcknowledgeEvent event)
    boolean ackOk = false;
    int seqId = ((ae_AlertEventInfo)event.getAlertInfo()).sequenceId;
    if (((ae_AlertEventInfo)event.getAlertInfo()).ackRequiredFlag)
    try
    // perform call to inform server about acknowledgement.
    ackOk = serviceAdapter.acknowledge(seqId,
    theLogicalPosition, theUserName);
    catch(AdapterException aex)
    Log.error(getClass(), "handleAcknowledgeEvent()",
    "Error while calling serviceAdapter.acknowledge()", aex);
    ExceptionHandler.handleException(aex);
    else
    // Acknowledge not required...
    ackOk = true;
    //theQueue.buttonAcknowledge.setEnabled(false);
    final AlertEventQueue myQueue = theQueue;
    if (ackOk)
    Object popupObj = null;
    synchronized (mutex)
    if( hasBeenDismissed ) { return; }
    // mark alert event as acknowledged (simply reset ack req flag)
    ae_AlertEventInfo info;
    Iterator i = theAlerts.values().iterator();
    while (i.hasNext())
    info = (ae_AlertEventInfo) i.next();
    if (info.sequenceId == seqId)
    // even if ack wasn't required, doesn't hurt to set it
    // to false again. But it is important to prevent the
    // audible from playing again.
    info.ackRequiredFlag = false;
    info.alreadyPlayed = true;
    // internally uses the vector index so
    // process the queue acknowledge update within
    // the synchronize block.
    final ae_AlertEventInfo myAlertEventInfo = event.getAlertInfo();
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    myQueue.acknowledge(myAlertEventInfo);
    myQueue.updateAcknowledgeButtonState();
    // here we should stop playing sound
    // if it is playing for this alert.
    int seqId1;
    if (theTonePlayer != null)
    seqId1 = theTonePlayer.getSequenceId();
    if (seqId1 == seqId)
    if (! theTonePlayer.isStopped())
    theTonePlayer.stopPlaying();
    theTonePlayer = null;
    // get reference to popup to be dismissed...
    // The dismiss must take place outside of
    // the mutex... otherwise threads potentially
    // hang (user hits "ok" and is waiting for the
    // mutex which is currently held by processing
    // for a "move to summary" transition message.
    // if the "dismiss" call in the transition
    // message were done within the mutex, it might
    // hang on the dispose method because the popup
    // is waiting for the mutex...
    // So call popup.dismiss() outside the mutex
    // in all cases.
    if(event.getSource() instanceof AlertEventPopup)
    popupObj = (AlertEventPopup)event.getSource();
    else
    popupObj = thePopups.get(event.getAlertInfo());
    thePopups.remove(event.getAlertInfo());
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    // search vector elements to determine icon color in main frame
    String color = getColor();
    fireUpdateEvent(new UpdateEvent(this, blinking, color));
    // Call dismiss outside of the mutex.
    if (popupObj !=null)
    if(popupObj instanceof AlertEventPopup)
    ((AlertEventPopup)popupObj).setModal(false);
    ((AlertEventPopup)popupObj).setVisible(false); // xyzzy
    ((AlertEventPopup)popupObj).dismiss();
    else
    // update feedback... ack failed
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    myQueue.setInformationMessage("Acknowledge failed to reach server... try again");
    return;
    Code for RowHeaderRenderer is:
    class RowHeaderRenderer extends JLabel implements ListCellRenderer
    JTable theTable = null;
    ImageIcon image = null;
    RowHeaderRenderer(JTable table)
    image = new ImageIcon(AlertEventQueue.class.getResource("images" + "/" + "alert.gif"));
    theTable = table;
    JTableHeader header = table.getTableHeader();
    setOpaque(true);
    setHorizontalAlignment(LEFT);
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setFont(header.getFont());
    public Component getListCellRendererComponent( JList list, Object value,
    int index, boolean isSelected, boolean cellHasFocus)
    int level = 0;
    try
    level = Integer.parseInt(value.toString());
    catch(Exception e)
    level = 0;
    if (((ae_AlertEventInfo)theAlerts.values().toArray()[index]).ackRequiredFlag)
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    this.setHorizontalAlignment(JLabel.CENTER);
    this.setVerticalAlignment(JLabel.CENTER);
    setIcon(image);
    else
    setBorder(BorderFactory.createLineBorder(Color.gray));
    setText("");
    setIcon(null);
    return this;
    I tried but when i am clicking a particular label, the color of all labels in the List is being changed. So can you please assist me in changing color of only the label that is selected and the color must disappear after completion of Upto completion of fireAcknowledgeEvent(ackEvent);

    im a bit confused with the post so hopefully this will help you, if not then let me know.
    I think the problem is that in your renderer your saying
    setBackground(header.getBackground());which is setting the backgound of the renderer rather than the selected item, please see an example below, I created a very simple program where it adds JLabels to a list and the renderer changes the colour of the selected item, please note the isSelected boolean.
    Object "value" is the currentObject its rendering, obviously you may need to test if its a JLabel before casting it but for this example I kept it simple.
    populating the list
    public void populateList(){
            DefaultListModel model = new DefaultListModel();
            for (int i=0;i<10;i++){
                JLabel newLabel = new JLabel(String.valueOf(i));
                newLabel.setOpaque(true);
                model.addElement(newLabel);           
            this.jListExample.setModel(model);
            this.jListExample.setCellRenderer(new RowHeaderRenderer());
        }the renderer
    class RowHeaderRenderer extends JLabel implements ListCellRenderer
        JTable theTable = null;
        public Component getListCellRendererComponent(JList list, Object value,
                                                      int index, boolean isSelected, boolean cellHasFocus){
            JLabel aLabel = (JLabel)value;
            if (isSelected){
                aLabel.setBackground(Color.RED);
            }else{
                aLabel.setBackground(Color.GRAY);
            return aLabel;       
    }

Maybe you are looking for

  • Need some assistance to my new N97

    Hello, I just got my new Nokia N97. Yesterday i used the battery blank, and it has been in the charger for 12 hours, but when the phone started i noticed something weird. I just wanna know if it is normal, or my phone displays an error. At the bottom

  • Unable to update iTunes due to no iTunes.msi file

    I cannot download 21.1 iTunes update as it blocks me due to a lack of the itunes.msi file. I cannot uninstall als due to the lack of this missing file. I am also having a similar problem with Quick Time.

  • Why won't FCPX import .mts files?

    I love shooting 1920x1080/50p, but FCPX will not recognise the files. Both Panasonic and Sony use this framerate now butto get work into FCPX I have to shoot at 50i. I know I can convert using clipwire and the like, but why should I have to go to tha

  • How to enable Personlize link in Portal

    Dear Sir, My personalize link in Portal header was disappeared. How to enable it? Please advise. Thanks and best regards, Vimol

  • Iphone4 in recovery mode

    I try to update my iPhone4 2nd hand to 4.2 iso but half way running I shows error 1013. Now in recovery mode, I try to restore but I did not backup my iphone4 data. It will run half way and back to recover mode. I try to press the power button n home