Search in sources :

Example 1 with ColorPanel

use of com.google.security.zynamics.zylib.gui.ColorPanel.ColorPanel in project binnavi by google.

the class CColorCriteriumPanel method delete.

/**
   * Frees allocated resources.
   */
public void delete() {
    m_selectedColorPanel.removeListener(m_colorPanelListener);
    m_selectedColorPanel.removeMouseListener(m_colorPanelListener);
    for (final ColorPanel cp : m_colorPanels) {
        cp.removeListener(m_colorPanelListener);
        cp.removeMouseListener(m_colorPanelListener);
    }
}
Also used : ColorPanel(com.google.security.zynamics.zylib.gui.ColorPanel.ColorPanel)

Example 2 with ColorPanel

use of com.google.security.zynamics.zylib.gui.ColorPanel.ColorPanel in project binnavi by google.

the class CColorCriteriumPanel method initPanel.

/**
   * Creates the GUI of the panel.
   *
   * @param graph The graph whose node colors are determined.
   */
private void initPanel(final ZyGraph graph) {
    final JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setBorder(new TitledBorder("Edit Color Condition"));
    final JPanel selectedColorPanel = new JPanel(new BorderLayout());
    selectedColorPanel.setBorder(new EmptyBorder(0, 5, 3, 5));
    selectedColorPanel.add(m_selectedColorPanel);
    final List<Color> colors = getColors(graph);
    final JPanel colorGrid = new JPanel(new GridLayout(1 + colors.size() / 4, 4));
    colorGrid.setBorder(new TitledBorder(""));
    for (final Color color : colors) {
        final JPanel outerColorPanel = new JPanel(new BorderLayout());
        outerColorPanel.setBorder(new EmptyBorder(3, 3, 3, 3));
        final ColorPanel colorPanel = new ColorPanel(color, false);
        outerColorPanel.add(colorPanel, BorderLayout.CENTER);
        m_colorPanels.add(colorPanel);
        colorPanel.addListener(m_colorPanelListener);
        colorPanel.addMouseListener(m_colorPanelListener);
        colorGrid.add(outerColorPanel, BorderLayout.NORTH);
    }
    m_selectedColorPanel.setColor(colors.isEmpty() ? new Color(255, 255, 255) : colors.get(0));
    mainPanel.add(selectedColorPanel, BorderLayout.NORTH);
    final JPanel gridContainer = new JPanel(new BorderLayout());
    gridContainer.add(colorGrid, BorderLayout.NORTH);
    gridContainer.setBorder(new EmptyBorder(3, 5, 0, 5));
    mainPanel.add(gridContainer, BorderLayout.CENTER);
    add(mainPanel, BorderLayout.CENTER);
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) ColorPanel(com.google.security.zynamics.zylib.gui.ColorPanel.ColorPanel) Color(java.awt.Color) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Aggregations

ColorPanel (com.google.security.zynamics.zylib.gui.ColorPanel.ColorPanel)2 BorderLayout (java.awt.BorderLayout)1 Color (java.awt.Color)1 GridLayout (java.awt.GridLayout)1 JPanel (javax.swing.JPanel)1 EmptyBorder (javax.swing.border.EmptyBorder)1 TitledBorder (javax.swing.border.TitledBorder)1