public JPanel demo(Graph g, final String label) {
    // create a new radial tree view
    final PhysioMapRadialGraphView gview =
        new PhysioMapRadialGraphView(settings, g, label, semsimmodel);
    Visualization vis = gview.getVisualization();

    // create a search panel for the tree map
    SearchQueryBinding sq =
        new SearchQueryBinding(
            (Table) vis.getGroup(treeNodes),
            label,
            (SearchTupleSet) vis.getGroup(Visualization.SEARCH_ITEMS));
    JSearchPanel search = sq.createSearchPanel();
    search.setShowResultCount(true);
    search.setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 0));
    search.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11));

    final JTextArea title = new JTextArea();
    title.setPreferredSize(new Dimension(450, 500));
    title.setMaximumSize(new Dimension(450, 500));
    title.setMinimumSize(new Dimension(450, 500));

    title.setAlignmentY(CENTER_ALIGNMENT);
    title.setLineWrap(true);
    title.setWrapStyleWord(true);
    title.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
    title.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11));

    gview.addControlListener(
        new ControlAdapter() {
          public void itemEntered(VisualItem item, MouseEvent e) {}

          public void itemExited(VisualItem item, MouseEvent e) {
            title.setText(null);
          }
        });

    Box searchbox = new Box(BoxLayout.X_AXIS);
    searchbox.add(Box.createHorizontalStrut(10));
    searchbox.add(search);
    searchbox.add(Box.createHorizontalStrut(3));

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(searchbox, BorderLayout.NORTH);
    panel.add(gview, BorderLayout.CENTER);
    panel.add(Box.createGlue(), BorderLayout.SOUTH);

    Color BACKGROUND = Color.WHITE;
    Color FOREGROUND = Color.DARK_GRAY;
    UILib.setColor(panel, BACKGROUND, FOREGROUND);

    return panel;
  }
Exemple #2
0
  public static void main(String[] args) {
    trial hello = new trial(1, "hi");
    JSearchPanel search =
        new JSearchPanel(
            hello.getVisualization(), NODES, Visualization.SEARCH_ITEMS, LABEL, true, true);
    search.setShowResultCount(true);

    search.setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 0));

    // search.setBackground(ColorLib.getColor(0, 0, 255));
    // search.setForeground(ColorLib.getColor(0, 255, 255));

    final JFastLabel title = new JFastLabel("                 ");
    title.setPreferredSize(new Dimension(10, 10));
    title.setVerticalAlignment(SwingConstants.BOTTOM);
    title.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));

    // title.setBackground(ColorLib.getColor(255, 0, 255));
    //  title.setForeground(ColorLib.getColor(0, 100, 255));

    JPanel box = new JPanel(new GridLayout(3, 1));
    //  box.add(Box.createHorizontalStrut(1));
    box.add(title);
    //  box.add(Box.createHorizontalGlue());
    box.add(search);
    // box.add(Box.createHorizontalStrut(1));
    //  box.setBackground(ColorLib.getColor(10, 0, 255));

    box.setSize(300, 100);

    JFrame frame = new JFrame("Dmoz");
    frame.add(box);
    frame.getContentPane().add(hello);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocation(0, 0);
    frame.setSize(1200, 800);
    frame.setVisible(true);
  }