コード例 #1
0
  /**
   * Create a new CreatureDetailsWindow displaying details for the specified Creature.
   *
   * @param creature the Creature to show details for
   */
  public CreatureDetailsWindow(Creature creature) {
    this.creature = creature;
    creature.addViewer(this);

    this.setSize(280, 300);
    this.setTitle("Details for " + creature.getTemplate().getName());

    DialogLayout layout = new DialogLayout();
    layout.setTheme("content");
    this.add(layout);

    // set up the widgets for the top row
    Widget viewer = new Viewer();
    viewer.setTheme("iconviewer");
    Label title = new Label(creature.getTemplate().getName());
    title.setTheme("titlelabel");

    DialogLayout.Group topRowV = layout.createParallelGroup(viewer, title);

    DialogLayout.Group topRowH = layout.createSequentialGroup(viewer);
    topRowH.addGap(10);
    topRowH.addWidget(title);
    topRowH.addGap(10);

    // create widgets for details text area
    textAreaModel = new HTMLTextAreaModel();
    TextArea textArea = new TextArea(textAreaModel);
    ScrollPane textPane = new ScrollPane(textArea);
    textPane.setFixed(ScrollPane.Fixed.HORIZONTAL);
    textPane.setTheme("detailspane");

    // set the main top level layout
    Group mainGroupV = layout.createSequentialGroup();
    mainGroupV.addGroup(topRowV);
    mainGroupV.addGap(5);
    mainGroupV.addWidget(textPane);

    Group mainGroupH = layout.createParallelGroup();
    mainGroupH.addGroup(topRowH);
    mainGroupH.addWidget(textPane);

    layout.setHorizontalGroup(mainGroupH);
    layout.setVerticalGroup(mainGroupV);

    entityUpdated(creature);
  }
コード例 #2
0
ファイル: TwlTest.java プロジェクト: ClausRT/Java-GURPS-4e
  public TwlTest() throws Exception {
    renderer = new LWJGLRenderer();

    theme =
        ThemeManager.createThemeManager(SimpleTest.class.getResource("simple_demo.xml"), renderer);

    root = new Widget();
    root.setTheme("");

    gui = new GUI(root, renderer);
    gui.setSize();
    gui.applyTheme(theme);

    addTestAlert(10, 10, "<minwidth");

    addTestAlert(10, 100, "Between min and max width");

    addTestAlert(
        10,
        180,
        "Past max width but less than max height. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. ");

    addTestAlert(
        10,
        350,
        "Past max width and past max height. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "
            + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. ");
  }