简体   繁体   English

使用给定索引更改 JTable 行背景颜色

[英]Changing JTable Row Background Color With Given Index

private void jButtonNextItemInListActionPerformed(java.awt.event.ActionEvent evt) {                                                      
    //Increment currentPosition to display next item on input fields
    currentPosition++;

    //If you reach the last item move back to the first item
    if (currentPosition >= dao.phonesList().size() - 1) {
        currentPosition = 0;
    }
    selectPhones(currentPosition);
    //Change Java JTable Row Background Color With (currentPosition) Row Index 
}   

I am incrementing row index by next button click.我通过单击下一个按钮来增加行索引。 How can I change JTable row background color using the currentPosition index?如何使用currentPosition索引更改JTable行背景颜色?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM