Alignment of cell contents

User 8a7878ec6d

30-08-2015 14:39:47

Hi,


In a grid view or table I typically want to have all cell content centered horizontally and vertically. This can only be customized across multiple columns so long as they contain the same type of data (e.g. text). If one tries to customize all columns at once and they contain different data types then an error appears:


java.lang.IllegalArgumentException: horizontalAlignment


at javax.swing.JLabel.checkHorizontalKey(Unknown Source)


at javax.swing.JLabel.setHorizontalAlignment(Unknown Source)


at com.im.ijc.renderers.impl.AbstractSingleLineRenderer.getTableCellRendererComponent(AbstractSingleLineRenderer.java:124)


at javax.swing.JTable.prepareRenderer(Unknown Source)


at com.im.ijc.widgets.table.WBTable.prepareRenderer(WBTable.java:910)


at javax.swing.plaf.basic.BasicTableUI.paintCell(Unknown Source)


at javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source)


at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)


at javax.swing.plaf.ComponentUI.update(Unknown Source)


at javax.swing.JComponent.paintComponent(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JViewport.paint(Unknown Source)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at org.netbeans.swing.tabcontrol.TabbedContainer.paint(TabbedContainer.java:973)


at javax.swing.JComponent.paintChildren(Unknown Source)


at javax.swing.JComponent.paint(Unknown Source)


at javax.swing.JComponent.paintToOffscreen(Unknown Source)


at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)


at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)


at javax.swing.RepaintManager.paint(Unknown Source)


at javax.swing.JComponent._paintImmediately(Unknown Source)


at javax.swing.JComponent.paintImmediately(Unknown Source)


at javax.swing.JComponent.paintImmediately(Unknown Source)


at javax.swing.RepaintManager$3.run(Unknown Source)


at javax.swing.RepaintManager$3.run(Unknown Source)


at java.security.AccessController.doPrivileged(Native Method)


at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)


at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)


at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)


at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)


at javax.swing.RepaintManager.access$1000(Unknown Source)


at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)


at java.awt.event.InvocationEvent.dispatch(Unknown Source)


at java.awt.EventQueue.dispatchEventImpl(Unknown Source)


at java.awt.EventQueue.access$200(Unknown Source)


at java.awt.EventQueue$3.run(Unknown Source)


at java.awt.EventQueue$3.run(Unknown Source)


at java.security.AccessController.doPrivileged(Native Method)


at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)


at java.awt.EventQueue.dispatchEvent(Unknown Source)


[catch] at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:162)


at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)


at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)


at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)


at java.awt.EventDispatchThread.pumpEvents(Unknown Source)


at java.awt.EventDispatchThread.pumpEvents(Unknown Source)


at java.awt.EventDispatchThread.run(Unknown Source)


There is no way out of this other than deleting the view and creating a new one.


It would be great if the alignment of multiple columns could be customized simultaneously irregardless of their content type.


Thanks,


Evert

ChemAxon 206bfdcce5

01-09-2015 08:14:34

Dear Evert,


 


thank you for reporting this issue. I was able to reproduce it and created a bug report in our system for the developers. The bug fix will be released as soon as possible.


 


Best regards,


 


Karla


 

User 8a7878ec6d

17-09-2015 11:45:11

Hi,


In 15.8.24 the error message no longer appears, but if I choose align center/center across multiple columns of different types not all of them are aligned (only numeric is my impression).


Best,


Evert

ChemAxon 206bfdcce5

18-09-2015 14:31:09

Hi Evert,


thank you for the update, I can confirm that the alignment of text fields (when performed together with other field types) does not perform as expected at this moment. It is already listed in our system. I will reply to this topic as soon as the fix is available and it will be also mentioned in the release notes.


I am sorry for any inconvenience.


Best regards,


Karla

ChemAxon 206bfdcce5

15-01-2016 10:20:19

Dear Evert,


this issue was fixed in the 15.12.7.0 version of Instant JChem. Since this version, only compatible alignment options can be used at a time.


Best regards,


Karla