Guest User

Untitled

a guest
Nov 14th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. @Override
  2. protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) {
  3. //We do nothing here to disable painting the Tab Border
  4. }
  5.  
  6. @Override
  7. protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) {
  8.  
  9. g.setFont(font);
  10.  
  11. View v = getTextViewForTab(tabIndex);
  12. if (v != null) {
  13. // html
  14. v.paint(g, textRect);
  15. } else {
  16. // plain text
  17. int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
  18.  
  19. if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
  20.  
  21. //Change the text to White here <- Causing Border Issues
  22. g.setColor(Color.WHITE);
  23.  
  24. SwingUtilities2.drawStringUnderlineCharAt(tabPane, g,
  25. title, mnemIndex,
  26. textRect.x, textRect.y + metrics.getAscent());
  27.  
  28. } else { // tab disabled
  29. g.setColor(tabPane.getBackgroundAt(tabIndex).brighter());
  30. SwingUtilities2.drawStringUnderlineCharAt(tabPane, g,
  31. title, mnemIndex,
  32. textRect.x, textRect.y + metrics.getAscent());
  33. g.setColor(tabPane.getBackgroundAt(tabIndex).darker());
  34. SwingUtilities2.drawStringUnderlineCharAt(tabPane, g,
  35. title, mnemIndex,
  36. textRect.x - 1, textRect.y + metrics.getAscent() - 1);
  37.  
  38. }
  39. }
  40. }
Add Comment
Please, Sign In to add comment