{"action":"closed","issue":{"url":"https://api.github.com/repos/mgarin/weblaf/issues/192","labels_url":"https://api.github.com/repos/mgarin/weblaf/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/mgarin/weblaf/issues/192/comments","events_url":"https://api.github.com/repos/mgarin/weblaf/issues/192/events","html_url":"https://github.com/mgarin/weblaf/issues/192","id":46880846,"number":192,"title":"jTable header setBackground","user":{"login":"oliviermorpa","id":9378538,"avatar_url":"https://avatars.githubusercontent.com/u/9378538?v=3","gravatar_id":"","url":"https://api.github.com/users/oliviermorpa","html_url":"https://github.com/oliviermorpa","followers_url":"https://api.github.com/users/oliviermorpa/followers","following_url":"https://api.github.com/users/oliviermorpa/following{/other_user}","gists_url":"https://api.github.com/users/oliviermorpa/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviermorpa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviermorpa/subscriptions","organizations_url":"https://api.github.com/users/oliviermorpa/orgs","repos_url":"https://api.github.com/users/oliviermorpa/repos","events_url":"https://api.github.com/users/oliviermorpa/events{/privacy}","received_events_url":"https://api.github.com/users/oliviermorpa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mgarin/weblaf/labels/confirmed","name":"confirmed","color":"006b75"},{"url":"https://api.github.com/repos/mgarin/weblaf/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/mgarin/weblaf/labels/solved","name":"solved","color":"009800"}],"state":"closed","locked":false,"assignee":{"login":"mgarin","id":2361389,"avatar_url":"https://avatars.githubusercontent.com/u/2361389?v=3","gravatar_id":"","url":"https://api.github.com/users/mgarin","html_url":"https://github.com/mgarin","followers_url":"https://api.github.com/users/mgarin/followers","following_url":"https://api.github.com/users/mgarin/following{/other_user}","gists_url":"https://api.github.com/users/mgarin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgarin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgarin/subscriptions","organizations_url":"https://api.github.com/users/mgarin/orgs","repos_url":"https://api.github.com/users/mgarin/repos","events_url":"https://api.github.com/users/mgarin/events{/privacy}","received_events_url":"https://api.github.com/users/mgarin/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mgarin/weblaf/milestones/14","html_url":"https://github.com/mgarin/weblaf/milestones/v1.29","labels_url":"https://api.github.com/repos/mgarin/weblaf/milestones/14/labels","id":807991,"number":14,"title":"v1.29","description":"**Update v1.29 release**\r\n- WebDockablePane component\r\n- WebDocumentPane improvements\r\n- NotificationManager improvements\r\n- Internal frame issues fixes\r\n- Various minor issue fixes\r\n\r\n**20 October 2014 update**\r\nDue to a descent amount of features/fixes still left to do I will delay this release by one more week. And I finally got some spare time to quickly implement/fix the stuff required for release, so the next date should be pretty accurate. Sorry for all the delays and remember that you can always get the pre-release version that contains all features/fixes marked solved in tracker from here: http://weblookandfeel.com/downloads/prerelease/","creator":{"login":"mgarin","id":2361389,"avatar_url":"https://avatars.githubusercontent.com/u/2361389?v=3","gravatar_id":"","url":"https://api.github.com/users/mgarin","html_url":"https://github.com/mgarin","followers_url":"https://api.github.com/users/mgarin/followers","following_url":"https://api.github.com/users/mgarin/following{/other_user}","gists_url":"https://api.github.com/users/mgarin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgarin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgarin/subscriptions","organizations_url":"https://api.github.com/users/mgarin/orgs","repos_url":"https://api.github.com/users/mgarin/repos","events_url":"https://api.github.com/users/mgarin/events{/privacy}","received_events_url":"https://api.github.com/users/mgarin/received_events","type":"User","site_admin":false},"open_issues":41,"closed_issues":8,"state":"open","created_at":"2014-09-30T09:40:40Z","updated_at":"2015-03-15T16:37:21Z","due_on":"2014-10-27T07:00:00Z","closed_at":null},"comments":1,"created_at":"2014-10-27T08:32:49Z","updated_at":"2015-03-15T16:37:21Z","closed_at":"2015-03-15T16:37:21Z","body":"the function setBackground has no effect in the header.\r\n```java\r\npublic class Main {\r\n\r\n\tpublic static void main(final String[] args) throws Exception {\r\n\t\r\n\t\tSwingUtilities.invokeLater(new Runnable() {\r\n\t\t\tpublic void run() {\r\n\t\t\t\t//com.alee.laf.WebLookAndFeel.install(); <- IF I PUT THIS LINE, THEN BACKGROUND is no more working\r\n\t\t\tExampleFrame exampleFrame = new ExampleFrame();\r\n\t\t\texampleFrame.pack();\r\n\t\t\texampleFrame.setVisible(true);\r\n\t\t\t}});\r\n\r\n\t}\r\n}\r\n```\r\n```java\r\n class ExampleFrame extends JFrame{\r\n\r\n    JTable table;\r\n    HeaderRenderer renderer = new HeaderRenderer();\r\n\r\n    TableColumnModel columnmodel;\r\n\r\npublic ExampleFrame() {\r\n    final String[] names = {\r\n           \"line1\",\"line2\"\r\n         };\r\n\r\n    final Object[][] data = {\r\n           {\"line1\",  \"line 11\"},\r\n           {\"line2\", \"line 22\"}\r\n    };\r\n\r\n    TableModel dataModel = new AbstractTableModel() {\r\n                public int getColumnCount() { return names.length; }\r\n                public int getRowCount() { return data.length;}\r\n                public Object getValueAt(int row, int col) {return data[row][col];}\r\n                public String getColumnName(int column) {return names[column];}\r\n                public Class getColumnClass(int c) {return getValueAt(0, c).getClass();}\r\n             public boolean isCellEditable(int row, int col) {return col != 5;}\r\n                public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; }\r\n        };\r\n\r\n    table = new JTable(dataModel);\r\n    JScrollPane scrollpane = new JScrollPane(table);\r\n    columnmodel=table.getColumnModel();\r\n    for(int i=0;i<table.getColumnCount();i++) {\r\n         table.getColumnModel().getColumn(i).setHeaderRenderer(renderer);\r\n         renderer.setBackgroundColor(Color.blue);\r\n         renderer.setForegroundColor(Color.white);\r\n    }\r\n    getContentPane().setLayout(new BorderLayout());\r\n    getContentPane().add(scrollpane, BorderLayout.CENTER);\r\n    setSize(600,200);\r\n    setVisible(true);\r\n}\r\n```\r\n```java\r\npublic class HeaderRenderer extends JLabel implements TableCellRenderer{\r\n\r\n  private Color fgColor = UIManager.getColor(\"TableHeader.foreground\");\r\n  private Color bgColor = UIManager.getColor(\"TableHeader.background\");\r\n\r\n public HeaderRenderer() {\r\n    setOpaque(true);\r\n }\r\n\r\n     public void setForegroundColor(Color fgColor) {\r\n       this.fgColor=fgColor;\r\n     }\r\n     public Color getForegroundColor() {\r\n       return fgColor;\r\n     }\r\n     public void setBackgroundColor(Color bgColor) {\r\n       this.bgColor=bgColor;\r\n     }\r\n     public Color getBackgroundColor() {\r\n       return bgColor;\r\n     }\r\n\r\n     public Component getTableCellRendererComponent(JTable table, Object value,\r\n                        boolean isSelected, boolean hasFocus, int row, int column) {\r\n               JLabel label = this;\r\n               label.setText((value ==null) ? \"\" : (\" \"+value.toString()));\r\n               label.setForeground(getForegroundColor());\r\n              label.setBackground(getBackgroundColor());\r\n                  return label;\r\n       }\r\n}\r\n```"}}