Search in sources :

Example 41 with GridLayout

use of java.awt.GridLayout in project DistributedFractalNetwork by Budder21.

the class Display method createStatistics.

private JPanel createStatistics() {
    JPanel p = new JPanel();
    p.setBackground(bgColor);
    p.setLayout(new GridLayout(4, 1));
    frameCountLabel = new JLabel("  Frame Count: ");
    frameCountLabel.setAlignmentY(0);
    frameCountLabel.setFont(labelFont);
    avgRenderTimeLabel = new JLabel("  Average Render Time: ");
    avgRenderTimeLabel.setAlignmentY(0);
    avgRenderTimeLabel.setFont(labelFont);
    numUsersLabel = new JLabel("  User Count: ");
    numUsersLabel.setAlignmentY(0);
    numUsersLabel.setFont(labelFont);
    p.add(frameCountLabel, 3, 0);
    p.add(avgRenderTimeLabel, 2, 0);
    p.add(numUsersLabel, 1, 0);
    JLabel title = new JLabel("Statistics");
    title.setFont(Constants.mediumFont);
    title.setOpaque(true);
    title.setBackground(bgColor);
    JPanel wrapper = new JPanel();
    wrapper.setBackground(bgColor);
    wrapper.add(title);
    p.add(wrapper, 0, 0);
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JLabel(javax.swing.JLabel)

Example 42 with GridLayout

use of java.awt.GridLayout in project DistributedFractalNetwork by Budder21.

the class NetworkView method addNewNetworkElement.

/**
	 * Used to add a new NetworkElement to the display
	 * @param element the new element to be added to the display
	 */
public void addNewNetworkElement(NetworkElement element) {
    elements.add(element);
    panel.removeAll();
    int numRows = elements.size() >= Display.DISPLAY_HEIGHT / NetworkElement.HEIGHT ? elements.size() : Display.DISPLAY_HEIGHT / NetworkElement.HEIGHT;
    panel.setLayout(new GridLayout(numRows, 1));
    int count = 0;
    for (; count < numRows - elements.size(); count++) {
        JPanel temp = new JPanel();
        temp.setBackground(Color.WHITE);
        panel.add(temp, count, 0);
    }
    count = 0;
    for (NetworkElement e : elements) {
        //JSeparator sep = new JSeparator();
        //panel.add(sep, count++, 0);
        panel.add(elements.get(elements.size() - count - 1), count++, 0);
    }
    this.revalidate();
    this.repaint();
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout)

Example 43 with GridLayout

use of java.awt.GridLayout in project DistributedFractalNetwork by Budder21.

the class NetworkView method removeNetworkElement.

/**
	 * Used to remove a network element from the display
	 * @param element the element to be removed
	 */
public void removeNetworkElement(NetworkElement element) {
    elements.remove(element);
    panel.removeAll();
    int numRows = elements.size() >= Display.DISPLAY_HEIGHT / NetworkElement.HEIGHT ? elements.size() : Display.DISPLAY_HEIGHT / NetworkElement.HEIGHT;
    panel.setLayout(new GridLayout(numRows, 1));
    int count = 0;
    for (; count < numRows - elements.size(); count++) {
        JPanel temp = new JPanel();
        temp.setBackground(Color.WHITE);
        panel.add(temp, count, 0);
    }
    count = 0;
    for (NetworkElement e : elements) {
        //JSeparator sep = new JSeparator();
        //panel.add(sep, count++, 0);
        panel.add(elements.get(elements.size() - count - 1), count++, 0);
    }
    this.revalidate();
    this.repaint();
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout)

Example 44 with GridLayout

use of java.awt.GridLayout in project ChatGameFontificator by GlitchCog.

the class ControlWindow method build.

/**
     * Called separately from construction.
     * 
     * @param logBox
     */
public void build(LogBox logBox) {
    constructAboutPopup();
    this.messageDialog = new MessageDialog(fProps, chatWindow, this, logBox);
    this.bot = new ChatViewerBot();
    this.bot.setUsername(fProps.getIrcConfig().getUsername());
    this.controlTabs = new ControlTabs(fProps, bot, messageDialog.getCensorPanel(), logBox);
    this.controlTabs.build(chatWindow, this);
    this.bot.setChatPanel(chatWindow.getChatPanel());
    setLayout(new GridLayout(1, 1));
    add(controlTabs);
    initMenus();
    // This wasn't built before the config was loaded into the chat control
    // tab, so set it here
    setAlwaysOnTopMenu(fProps.getChatConfig().isAlwaysOnTop());
    setRememberPositionMenu(fProps.getChatConfig().isRememberPosition());
    setAntiAliasMenu(fProps.getChatConfig().isAntiAlias());
    setupHelp();
    pack();
    setMinimumSize(getSize());
    setResizable(false);
}
Also used : GridLayout(java.awt.GridLayout) ControlTabs(com.glitchcog.fontificator.gui.controls.panel.ControlTabs) ChatViewerBot(com.glitchcog.fontificator.bot.ChatViewerBot) MessageDialog(com.glitchcog.fontificator.gui.controls.messages.MessageDialog)

Example 45 with GridLayout

use of java.awt.GridLayout in project ChatGameFontificator by GlitchCog.

the class ControlPanelColor method build.

@Override
protected void build() {
    useTwitchBox = new JCheckBox("Override Palette with Twitch Username Colors when Available");
    joinBox = new JCheckBox("Color Join Messages");
    usernameBox = new JCheckBox("Color Usernames");
    timestampBox = new JCheckBox("Color Timestamps");
    messageBox = new JCheckBox("Color Messages");
    ActionListener boxListener = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JCheckBox source = (JCheckBox) e.getSource();
            if (useTwitchBox.equals(source)) {
                config.setUseTwitchColors(source.isSelected());
            } else if (joinBox.equals(source)) {
                config.setColorJoin(source.isSelected());
            } else if (usernameBox.equals(source)) {
                config.setColorUsername(source.isSelected());
            } else if (timestampBox.equals(source)) {
                config.setColorTimestamp(source.isSelected());
            } else if (messageBox.equals(source)) {
                config.setColorMessage(source.isSelected());
            }
            chat.repaint();
        }
    };
    useTwitchBox.addActionListener(boxListener);
    joinBox.addActionListener(boxListener);
    usernameBox.addActionListener(boxListener);
    timestampBox.addActionListener(boxListener);
    messageBox.addActionListener(boxListener);
    bgColorButton = new ColorButton("Background", Color.BLACK, "Set the color of the background of the chat", this);
    chromaColorButton = new ColorButton("Chroma Key", Color.GREEN, "Set the color for the chroma key border region", this);
    fgColorButton = new ColorButton("Text Tint", Color.WHITE, "Set the color of the text of the chat", this);
    borderColorButton = new ColorButton("Border Tint", Color.WHITE, "Set the color of the border of the chat", this);
    highlightButton = new ColorButton("Highlight Tint", Color.YELLOW, "Set the default color used to highlight the text of the chat", this);
    palette = new Palette(Color.BLACK, this);
    JPanel topColorPanel = new JPanel(new GridLayout(2, 1));
    JPanel botOptionsPanel = new JPanel(new GridBagLayout());
    JPanel palettePanel = new JPanel(new GridBagLayout());
    topColorPanel.setBorder(new TitledBorder(baseBorder, "Color Selections", TitledBorder.CENTER, TitledBorder.TOP));
    palettePanel.setBorder(new TitledBorder(baseBorder, "Palette of Colors drawn from, per Username", TitledBorder.CENTER, TitledBorder.TOP));
    botOptionsPanel.setBorder(new TitledBorder(baseBorder, "Color Options", TitledBorder.CENTER, TitledBorder.TOP));
    JPanel colorPanelA = new JPanel(new GridLayout(1, 2));
    colorPanelA.add(bgColorButton);
    colorPanelA.add(chromaColorButton);
    JPanel colorPanelB = new JPanel(new GridLayout(1, 3));
    colorPanelB.add(fgColorButton);
    colorPanelB.add(highlightButton);
    colorPanelB.add(borderColorButton);
    topColorPanel.add(colorPanelA);
    topColorPanel.add(colorPanelB);
    GridBagConstraints ppGbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, NO_INSETS, 0, 0);
    palettePanel.add(palette, ppGbc);
    ppGbc.gridy++;
    palettePanel.add(useTwitchBox, ppGbc);
    GridBagConstraints optionsGbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, DEFAULT_INSETS, 0, 0);
    botOptionsPanel.add(joinBox, optionsGbc);
    optionsGbc.gridx++;
    botOptionsPanel.add(usernameBox, optionsGbc);
    optionsGbc.gridx = 0;
    optionsGbc.gridy++;
    botOptionsPanel.add(timestampBox, optionsGbc);
    optionsGbc.gridx++;
    botOptionsPanel.add(messageBox, optionsGbc);
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1.0;
    add(topColorPanel, gbc);
    gbc.gridy++;
    add(palettePanel, gbc);
    gbc.gridy++;
    add(botOptionsPanel, gbc);
    // Filler panel
    gbc.gridy++;
    gbc.anchor = GridBagConstraints.SOUTH;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    add(new JPanel(), gbc);
    gbc.gridy++;
}
Also used : JCheckBox(javax.swing.JCheckBox) Palette(com.glitchcog.fontificator.gui.component.palette.Palette) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) GridBagConstraints(java.awt.GridBagConstraints) ActionListener(java.awt.event.ActionListener) ColorButton(com.glitchcog.fontificator.gui.component.ColorButton) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) TitledBorder(javax.swing.border.TitledBorder)

Aggregations

GridLayout (java.awt.GridLayout)189 JPanel (javax.swing.JPanel)149 JLabel (javax.swing.JLabel)79 BorderLayout (java.awt.BorderLayout)67 Dimension (java.awt.Dimension)51 JButton (javax.swing.JButton)41 ActionEvent (java.awt.event.ActionEvent)36 JScrollPane (javax.swing.JScrollPane)34 ActionListener (java.awt.event.ActionListener)32 Insets (java.awt.Insets)28 JCheckBox (javax.swing.JCheckBox)28 JTextField (javax.swing.JTextField)28 GridBagConstraints (java.awt.GridBagConstraints)24 GridBagLayout (java.awt.GridBagLayout)23 ButtonGroup (javax.swing.ButtonGroup)22 FlowLayout (java.awt.FlowLayout)21 BoxLayout (javax.swing.BoxLayout)21 TitledBorder (javax.swing.border.TitledBorder)19 PlotCanvas (smile.plot.PlotCanvas)16 EmptyBorder (javax.swing.border.EmptyBorder)15