ARTICLE AD BOX
I have a very simple JTable, similar to the following minimal, reproducible example
import module java.base; import module java.desktop; void main() { SwingUtilities .invokeLater ( () -> { JOptionPane .showMessageDialog ( null, new JTable ( new Object[][] { new Object[]{1, 2, 3}, new Object[]{4, 5, 6}, new Object[]{7777, 88888, 99999} }, new Object[]{"abc", "xyz", "tuv"} ) ) ; } ) ; }When a user selects all table contents, and then copies them, depending on where they paste it, it renders differently.
If you paste it on Notepad++, it randers as a tab separated list of strings. If you paste it in gmail on the browser, it renders as an HTML table, using the literal <table> tag and everything.That HTML thing is cool, but expected -- Swing uses a little HTML under the hood, so I'm not surprised. But I'd like to be able to alter the resulting copied data, like add some borders to it. What is the simplest way to do this in Swing?
Obviously, I could alter or generate the HTML myself once it lands in the user's clipboard, but I'd consider that a last resort.
Best case scenario is that I could something like myTable.setBorder(BorderFactory.createLineBorder()) and simply have that set things for me. Obviously, the cells are handled by things like a ListCellRenderer, so I could probably do that.
But my goal here is to find the simplest way to modify the HTML of the cells. For example, to create borders around each cell.
