# Alarm status table background color doesn't change

**URL:** <https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [December 8, 2023, 2:48pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897 "2023-12-08T14:48:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto\_Luis](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@Roberto\_Luis](https://forum.inductiveautomation.com/u/Roberto_Luis)\
**Post date:** [December 8, 2023, 2:48pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/1 "2023-12-08T14:48:40Z")

</div>

I'm trying to change my Alarm Status Table's background color on Vision, but when I select a color on the Appearance-\>Table Background property it just changes the selector's background.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/1/91c065f6131462d0541484f89ddcdd3b0378e431.png)

Could someone help with it?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 8, 2023, 5:14pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/2 "2023-12-08T17:14:39Z")

</div>

This works for me for changing the table's background. For example, when I set it to black, it looks like this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/c/0cff462952d3b9b3379d301b3f88572575ecca6d.png)

What specific part of the table are you wanting to change?

---

<div class="post-metadata">

**Author:** ![Roberto\_Luis](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@Roberto\_Luis](https://forum.inductiveautomation.com/u/Roberto_Luis)\
**Post date:** [December 10, 2023, 4:51pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/3 "2023-12-10T16:51:06Z")

</div>

I want the exactly part you've got black, but when I try it just changes the left part, where we can select each row using the checkboxes.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 10, 2023, 4:58pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/4 "2023-12-10T16:58:09Z")

</div>

Is it because the number of rows you have fills the whole table?

---

<div class="post-metadata">

**Author:** ![Roberto\_Luis](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@Roberto\_Luis](https://forum.inductiveautomation.com/u/Roberto_Luis)\
**Post date:** [December 14, 2023, 2:18pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/5 "2023-12-14T14:18:22Z")

</div>

No, I didnt. During my tests, there were just 3-5 alarms on table

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 14, 2023, 2:26pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/6 "2023-12-14T14:26:24Z")

</div>

I'm not sure. I have done a complete dark mode tutorial for the alarm status table before, although it's kind of off topic in the thread it's in.

Here's the link to it. Perhaps there will be something buried in there that will help you get the result you are after:

> [@Change the header color of a Alarm Status Table](https://forum.inductiveautomation.com/t/change-the-header-color-of-a-alarm-status-table/41933/13):
>
> Today, I developed a dark mode for the alarm status table, and indeed, the header was a bit tricky. The top right corner can be set directly, but to change the header itself, I ended up setting it's background to transparent, so the underlying color could come through. The top left corner underneath the multistate button is a buffered image, so I ended up having to create a graphic to paint over it. Here is the result: Here is the full code for dark mode in a version that was set up …

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/f/3fadcfe0df287eecd2533db885915b9f69dd6228.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 14, 2023, 3:44pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/7 "2023-12-14T15:44:26Z")

</div>

One bad thing about using a dark background color on a Vision table with checkboxes is that they become hard to see. I've also done an alarm status table tutorial on how to customize the checkboxes. Perhaps that will help you out as well:  
[Alarm table checkbox size](https://forum.inductiveautomation.com/t/alarm-table-checkbox-size/67665/3)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f21883f873f190efba5bb58b4be70104b107439b.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 14, 2023, 3:58pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/8 "2023-12-14T15:58:22Z")

</div>

Psst! Don't use dark mode! At least, don't force anyone to use it. It increases eyestrain, a problem for all but the youngest of users.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [December 17, 2023, 10:02am UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/9 "2023-12-17T10:02:12Z")

</div>

For me, the background changes only if I set `'Marquee Mode'` to ON... 😕  
 ![AlarmStatusTableBackground](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/d/fdbe3206b3c6ffdb2e16d0d2a0bff92abc6a87b4.gif)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 17, 2023, 3:08pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/10 "2023-12-17T15:08:43Z")

</div>

> [@zxcslo](#):
>
> the background changes only if I set `'Marquee Mode'` to ON

There must be something additional because I still can't replicate this behavior with either marquee mode setting. My test environment is currently 8.1.20, so I'm overdue for an upgrade. ~~Do you know if the table has always been this way, or was this behavior just recently noticed?~~

**Edit:** I just upgraded to 8.1.35, and that made the difference. The full background no longer changes color unless Marquee Mode is true.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 17, 2023, 4:53pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/11 "2023-12-17T16:53:14Z")

</div>

Looking for a work around, _**[Other than simply using the marquee mode]**_, 🤣 I dug around in the component when the marquee mode was False, and found that the JideScrollPane provides the background color for the missing segment.  
Here is a script I developed that fills in the missing background from a test button:

```auto
# This function recursively finds the JideScrollPane
# ...and sets its background to match the tableBackground
def setTableBackground(table):
	for component in table.getComponents():
		if component. __class__. __name__ == 'JideScrollPane':
			component.background = statusTable.tableBackground
			break
		setTableBackground(component)

# Get the status table
statusTable = event.source.parent.getComponent('Alarm Status Table')

# Fill in the missing the background color using the setTableBackground function
setTableBackground(statusTable)

```

I tried to do this from a listener that would be applied to the scroll pane at initialization, but the listener doesn't survive any marquee mode change or any subsequent background color change, so the scroll pane must be replaced during these events.

Also, I found that changing the tableBackground and marqueeMode propertyChange event does NOT produce an event in the propertyChange event handler, so those properties can't be used to automatically fill in the missing color during property changes.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 18, 2023, 3:03pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/12 "2023-12-18T15:03:32Z")

</div>

**Update:** This morning, I took another look at this, and this time, I added a container listener to the jpanel that holds the JideScrollPane. Whenever the component switches to Marquee mode, the JideScrollPane is replaced with a MarqueePane, and visa versa. While this is not surprising, what did surprise me was that any time the table background color was changed, the JideScrollPane was removed and added again. My guess is that in a recent version, the JideScrollPane lost something that allowed it to color match the table.

In any case, this initialization script will put a container listener on the pane's parent jpanel that will automatically match the JideScrollPane's color to the table background at initialization and any time the marquee mode or table background properties are subsequently changed:

```auto
# Written for the Alarm Status Table's propertyChange event handler.
# Note: 'componentRunning' fires only once when the component is first initialized
# ...and will only fire in the designer if preview mode is running
# ...BEFORE the window containing this component is opened
if event.propertyName == 'componentRunning':
	from java.awt.event import ContainerListener
	
	# This custom container listener matches the jideScrollPane background
	# ...to the table background at initialization and any time a JideScrollPane is added
	# A JideScroll Pane is added whenever the marquee mode is set to False
	# ...or when the table background is changed whild NOT in marquee mode
	class ComponentSwapListener(ContainerListener):
		def __init__ (self, jpanel):
			self.setBG(jpanel)
			
		def componentAdded(self, event):
			self.setBG(event.source)
			
		def componentRemoved(self, event):
			pass
		
		def setBG(self, jpanel):
			#pane = jpanel.getComponent(0)
			#...but just in case:
			for pane in jpanel.getComponents():
				if pane. __class__. __name__ == 'JideScrollPane':
					pane.background = statusTable.tableBackground
					break
	
	# This function locates the jpanel that contains either the JideScrollPane or the MarqueePane
	# ...and adds a listener to detect a JideScrollPane being added
	def setListener(statusTable):
		for component in statusTable.getComponents():
			if component. __class__. __name__ in ['JideScrollPane', 'MarqueePane']:
				listener = ComponentSwapListener(component.parent)
				component.parent.addContainerListener(listener)
				break
			setListener(component)
	
	# Assign the status table to a variable for use by the listener
	# ...and call the setListener function
	statusTable = event.source
	setListener(statusTable)

```

**Result:**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/0/f034eb0d70f1b5f325f0e49ef34ede2c0149b543.png)

---

<div class="post-metadata">

**Author:** ![sahil.jain](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sahil.jain](https://forum.inductiveautomation.com/u/sahil.jain)\
**Post date:** [January 1, 2024, 11:32pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-background-color-doesnt-change/82897/13 "2024-01-01T23:32:02Z")

</div>

Thank you, @justinedwards.jle. Your script worked like a charm. I just upgraded to 8.1.35, had the same issue, and was beginning to question whether the background colour had ever been different - good to know I wasn't imagining things!
