Skip to content

Commit

Permalink
BEAUti more dimension setting updates for hi res screens #492
Browse files Browse the repository at this point in the history
  • Loading branch information
rbouckaert committed Aug 16, 2016
1 parent 9dd868b commit 7013dc3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/beast/app/beauti/ParametricDistributionInputEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public void paintComponent(java.awt.Graphics g) {
// ignore
}

Font font = g.getFont();
double minValue = 0.1;
double maxValue = 1;
try {
Expand Down Expand Up @@ -188,6 +187,7 @@ public void paintComponent(java.awt.Graphics g) {
final int NR_OF_TICKS_Y = m_nTicks;

// draw ticks on edge
Font font = g.getFont();
Font smallFont = new Font(font.getName(), font.getStyle(), font.getSize() * 2/3);
g.setFont(smallFont);

Expand Down Expand Up @@ -248,31 +248,32 @@ public void paintComponent(java.awt.Graphics g) {
g.drawString(ylabels[i], leftMargin - TICK_LENGTH - 1 - sfm.stringWidth(ylabels[i]), y + 3);
}

g.setFont(new Font(font.getName(), font.getStyle(), font.getSize() * 10 / 12));
int fontHeight = font.getSize() * 10 / 12;
g.setFont(new Font(font.getName(), font.getStyle(), fontHeight));
try {
FontMetrics fontMetrics = g.getFontMetrics();
String[] strs = new String[]{"2.5% Quantile", "5% Quantile", "Median", "95% Quantile", "97.5% Quantile"};
Double[] quantiles = new Double[]{0.025, 0.05, 0.5, 0.95, 0.975};
mayBeUnstable = false;
for (k = 0; k < 5; k++) {

int y = TOP_MARGIN + graphHeight + bottomMargin + g.getFontMetrics().getMaxAscent() + k * 10;
int y = TOP_MARGIN + graphHeight + bottomMargin + g.getFontMetrics().getMaxAscent() + k * fontHeight;

try {
g.drawString(format(m_distr.inverseCumulativeProbability(quantiles[k])), graphWidth / 2 + leftMargin, y);
} catch (MathException e) {
g.drawString("not available", graphWidth / 2 + leftMargin, y);
}
g.drawString(strs[k], graphWidth / 2 - fontMetrics.stringWidth(strs[k]) + leftMargin - 10, y);
g.drawString(strs[k], graphWidth / 2 - fontMetrics.stringWidth(strs[k]) + leftMargin - fontHeight, y);
}
if (mayBeUnstable) {
int x = graphWidth * 3/ 4 + leftMargin; int y =TOP_MARGIN + graphHeight + bottomMargin + 10;
g.drawString("* numbers", x, y + 20);
g.drawString("may not be", x, y + 30);
g.drawString("accurate", x, y + 40);
int x = graphWidth * 3/ 4 + leftMargin; int y =TOP_MARGIN + graphHeight + bottomMargin + fontHeight;
g.drawString("* numbers", x, y + 2*fontHeight);
g.drawString("may not be", x, y + 3*fontHeight);
g.drawString("accurate", x, y + 4*fontHeight);
}
try {
g.drawString("mean " + format(m_distr.getMean()), graphWidth * 3/ 4 + leftMargin, TOP_MARGIN + graphHeight + bottomMargin + 10);
g.drawString("mean " + format(m_distr.getMean()), graphWidth * 3/ 4 + leftMargin, TOP_MARGIN + graphHeight + bottomMargin + fontHeight);
} catch (RuntimeException e) {
// catch in case it is not implemented.
}
Expand Down
4 changes: 4 additions & 0 deletions src/beast/app/draw/EnumInputEditor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package beast.app.draw;

import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -48,6 +49,9 @@ public void init(Input<?> input, BEASTInterface beastObject, int itemNr, ExpandO
}
if (availableValues.size() > 1) {
m_selectPluginBox = new JComboBox<>(availableValues.toArray(new String[0]));
Dimension maxDim = m_selectPluginBox.getPreferredSize();
m_selectPluginBox.setMaximumSize(maxDim);

String selectString = input.get().toString();
m_selectPluginBox.setSelectedItem(selectString);

Expand Down

0 comments on commit 7013dc3

Please sign in to comment.