How to change bg color JXTaskPaneContainer

I want to change the background blue to a white taskpanecontainer. I used the line below, but nothing acts on this line.

UIManager.put("TaskPaneContainer.background", Color.LIGHT_GRAY); 

Please give me some idea about bg color change.

 public class NewJFrame2 extends javax.swing.JFrame { public NewJFrame2() { initComponents(); setSize(462, 300); add(doInit()); setBackground(Color.WHITE); } private Component doInit() { JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer(); //taskpanecontainer.setLayout(new VerticalLayout(2)); JXTaskPane taskpane1 = new JXTaskPane(); taskpane1.setTitle("First TaskPane"); JXTable table = new JXTable(); DefaultTableModel model = new DefaultTableModel(); model.addColumn("ParameterName"); model.addColumn("ParameterType"); model.addColumn("Operation"); model.addRow(new Object[]{"Request", "String", "Delete"}); model.addRow(new Object[]{"Request", "String", "Delete"}); table.setModel(model); ((JComponent) taskpane1.getContentPane()).setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); taskpane1.add(table); taskpanecontainer.add(taskpane1); taskpanecontainer.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0)); return taskpanecontainer; } } 

I also share my image, so I cleared in your mind. enter image description here

thanks

+6
source share
2 answers

As always, the background property may not be respected by LAF. This is the fi case for taskpaneContainer in Win: an artist is used to fill the background (Swingx!). Thus, the property provided

 UIManager.put("TaskPaneContainer.backgroundPainter", new MattePainter(Color.RED)); 
+5
source

The following thing is very simple and worked for me like a charm:

 taskPaneContainer.setBackground(Color.WHITE); taskPaneContainer.setBackgroundPainter(null); 
0
source

All Articles