Sets the plot window size in pixels. @see #setFrameSize(int,int)
(int width, int height)
| 574 | * @see #setFrameSize(int,int) |
| 575 | */ |
| 576 | public void setWindowSize(int width, int height) { |
| 577 | scale = 1.0f; |
| 578 | makeMarginValues(); |
| 579 | int titleBarHeight = 22; |
| 580 | int infoHeight = 11; |
| 581 | double scale = Prefs.getGuiScale(); |
| 582 | if (scale>1.0) |
| 583 | infoHeight = (int)(infoHeight*scale); |
| 584 | int buttonPanelHeight = 45; |
| 585 | if (pp.width <= 0) { //plot not drawn yet? |
| 586 | int extraWidth = leftMargin+rightMargin+ImageWindow.HGAP*2; |
| 587 | int extraHeight = topMargin+bottomMargin+titleBarHeight+infoHeight+buttonPanelHeight; |
| 588 | if (extraWidth<width) |
| 589 | width -= extraWidth; |
| 590 | if (extraHeight<height) |
| 591 | height -= extraHeight; |
| 592 | preferredPlotWidth = width; |
| 593 | preferredPlotHeight = height; |
| 594 | } else { |
| 595 | int extraWidth = ImageWindow.HGAP*2; |
| 596 | int extraHeight = titleBarHeight+infoHeight+buttonPanelHeight; |
| 597 | if (extraWidth<width) |
| 598 | width -= extraWidth; |
| 599 | if (extraHeight<height) |
| 600 | height -= extraHeight; |
| 601 | setSize(width, height); |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | /** The minimum plot size including borders, in pixels (at scale=1) */ |
| 606 | public Dimension getMinimumSize() { |
nothing calls this directly
no test coverage detected