Search in sources :

Example 1 with OwnTextArea

use of gaiasky.util.scene2d.OwnTextArea in project gaiasky by langurmonkey.

the class ReleaseNotesWindow method build.

@Override
protected void build() {
    float taWidth = 1300f;
    float taHeight = 900f;
    try {
        String releaseNotes = Files.readString(releaseNotesFile).trim();
        OwnLabel title = new OwnLabel(Settings.getApplicationTitle(false) + "   " + Settings.settings.version.version, skin, "header");
        content.add(title).left().pad(pad10).padBottom(pad20).row();
        OwnTextArea releaseNotesText = new OwnTextArea(releaseNotes, skin, "disabled-nobg");
        releaseNotesText.setDisabled(true);
        releaseNotesText.setPrefRows(30);
        releaseNotesText.setWidth(taWidth - 15f);
        float fontHeight = releaseNotesText.getStyle().font.getLineHeight();
        releaseNotesText.offsets();
        releaseNotesText.setHeight((releaseNotesText.getLines() + 3) * fontHeight);
        releaseNotesText.clearListeners();
        OwnScrollPane scroll = new OwnScrollPane(releaseNotesText, skin, "default-nobg");
        scroll.setWidth(taWidth);
        scroll.setHeight(taHeight);
        scroll.setForceScroll(false, true);
        scroll.setSmoothScrolling(false);
        scroll.setFadeScrollBars(false);
        content.add(scroll).center().pad(pad10);
        content.pack();
    } catch (IOException e) {
        // Show error
        OwnLabel error = new OwnLabel(I18n.txt("error.file.read", releaseNotesFile.toString()), skin);
        content.add(error).center();
    }
}
Also used : OwnScrollPane(gaiasky.util.scene2d.OwnScrollPane) OwnLabel(gaiasky.util.scene2d.OwnLabel) IOException(java.io.IOException) OwnTextArea(gaiasky.util.scene2d.OwnTextArea)

Example 2 with OwnTextArea

use of gaiasky.util.scene2d.OwnTextArea in project gaiasky by langurmonkey.

the class MemInfoWindow method build.

@Override
protected void build() {
    float pad = 8f;
    float taWidth = 1200f;
    StringBuilder memInfoStr = new StringBuilder();
    for (MemoryPoolMXBean mpBean : ManagementFactory.getMemoryPoolMXBeans()) {
        memInfoStr.append(I18n.txt("gui.help.name")).append(": ").append(mpBean.getName()).append(": ").append(mpBean.getUsage()).append("\n");
    }
    OwnTextArea memInfo = new OwnTextArea(memInfoStr.toString(), skin, "disabled-nobg");
    memInfo.setDisabled(true);
    memInfo.setPrefRows(13);
    memInfo.setWidth(taWidth - 15f);
    float fontHeight = memInfo.getStyle().font.getLineHeight();
    memInfo.offsets();
    memInfo.setHeight((memInfo.getLines() + 3) * fontHeight);
    memInfo.clearListeners();
    OwnScrollPane memInfoScroll = new OwnScrollPane(memInfo, skin, "minimalist-nobg");
    memInfoScroll.setWidth(taWidth);
    memInfoScroll.setForceScroll(false, false);
    memInfoScroll.setSmoothScrolling(true);
    memInfoScroll.setFadeScrollBars(false);
    content.add(memInfoScroll).padBottom(pad).row();
}
Also used : OwnScrollPane(gaiasky.util.scene2d.OwnScrollPane) MemoryPoolMXBean(java.lang.management.MemoryPoolMXBean) OwnTextArea(gaiasky.util.scene2d.OwnTextArea)

Aggregations

OwnScrollPane (gaiasky.util.scene2d.OwnScrollPane)2 OwnTextArea (gaiasky.util.scene2d.OwnTextArea)2 OwnLabel (gaiasky.util.scene2d.OwnLabel)1 IOException (java.io.IOException)1 MemoryPoolMXBean (java.lang.management.MemoryPoolMXBean)1