|
Re: Stange behaviour on resolution change [message #632772 is a reply to message #632753] |
Thu, 14 October 2010 08:57 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
why do u need a thread with 10sec delay for setting the border???
that said if i remove it the problem comes even in normal scanario...
So i think the problem is not with resolution change...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
|
Re: Stange behaviour on resolution change [message #632787 is a reply to message #632784] |
Thu, 14 October 2010 09:23 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
try this...
/**
* This is a callback that will allow us to create the viewer and initialize it.
*/
@Override
public void createPartControl(Composite parent)
{
FigureCanvas main = new FigureCanvas(parent);
main.setBackground(ColorConstants.lightBlue);
main.setLayout(new FormLayout());
Composite compositeModules = new Composite(main, SWT.NONE);
compositeModules.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
layout.numColumns = 2;
layout.makeColumnsEqualWidth = true;
layout.horizontalSpacing = 1;
layout.verticalSpacing = 1;
layout.marginWidth = 1;
layout.marginHeight = 1;
compositeModules.setLayout(layout);
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
final ModuleCanvas moduleCanvas = new ModuleCanvas(compositeModules);
org.eclipse.swt.layout.GridData gridData = new org.eclipse.swt.layout.GridData(
SWT.CENTER);
gridData.heightHint = 90;
gridData.widthHint = 160;
gridData.grabExcessHorizontalSpace = false;
gridData.grabExcessVerticalSpace = false;
moduleCanvas.setLayoutData(gridData);
if (i == 0 && j == 0)
{
// new Thread()
// {
// @Override
// public void run()
// {
// try
// {
// sleep(10000);
// }
// catch (InterruptedException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// Display.getDefault().asyncExec(new Runnable()
// {
//
// @Override
// public void run()
// {
// }
//
// });
// }
// }.start();
// moduleCanvas.setBorder();
}
}
}
// compositeModules.pack();
}
public class ModuleCanvas extends FigureCanvas
{
public ModuleCanvas(Composite parent)
{
super(parent);
LineBorder mLineBorder = new LineBorder();
mLineBorder.setWidth(10);
mLineBorder.setColor(ColorConstants.blue);
this.setBorder(mLineBorder);
Figure f = new RectangleFigure()
{
@Override
public void paint(Graphics graphics)
{
super.paint(graphics);
graphics.drawString("A01", 5, 5); // position
}
};
f.setBackgroundColor(ColorConstants.black);
f.setOpaque(true);
// f.setBackgroundColor(ColorConstants.white);
this.setContents(f);
}
}
since it is happenen any way without thread,it will happen with thread for resolution change...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
[Updated on: Thu, 14 October 2010 09:27] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03413 seconds