Package squidpony.squidgrid.gui

Examples of squidpony.squidgrid.gui.TextCellFactory


    private MovingCharactersDemo() {

        frame = new JFrame("SquidGrid Moving Objects Demonstration");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        display = new SwingPane(width, height, new TextCellFactory(new Font("Ariel", Font.BOLD, 20), 24, 24), null);
        display.put(map);
        display.refresh();
        frame.getContentPane().add(display, BorderLayout.SOUTH);
        frame.getContentPane().setBackground(SColor.BLACK);
        frame.setVisible(true);
View Full Code Here


        Container panel = frame.getContentPane();
        panel.setBackground(SColor.BLACK);
        panel.setLayout(new BorderLayout());

        JLayeredPane layers = new JLayeredPane();
        TextCellFactory textFactory = new TextCellFactory(font, cellWidth, cellHeight, true, 0, CHARS_USED);
        mapPanel = new SwingPane(width, height, textFactory, null);
        mapPanel.put(width / 2 - 4, height / 2, "Loading");
        mapPanel.refresh();
        mapBackPanel = new SwingPane(width, height, textFactory, null);
        mapBackPanel.refresh();
View Full Code Here

        int pixelWidth = frame.getContentPane().getWidth();
        int pixelHeight = frame.getContentPane().getHeight();
        pixelWidth = (int) Math.ceil(pixelWidth / (width + statsWidth));//convert to pixels per grid cell
        pixelHeight = (int) Math.ceil(pixelHeight / (height + outputLines));//convert to pixels per grid cell
        TextCellFactory textFactory = new TextCellFactory(font, pixelWidth, pixelHeight, true, 0, TextCellFactory.DEFAULT_FITTING + upChar + downChar);

        mapPanel = new SwingPane(width, height, textFactory, null);
        mapPanel.put(width / 2 - 4, height / 2, "Loading...");
        mapPanel.refresh();
        frame.add(mapPanel, BorderLayout.WEST);
View Full Code Here

        frame.setJMenuBar(bar);

        control = new squidpony.squidgrid.gui.FontChoiceControlPanel(width, height);
        frame.getContentPane().add(control, BorderLayout.NORTH);

        textFactory = new TextCellFactory(control.getFontFace(), control.getCellWidth(), control.getCellHeight());
        display = new SwingPane(width, height, textFactory, null);
        back = new SwingPane(width, height, textFactory, null);

        final JLayeredPane layers = new JLayeredPane();
        layers.setLayer(display, JLayeredPane.PALETTE_LAYER);
        layers.setLayer(back, JLayeredPane.DEFAULT_LAYER);
        layers.add(display);
        layers.add(back);
        layers.setSize(display.getPreferredSize());
        layers.setPreferredSize(display.getPreferredSize());
        layers.setMinimumSize(display.getPreferredSize());
        frame.add(layers, BorderLayout.SOUTH);
        frame.getContentPane().setBackground(SColor.BLACK);

        String text = "";
        for (char c = 33; c <= 125; c++) {
            text += c;
        }
        control.inputTextArea.setText(text);

        control.updateButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                control.validateInput();
                layers.remove(display);
                layers.remove(back);
               
                textFactory = new TextCellFactory(control.getFontFace(), control.getCellWidth(), control.getCellHeight(),
                        control.antialiasBox.isSelected(), control.getTopPad(), control.getBottomPad(), control.getLeftPad(), control.getRightPad(),
                        control.inputTextArea.getText());
                display = new SwingPane(width, height, textFactory, null);
                back = new SwingPane(width, height, textFactory, null);
               
View Full Code Here

    }

    private SGKeyEchoDemo() {
        frame = new JFrame("Key Echo Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        display = new SwingPane(width, height, new TextCellFactory(new Font("Sans Serif", Font.BOLD, 18), 18, 18), null);
        frame.getContentPane().add(display);
        frame.getContentPane().setBackground(SColor.BLACK);

        frame.pack();
        frame.setVisible(true);
View Full Code Here

        panel = new JPanel();
        panel.setBackground(SColor.BLACK);
        panel.setLayout(new BorderLayout());

        TextCellFactory textFactory = new TextCellFactory(font, cellWidth, cellHeight, true, 0, CHARS_USED);
        mapPanel = new SwingPane(width, height, textFactory, null);
        mapPanel.put(width / 2 - 4, height / 2, "Loading");
        mapPanel.refresh();
        panel.add(mapPanel, BorderLayout.WEST);
View Full Code Here

            }
        });

        cellWidth = 18;
        cellHeight = 18;
        TextCellFactory text = new TextCellFactory(new Font("Ariel", Font.BOLD, 18), cellWidth, cellHeight);
        display = new SwingPane(width, height, text, null);
        back = new SwingPane(width, height, text, null);
        clear();

        JLayeredPane layers = new JLayeredPane();
View Full Code Here

        showColors(ShapeGenerator.buildWindmill(100, 100, verts, horzs, verts));
    }

    public void showColors(TiledShape shape) {
        JFrame frame = new JFrame();
        SwingPane pane = new SwingPane(shape.getWidth(), shape.getHeight(), new TextCellFactory(new Font("Ariel", Font.PLAIN, 10), 12, 12), null);
        frame.add(pane);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
View Full Code Here

TOP

Related Classes of squidpony.squidgrid.gui.TextCellFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.