lphystudio.app.graphicalmodelpanel.viewer.TaxaComponent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lphy-studio Show documentation
Show all versions of lphy-studio Show documentation
The GUI for LPhy language.
The newest version!
package lphystudio.app.graphicalmodelpanel.viewer;
import lphy.base.evolution.Taxa;
import lphy.base.evolution.Taxon;
import javax.swing.*;
public class TaxaComponent extends JLabel {
public TaxaComponent(Taxa taxa) {
Taxon[] taxonArray = taxa.getTaxonArray();
boolean hasSpecies = taxonArray[0].getSpecies() != null && taxonArray[0].getSpecies() != taxonArray[0].getName();
StringBuilder builder = new StringBuilder();
builder.append("Taxa ");
if (hasSpecies) {
builder.append("Species ");
}
builder.append("Age ");
for (Taxon taxon : taxonArray) {
builder.append("");
builder.append(taxon.getName());
builder.append(" ");
if (hasSpecies) {
builder.append("");
builder.append(taxon.getSpecies());
builder.append(" ");
}
builder.append("");
builder.append(taxon.getAge());
builder.append(" ");
}
builder.append("
");
setText(builder.toString());
}
}