4 Replies - 228 Views - Last Post: 30 July 2019 - 11:47 AM Rate Topic: -----

#1 dako   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 60
  • Joined: 01-July 19

Changing the color of the very top of RS2XML table which lists columns

Posted 29 July 2019 - 09:11 PM

I am attaching a screenshot of the area I am talking about. What code can I use to change its color. I already have setBackground and stuff as I will show in the code.

 
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBorder(new BevelBorder(BevelBorder.LOWERED, new Color(255, 0, 0), Color.RED, Color.RED, Color.RED));
		scrollPane.getViewport().setBackground(Color.white);
		scrollPane.setBounds(10, 32, 575, 218);
		contentPane.add(scrollPane);
		
		table = new JTable();
		table.setGridColor(Color.red);
		table.setOpaque(true); 



Image:
Screenshot


UPDATE:
I Figured it out, its my tableheader, therefore I had to use the code

 table.getTableHeader().setBackground(Color) 

duh :P

This post has been edited by dako: 29 July 2019 - 09:47 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Changing the color of the very top of RS2XML table which lists columns

#2 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3639
  • View blog
  • Posts: 16,718
  • Joined: 20-September 08

Re: Changing the color of the very top of RS2XML table which lists columns

Posted 30 July 2019 - 02:26 AM

Quote

scrollPane.setBounds(10, 32, 575, 218);

Don't use null layouts - you'll get yourself into trouble. There's no advantage to be gained from dodging learning to use layout managers
Was This Post Helpful? 0
  • +
  • -

#3 dako   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 60
  • Joined: 01-July 19

Re: Changing the color of the very top of RS2XML table which lists columns

Posted 30 July 2019 - 06:24 AM

What do you mean by a null layout? Sorry I haven't really grasped all the terminology, do you just mean the default bounds? What things should I take into consideration when setting them?
Was This Post Helpful? 0
  • +
  • -

#4 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3639
  • View blog
  • Posts: 16,718
  • Joined: 20-September 08

Re: Changing the color of the very top of RS2XML table which lists columns

Posted 30 July 2019 - 09:52 AM

You're explicitly setting the position of your components. That should be done for you. It will also be done for you on resize
Was This Post Helpful? 1
  • +
  • -

#5 dako   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 60
  • Joined: 01-July 19

Re: Changing the color of the very top of RS2XML table which lists columns

Posted 30 July 2019 - 11:47 AM

So you are saying I shouldn't do this? Gotcha +1
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1