Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TableCellTextRenderer {
- @Override
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
- boolean hasFocus, int row, int column) {
- final JTextPane jtextPane = new JTextPane();
- JScrollPane scrollPane = new JScrollPane(jtextPane);
- scrollPane.setPreferredSize(new Dimension(350,350));
- scrollPane.setVisible(true);
- jtextPane.setEditable(false);
- jtextPane.setAutoscrolls(true);
- jtextPane.setContentType("text/html");
- jtextPane.setText(myHtmlText);
- jtextPane.setVisible(true);
- jtextPane.setPreferredSize(new Dimension(350,350));
- //this setViewPort has no effect
- scrollPane.setViewportView(jtextPane);
- jtextPane.setVisible(true);
- scrollPane.setAutoscrolls(true);
- scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
- scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
- JPanel jpanel = new JPanel();
- jpanel.setVisible(true);
- jpanel.setPreferredSize(new Dimension(360, 360));
- jpanel.add(scrollPane);
- return jpanel;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement