swing - Highlighting certain rows in a jtable in java -


इस सवाल का पहले से ही एक उत्तर है: < < मैं जेटेल में कुछ पंक्तियों को हाइलाइट करना चाहता हूं। जावा का उपयोग करना यह कैसे संभव है? अग्रिम धन्यवाद।

मेरा कोड पोस्ट करना आप अवधारणाओं को समझ सकते हैं और अपने प्रोजेक्ट में आवेदन कर सकते हैं।

यह एक एकल स्तंभ के लिए काम करेगा और संपूर्ण पंक्ति को हाइलाइट नहीं करेगा

  import javax.swing। *; आयात javax.swing.table। *; Import java.awt। *; क्लास MyTableCellRender डिफ़ॉल्टताबलेलेंडरर {सार्वजनिक MyTableCellRender () {setOpaque (true); } सार्वजनिक घटक getTableCellRendererComponent (JTable तालिका, ऑब्जेक्ट मान, बूलीयन है चुने गए, बूलियन हैफॉक्स, इंट पंक्ति, इंक स्तंभ) {स्ट्रिंग संख्या = (स्ट्रिंग) मान; इंट वोल = इंटीजर.परसेइंन्ट (संख्या); अगर (वैल & gt; 5) {if (val & gt; = 5000) {setForeground (Color.black); setBackground (Color.red); } अन्य {setForeground (Color.black); setBackground (Color.yellow); }} Else {setBackground (Color.white); setForeground (Color.black); } SetText (मान! = शून्य? Value.toString (): ""); इस वापसी; }}    

Comments

Popular posts from this blog

php - how to change mysql_result($res, 0, "url"); to mysqli -

Delphi: missing interface declarations for UI Automation methods -

android - How to attach an image from an app to gmail -