setMaximumSize [message #669320] |
Mon, 09 May 2011 17:50  |
Eclipse User |
|
|
|
Hello,
Could anyone tell me why the method "setMaximumSize" the example below is not working?
public class BoxFigure extends RectangleFigure {
/**
* @generated
*/
private WrappingLabel fFigureBoxLabelFigure;
/**
* @generated
*/
private RectangleFigure fBoxContentCompartmentFigure;
/**
* @not generated
*/
public BoxFigure() {
this.setPreferredSize(new Dimension(getMapMode().DPtoLP(150),
getMapMode().DPtoLP(100)));
this.setBorder(new MarginBorder(getMapMode().DPtoLP(5),
getMapMode().DPtoLP(5), getMapMode().DPtoLP(5),
getMapMode().DPtoLP(5)));
this.setMaximumSize(new Dimension(getMapMode().DPtoLP(300),
getMapMode().DPtoLP(200)));
this.setMinimumSize(new Dimension(getMapMode().DPtoLP(150),
getMapMode().DPtoLP(100)));
createContents();
}
Thanks a lot!
Elvis
|
|
|
|
Re: setMaximumSize [message #670369 is a reply to message #669568] |
Fri, 13 May 2011 13:23   |
Eclipse User |
|
|
|
Hi Antonio,
Thanks for the help, the issue is that I'm not able to use the method "setMaximumSize" the method "setMinimumSize" works correctly: can't reduce the element beyond what is allowed. Already the method "setMaximumSize(new Dimension(getMapMode().DPtoLP(300), getMapMode().DPtoLP(200)));" not prevent the extension of the element to the size of 600 x 400 for example.
Down the BoxEditPart (XXX.diagram.edit.parts):
/**
* @generated
*/
public class BoxFigure extends RectangleFigure {
/**
* @generated
*/
private WrappingLabel fFigureBoxLabelFigure;
/**
* @generated NOT
*/
public BoxFigure() {
this.setPreferredSize(new Dimension(getMapMode().DPtoLP(100),
getMapMode().DPtoLP(50)));
this.setBorder(new MarginBorder(getMapMode().DPtoLP(5),
getMapMode().DPtoLP(5), getMapMode().DPtoLP(5),
getMapMode().DPtoLP(5)));
this.setMinimumSize(new Dimension(getMapMode().DPtoLP(150),
getMapMode().DPtoLP(100)));
this.setMaximumSize(new Dimension(getMapMode().DPtoLP(300),
getMapMode().DPtoLP(200)));
createContents();
}
/**
* @generated
*/
private void createContents() {
fFigureBoxLabelFigure = new WrappingLabel();
fFigureBoxLabelFigure.setText("Box");
this.add(fFigureBoxLabelFigure);
}
/**
* @generated
*/
public WrappingLabel getFigureBoxLabelFigure() {
return fFigureBoxLabelFigure;
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04002 seconds