Search in sources :

Example 1 with TextComp

use of main.swing.components.TextComp in project Eidolons by IDemiurge.

the class MusicViewsPanel method createComponent.

// isArrowAlwaysShown(){
// return
@Override
protected G_Panel createComponent(final String key) {
    // return new CustomButton(key) {
    // @Override
    // public void handleClick() {
    // viewClicked(key);
    // }
    // };
    final TextComp comp = new TextComp(Color.black) {

        @Override
        public int getPanelHeight() {
            return super.getPanelHeight() / 3 * 2;
        }
    };
    comp.setText(StringMaster.cropFormat(key));
    // });
    return comp;
}
Also used : TextComp(main.swing.components.TextComp)

Example 2 with TextComp

use of main.swing.components.TextComp in project Eidolons by IDemiurge.

the class G_TabbedPagePanel method createTab.

protected Component createTab(E sub, final int i) {
    TextComp textComp = new TextComp(sub.toString(), Color.black) {

        @Override
        public int getBorderWidth() {
            return 1;
        }

        @Override
        public Color getBorderColor() {
            return currentIndex == i ? ColorManager.ESSENCE : super.getBorderColor();
        }

        @Override
        public int getPanelHeight() {
            return super.getPanelHeight() * 2 / 3;
        }
    };
    // textComp.getde
    textComp.addMouseListener(new MouseClickListener() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            tabClicked(i);
        }
    });
    return textComp;
}
Also used : MouseClickListener(main.swing.generic.services.listener.MouseClickListener) MouseEvent(java.awt.event.MouseEvent) TextComp(main.swing.components.TextComp)

Example 3 with TextComp

use of main.swing.components.TextComp in project Eidolons by IDemiurge.

the class ListButtonPanel method refresh.

@Override
public void refresh() {
    removeAll();
    int n = 0;
    int i = 0;
    for (final String chars : map.keySet()) {
        List<String> lines = map.get(chars);
        lines = panel.sort(lines, chars);
        int wrap = customWrap;
        if (wrap != 0) {
            wrap += Math.min(2, Math.abs(Math.round((wrap * 10 - lines.size()) / 10)));
            TextComp comp = new TextComp(StringMaster.getWellFormattedString(musicConsts.get(i)), Color.black) {

                @Override
                public int getPanelHeight() {
                    return super.getPanelHeight() / 3 * 2;
                }

                @Override
                protected int getDefaultFontSize() {
                    return 15;
                }
            };
            add(comp, "x @center_x");
            if (i == 0) {
                add(comp, "x @center_x");
            }
            i++;
        }
        G_Panel subPanel = new G_Panel("flowy");
        if (wrap == 0) {
            subPanel.setPanelSize(new Dimension(GuiManager.getScreenWidthInt(), GuiManager.getScreenHeightInt() / map.keySet().size()));
            add(subPanel);
        } else {
            add(subPanel, "w " + GuiManager.getScreenWidthInt());
        }
        Character lastLetter = null;
        boolean letterAdded = false;
        for (String line : lines) {
            try {
                char letter = AHK_Master.getLetter(line);
                n = addButton(wrap, n, subPanel, lastLetter, letterAdded, line, letter);
                lastLetter = letter;
                letterAdded = n == 0;
            } catch (Exception e) {
                LogMaster.log(1, "failed: " + line);
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
    }
}
Also used : G_Panel(main.swing.generic.components.G_Panel) TextComp(main.swing.components.TextComp)

Example 4 with TextComp

use of main.swing.components.TextComp in project Eidolons by IDemiurge.

the class SessionWindow method initBox.

private JComboBox initBox(Object[] items, String tooltip) {
    JComboBox<?> box = new JComboBox<>(items);
    box.setSelectedIndex(0);
    box.addActionListener(this);
    G_Panel wrapper = new G_Panel("flowy");
    wrapper.add(new TextComp(tooltip, Color.black));
    wrapper.add(box, "pos 0 20");
    boxPanel.add(wrapper);
    return box;
}
Also used : G_Panel(main.swing.generic.components.G_Panel) TextComp(main.swing.components.TextComp)

Example 5 with TextComp

use of main.swing.components.TextComp in project Eidolons by IDemiurge.

the class SwingMaster method decorateWithText.

public static G_Panel decorateWithText(String tooltip, Color c, Component box, String constraints) {
    G_Panel wrapper = new G_Panel("flowy");
    wrapper.add(new TextComp(tooltip, c));
    wrapper.add(box, constraints);
    return wrapper;
}
Also used : G_Panel(main.swing.generic.components.G_Panel) TextComp(main.swing.components.TextComp)

Aggregations

TextComp (main.swing.components.TextComp)6 G_Panel (main.swing.generic.components.G_Panel)4 MouseEvent (java.awt.event.MouseEvent)1 MouseClickListener (main.swing.generic.services.listener.MouseClickListener)1