SudeepShakya
SudeepShakya

Reputation: 621

displaying label in swt table in eclipse rcp

I have created a swt table and i don't know how to display the text in desired font. But i know how to do it in jlabel. I am having problem to add the jlabel to the swt.table. For jLabel I have done like this :

String theString = "All the King's men";
JLabel theLabel = new JLabel(theString);
java.awt.Font theFont = new java.awt.Font("Helvetica", Font.PLAIN, 10);
theLabel.setFont(theFont);

So how to insert the label text to the table columns?

Upvotes: 1

Views: 317

Answers (1)

Alexey Romanov
Alexey Romanov

Reputation: 170733

You can't mix SWT and AWT in this way. Instead, you should call TableItem.setFont(Font). Note that it takes org.eclipse.swt.graphics.Font and not java.awt.Font!

Upvotes: 2

Related Questions