Examples of SwingPane


Examples of squidpony.squidgrid.gui.SwingPane

    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

Examples of squidpony.squidgrid.gui.SwingPane

        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();
        layers.setLayer(mapPanel, JLayeredPane.PALETTE_LAYER);
        layers.setLayer(mapBackPanel, JLayeredPane.DEFAULT_LAYER);
        layers.add(mapPanel);
        layers.add(mapBackPanel);

        layers.setSize(mapPanel.getPreferredSize());
        layers.setPreferredSize(mapPanel.getPreferredSize());
        panel.add(layers, BorderLayout.WEST);

        statsPanel = new SwingPane(statWidth, mapPanel.gridHeight(), textFactory, null);
        statsPanel.setDefaultForeground(SColor.RUST);
        statsPanel.refresh();
        panel.add(statsPanel, BorderLayout.EAST);

        outputPanel = new SwingPane(mapPanel.gridWidth() + statsPanel.gridWidth(), outputLines, textFactory, null);
        outputPanel.setDefaultForeground(SColor.BURNT_BAMBOO);
        outputPanel.refresh();
        panel.add(outputPanel, BorderLayout.SOUTH);

        frame.pack();
View Full Code Here

Examples of squidpony.squidgrid.gui.SwingPane

        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);

        statsPanel = new SwingPane(statsWidth, mapPanel.gridHeight(), textFactory, null);
        statsPanel.setDefaultForeground(SColor.RUST);
        statsPanel.refresh();
        frame.add(statsPanel, BorderLayout.EAST);

        outputPanel = new SwingPane(mapPanel.gridWidth() + statsPanel.gridWidth(), outputLines, textFactory, null);
        outputPanel.setDefaultForeground(SColor.DODGER_BLUE);
        outputPanel.put(outputPanel.gridWidth() - 1, 0, upChar, SColor.DARK_BLUE_DYE);
        outputPanel.put(outputPanel.gridWidth() - 1, outputPanel.gridHeight() - 1, downChar, SColor.DARK_BLUE_DYE);
        for (int y = 1; y < outputPanel.gridHeight() - 1; y++) {//fill in vertical line between scroll arrowheads
            outputPanel.put(outputPanel.gridWidth() - 1, y, SColor.SILVER);
View Full Code Here

Examples of squidpony.squidgrid.gui.SwingPane

        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);
               
                layers.setLayer(display, JLayeredPane.PALETTE_LAYER);
                layers.setLayer(back, JLayeredPane.DEFAULT_LAYER);
                layers.add(display);
                layers.add(back);
View Full Code Here

Examples of squidpony.squidgrid.gui.SwingPane

    }

    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

Examples of squidpony.squidgrid.gui.SwingPane

        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);

        statsPanel = new SwingPane(statWidth, mapPanel.gridHeight(), textFactory, null);
        statsPanel.setDefaultForeground(SColor.RUST);
        statsPanel.refresh();
        panel.add(statsPanel, BorderLayout.EAST);

        outputPanel = new SwingPane(mapPanel.gridWidth() + statsPanel.gridWidth(), outputLines, textFactory, null);
        outputPanel.setDefaultForeground(SColor.BURNT_BAMBOO);
        outputPanel.refresh();
        panel.add(outputPanel, BorderLayout.SOUTH);

        frame.add(panel);
View Full Code Here

Examples of squidpony.squidgrid.gui.SwingPane

        });

        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();
        layers.setLayer(display, JLayeredPane.PALETTE_LAYER);
        layers.setLayer(back, JLayeredPane.DEFAULT_LAYER);
View Full Code Here

Examples of squidpony.squidgrid.gui.SwingPane

        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);
        for (int x = 0; x < shape.getWidth(); x++) {
            for (int y = 0; y < shape.getHeight(); y++) {
                pane.put(x, y, SColorFactory.asSColor(Integer.parseInt(shape.getStringAt(x, y))));
            }
        }
        pane.refresh();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.