Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

In this page you can find the example usage for java.awt BorderLayout EAST.

Prototype

String EAST

To view the source code for java.awt BorderLayout EAST.

Click Source Link

Document

The east layout constraint (right side of container).

Usage

From source file:org.apache.jmeter.visualizers.CreateReport.java

/**
 * Main visualizer setup./* ww  w.ja v a  2 s  .  com*/
 */
private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();

    Border margin = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(makeTitlePanel());
    mainPanel.add(createSavePanel());
    myJTable = new JTable(model);
    myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    myScrollPane = new JScrollPane(myJTable);
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(myScrollPane, BorderLayout.CENTER);
    saveTable.addActionListener(this);
    JPanel opts = new JPanel();
    opts.add(useGroupName, BorderLayout.WEST);
    opts.add(saveTable, BorderLayout.CENTER);
    opts.add(saveHeaders, BorderLayout.EAST);
    this.add(opts, BorderLayout.SOUTH);
}

From source file:net.sf.jhylafax.JHylaFAX.java

private void initializeStatusBar() {
    statusBarPanel = new JPanel(new BorderLayout());
    getContentPane().add(statusBarPanel, BorderLayout.SOUTH);

    statusLabel = new JLabel();
    statusBarPanel.add(statusLabel, BorderLayout.CENTER);

    serverInfoLabel = new JLabel();
    statusBarPanel.add(serverInfoLabel, BorderLayout.EAST);
}

From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPUrlConfigGui.java

/**
 * Create a panel containing the proxy server details
 *
 * @return the panel//from  ww  w  .  j a  v a2s . c  o  m
 */
protected final JPanel getProxyServerPanel() {
    JPanel proxyServer = new HorizontalPanel();
    proxyServer.add(getProxyHostPanel(), BorderLayout.CENTER);
    proxyServer.add(getProxyPortPanel(), BorderLayout.EAST);

    JPanel proxyLogin = new HorizontalPanel();
    proxyLogin.add(getProxyUserPanel());
    proxyLogin.add(getProxyPassPanel());

    JPanel proxyServerPanel = new HorizontalPanel();
    proxyServerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            UPMPConstant.upmp_proxy_server_title)); // $NON-NLS-1$
    proxyServerPanel.add(proxyServer, BorderLayout.CENTER);
    proxyServerPanel.add(proxyLogin, BorderLayout.EAST);

    return proxyServerPanel;
}

From source file:WizardDialog.java

/**
 * Standard constructor - creates panel with the specified button labels.
 * //from ww  w  .  ja va 2 s.  co  m
 * @param label1
 *          the label for button 1.
 * @param label2
 *          the label for button 2.
 * @param label3
 *          the label for button 3.
 * @param label4
 *          the label for button 4.
 */
public L1R3ButtonPanel(final String label1, final String label2, final String label3, final String label4) {

    setLayout(new BorderLayout());

    // create the pieces...
    final JPanel panel = new JPanel(new BorderLayout());
    final JPanel panel2 = new JPanel(new BorderLayout());
    this.left = new JButton(label1);
    this.right1 = new JButton(label2);
    this.right2 = new JButton(label3);
    this.right3 = new JButton(label4);

    // ...and put them together
    panel.add(this.left, BorderLayout.WEST);
    panel2.add(this.right1, BorderLayout.EAST);
    panel.add(panel2, BorderLayout.CENTER);
    panel.add(this.right2, BorderLayout.EAST);
    add(panel, BorderLayout.CENTER);
    add(this.right3, BorderLayout.EAST);

}

From source file:org.pentaho.ui.xul.swing.tags.SwingDialog.java

private void createDialog() {

    if (getParent() instanceof XulDialog) {
        Object parentObj = ((SwingDialog) getParent()).getDialog();
        dialog = new JDialog((Dialog) parentObj);
        centerComp = (Component) parentObj;
    } else if (getParent() instanceof XulWindow) {

        Object parentObj = getParent().getManagedObject();
        dialog = new JDialog((Frame) parentObj);
        centerComp = (Component) parentObj;
    } else {/*from  ww  w. j  a  va 2 s  .  c  om*/

        Document doc = getDocument();
        Element rootElement = doc.getRootElement();
        XulWindow window = null;
        if (rootElement != this) { // dialog is root, no JFrame Parent
            window = (XulWindow) rootElement;
        }

        if (window != null) {
            frame = (JFrame) window.getManagedObject();
            dialog = new JDialog(frame);
            centerComp = frame;
        } else {

            final Object context = domContainer.getOuterContext();
            if (context instanceof JFrame) {
                frame = (JFrame) context;
                centerComp = (Component) context;
                dialog = new JDialog(frame);
            } else if (context instanceof JDialog) {
                dialog = new JDialog((JDialog) context);
                centerComp = (Component) context;
            } else if (context instanceof JComponent) {
                dialog = new JDialog();
                centerComp = (Component) context;
            } else {
                dialog = new JDialog();
            }
        }
    }

    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setResizable(getResizable());
    dialog.setLayout(new BorderLayout());

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setOpaque(true);
    int pad = (this.getPadding() > -1) ? getPadding() : 3;
    mainPanel.setBorder(BorderFactory.createEmptyBorder(pad, pad, pad, pad));

    dialog.setTitle(title);
    dialog.setModal(isModal());
    dialog.add(mainPanel, BorderLayout.CENTER);
    mainPanel.add(container, BorderLayout.CENTER);
    container.setOpaque(false);

    if (this.header != null) {

        JPanel headerPanel = new JPanel(new BorderLayout());
        headerPanel.setBackground(Color.decode("#5F86C0"));
        headerPanel.setOpaque(true);
        JPanel headerPanelInner = new JPanel(new BorderLayout());
        headerPanelInner.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
        headerPanelInner.setOpaque(false);

        headerPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.decode("#8FB1E5"),
                Color.decode("#446CA9")));

        JLabel title = new JLabel(this.header.getTitle());

        title.setForeground(Color.white);
        headerPanelInner.add(title, BorderLayout.WEST);

        JLabel desc = new JLabel(this.header.getDescription());
        desc.setForeground(Color.white);
        headerPanelInner.add(desc, BorderLayout.EAST);

        headerPanel.add(headerPanelInner, BorderLayout.CENTER);

        mainPanel.add(headerPanel, BorderLayout.NORTH);
    }

    populateButtonPanel();
    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
    dialog.setSize(new Dimension(getWidth(), getHeight()));
    dialog.setPreferredSize(new Dimension(getWidth(), getHeight()));
    dialog.setMinimumSize(new Dimension(getWidth(), getHeight()));

    if (this.getBgcolor() != null) {
        mainPanel.setBackground(Color.decode(this.getBgcolor()));
    }

}

From source file:com.intuit.tank.proxy.ProxyApp.java

private JPanel getTransactionTable() {
    JPanel frame = new JPanel(new BorderLayout());
    model = new TransactionTableModel();
    final JTable table = new TransactionTable(model);
    final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);/*from ww w  . ja v a2s. co m*/
    final JPopupMenu pm = new JPopupMenu();
    JMenuItem item = new JMenuItem("Delete Selected");
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            int[] selectedRows = table.getSelectedRows();
            if (selectedRows.length != 0) {
                int response = JOptionPane.showConfirmDialog(ProxyApp.this,
                        "Are you sure you want to delete " + selectedRows.length + " Transactions?",
                        "Confirm Delete", JOptionPane.YES_NO_OPTION);
                if (response == JOptionPane.YES_OPTION) {
                    int[] correctedRows = new int[selectedRows.length];
                    for (int i = selectedRows.length; --i >= 0;) {
                        int row = selectedRows[i];
                        int index = (Integer) table.getValueAt(row, 0) - 1;
                        correctedRows[i] = index;
                    }
                    Arrays.sort(correctedRows);
                    for (int i = correctedRows.length; --i >= 0;) {
                        int row = correctedRows[i];
                        Transaction transaction = model.getTransactionForIndex(row);
                        if (transaction != null) {
                            model.removeTransaction(transaction, row);
                            isDirty = true;
                            saveAction.setEnabled(isDirty && !stopAction.isEnabled());
                        }
                    }
                }
            }
        }
    });
    pm.add(item);
    table.add(pm);

    table.addMouseListener(new MouseAdapter() {
        boolean pressed = false;

        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                Point p = e.getPoint();
                int row = table.rowAtPoint(p);
                int index = (Integer) table.getValueAt(row, 0) - 1;
                Transaction transaction = model.getTransactionForIndex(index);
                if (transaction != null) {
                    detailsTF.setText(transaction.toString());
                    detailsTF.setCaretPosition(0);
                    detailsDialog.setVisible(true);
                }
            }
        }

        /**
         * @{inheritDoc
         */
        @Override
        public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) {
                pressed = true;
                int[] selectedRows = table.getSelectedRows();
                if (selectedRows.length != 0) {
                    pm.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }

        /**
         * @{inheritDoc
         */
        @Override
        public void mouseReleased(MouseEvent e) {
            if (!pressed && e.isPopupTrigger()) {
                int[] selectedRows = table.getSelectedRows();
                if (selectedRows.length != 0) {
                    pm.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }

    });

    JScrollPane pane = new JScrollPane(table);
    frame.add(pane, BorderLayout.CENTER);
    JPanel panel = new JPanel(new BorderLayout());
    JLabel label = new JLabel("Filter: ");
    panel.add(label, BorderLayout.WEST);
    final JLabel countLabel = new JLabel(" Count: 0 ");
    panel.add(countLabel, BorderLayout.EAST);
    final JTextField filterText = new JTextField("");
    filterText.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent e) {
            String text = filterText.getText();
            if (text.length() == 0) {
                sorter.setRowFilter(null);
            } else {
                try {
                    sorter.setRowFilter(RowFilter.regexFilter(text));
                    countLabel.setText(" Count: " + sorter.getViewRowCount() + " ");
                } catch (PatternSyntaxException pse) {
                    System.err.println("Bad regex pattern");
                }
            }
        }
    });
    panel.add(filterText, BorderLayout.CENTER);

    frame.add(panel, BorderLayout.NORTH);
    return frame;
}

From source file:org.rdv.viz.image.ImageViz.java

private void initFocusControls() {
    focusControls = new JPanel();
    focusControls.setLayout(new BorderLayout());

    JButton nearFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-near.gif"));
    nearFocusButton.setBorder(null);// ww  w.  java  2 s  .c om
    nearFocusButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            focusNear();
        }
    });
    focusControls.add(nearFocusButton, BorderLayout.WEST);

    JButton focusControlButton = new StrechIconButton(
            DataViewer.getIcon("icons/ptz/robotic_control-focusbar-medium.gif"));
    focusControlButton.setBorder(null);
    focusControlButton.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            JButton button = (JButton) e.getComponent();
            int focus = Math.round(100f * e.getPoint().x / button.getWidth());
            focus(focus);
        }
    });

    focusControls.add(focusControlButton, BorderLayout.CENTER);

    JPanel focusControlsRight = new JPanel();
    focusControlsRight.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));

    JButton farFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-far.gif"));
    farFocusButton.setBorder(null);
    farFocusButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            focusFar();
        }
    });
    focusControlsRight.add(farFocusButton);

    JButton autoFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-auto.gif"));
    autoFocusButton.setBorder(null);
    autoFocusButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            focusAuto();
        }
    });
    focusControlsRight.add(autoFocusButton);

    focusControls.add(focusControlsRight, BorderLayout.EAST);
}

From source file:snepsui.Interface.DrawNetwork.java

/**
 * Initializes the components in the DrawNetwork panel
 *//*  w  ww.  j a v a 2s  .co  m*/
private void initGUI() {
    nodesList = new LinkedList<Node>();
    molNodes = new Hashtable<String, CaseFrame>();
    builtMolNodes = new Hashtable<String, Node>();

    this.setPreferredSize(new Dimension(815, 600));

    graph = new DirectedOrderedSparseMultigraph<String, String>();

    this.layout = new StaticLayout<String, String>(graph, new Dimension(700, 450));

    shape = new Transformer<String, Integer>() {
        public Integer transform(String vertex) {
            int stringLength = 0;
            if (molNodes.containsKey(vertex)) {
                stringLength = 3;
            } else {
                for (Node node : nodesList) {
                    if (vertex.equals(node.getIdentifier())) {
                        stringLength = node.getIdentifier().length();
                    }
                }
            }
            return stringLength;
        }
    };

    vertexPaint = new Transformer<String, Paint>() {
        public Paint transform(String vertex) {
            if (molNodes.containsKey(vertex)) {
                if (builtMolNodes.containsKey(vertex)) {
                    Node node = builtMolNodes.get(vertex);
                    if (node.getClass().getSimpleName().equals("PatternNode")) {
                        return Color.blue;
                    } else if (node.getClass().getSimpleName().equals("ClosedNode")) {
                        return Color.yellow;
                    }
                } else
                    return Color.white;
            } else {
                for (Node node : nodesList) {
                    if (node.getIdentifier().equals(vertex)) {
                        if (node.getClass().getSimpleName().equals("BaseNode")) {
                            return Color.green;
                        } else if (node.getClass().getSimpleName().equals("VariableNode")) {
                            return Color.gray;
                        } else if (node.getClass().getSimpleName().equals("PatternNode")) {
                            return Color.blue;
                        } else if (node.getClass().getSimpleName().equals("ClosedNode")) {
                            return Color.yellow;
                        } else {
                            return Color.magenta;
                        }
                    }
                }
            }
            return Color.white;
        }
    };

    edgeLabel = new Transformer<String, String>() {
        public String transform(String edge) {
            String result = "";

            if (edge.isEmpty())
                graph.removeEdge("");
            vv.repaint();
            try {
                result = edge.substring(0, edge.indexOf(":"));
            } catch (StringIndexOutOfBoundsException e) {

            }
            return result;
        }
    };

    VertexShapeSizeAspect<String> vssa = new VertexShapeSizeAspect<String>(graph, shape);

    vv = new VisualizationViewer<String, String>(layout, new Dimension(700, 470));
    vv.setBackground(Color.white);

    vv.getRenderContext().setVertexLabelTransformer(MapTransformer.<String, String>getInstance(
            LazyMap.<String, String>decorate(new HashMap<String, String>(), new ToStringLabeller<String>())));
    vv.getRenderContext().setEdgeLabelTransformer(MapTransformer.<String, String>getInstance(
            LazyMap.<String, String>decorate(new HashMap<String, String>(), new ToStringLabeller<String>())));
    vv.setVertexToolTipTransformer(vv.getRenderContext().getVertexLabelTransformer());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
    vv.getRenderContext().setVertexShapeTransformer(vssa);
    vv.getRenderContext()
            .setEdgeLabelClosenessTransformer(new ConstantDirectionalEdgeValueTransformer(0.5, 0.5));
    vv.getRenderContext().setEdgeLabelTransformer(edgeLabel);
    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            point = e.getPoint();
        }

        public void mouseReleased(MouseEvent e) {
            vv.repaint();
        }
    });
    vssa.setScaling(true);

    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    this.add(panel);
    Factory<String> vertexFactory = new VertexFactory();
    Factory<String> edgeFactory = new EdgeFactory();

    final EditingModalGraphMouse<String, String> graphMouse = new EditingModalGraphMouse<String, String>(
            vv.getRenderContext(), vertexFactory, edgeFactory);

    graphMouse.add(new CustomEditingPopupGraphMousePlugin<String>(vertexFactory, edgeFactory));
    graphMouse.remove(graphMouse.getPopupEditingPlugin());

    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    graphMouse.setMode(ModalGraphMouse.Mode.EDITING);

    final ScalingControl scaler = new CrossoverScalingControl();

    vv.scaleToLayout(scaler);

    String path = "src/snepsui/Interface/resources/icons/";

    JButton plus = new JButton();
    plus.setIcon(new ImageIcon(path + "zoom_in.png"));
    plus.setSize(18, 18);
    plus.setFocusPainted(false);
    plus.setBorderPainted(false);
    plus.setContentAreaFilled(false);
    plus.setMargin(new Insets(0, 0, 0, 0));
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });

    JButton minus = new JButton();
    minus.setIcon(new ImageIcon(path + "zoom_out.png"));
    minus.setSize(18, 18);
    minus.setFocusPainted(false);
    minus.setBorderPainted(false);
    minus.setContentAreaFilled(false);
    minus.setMargin(new Insets(0, 0, 0, 0));
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 2));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JButton colors = new JButton(new ImageIcon(path + "colors.png"));
    colors.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(getRootPane(), new NodeColors());
        }
    });

    JButton infoButton = new JButton(new ImageIcon(path + "info.png"));
    infoButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(vv, instructions, "Instructions", JOptionPane.INFORMATION_MESSAGE,
                    new ImageIcon("src/snepsui/Interface/resources/icons/info.png"));
        }
    });

    JButton resetbutton = new JButton(new ImageIcon(path + "refresh.png"));
    resetbutton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            ImageIcon icon = new ImageIcon("src/snepsui/Interface/resources/icons/info.png");
            int result = JOptionPane.showConfirmDialog(vv, "Are you sure you want to reset the drawing area?",
                    "Reset", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, icon);
            if (result == JOptionPane.YES_OPTION) {
                builtMolNodes.clear();
                molNodes.clear();
                nodesList.clear();

                LinkedList<String> vertexList = new LinkedList<String>();
                Collection<String> vertices = graph.getVertices();
                for (String vertex : vertices) {
                    vertexList.add(vertex);
                }

                for (String item : vertexList) {
                    graph.removeVertex(item);
                }
                vv.repaint();
            }
        }
    });

    JLabel caseframeLabel = new JLabel("Case Frames");
    DefaultComboBoxModel caseframeComboBoxModel = new DefaultComboBoxModel(
            new String[] { "define-caseframe", "undefine-caseframe" });
    caseframeComboBox = new JComboBox();
    caseframeComboBox.setModel(caseframeComboBoxModel);
    caseframeComboBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            addCaseFrameCommands(e);
        }
    });

    JLabel relationsLabel = new JLabel("Relations");
    DefaultComboBoxModel relationsComboBoxModel = new DefaultComboBoxModel(
            new String[] { "define", "undefine" });
    relationsComboBox = new JComboBox();
    relationsComboBox.setModel(relationsComboBoxModel);
    relationsComboBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            addRelationCommands(e);
        }
    });

    JPanel options = new JPanel(new GridLayout(3, 1));
    options.add(infoButton);
    options.add(resetbutton);
    options.add(colors);
    this.add(options, BorderLayout.EAST);

    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(scaleGrid);
    controls.add(relationsLabel);
    controls.add(relationsComboBox);
    controls.add(caseframeLabel);
    controls.add(caseframeComboBox);
    JComboBox modeBox = graphMouse.getModeComboBox();
    controls.add(modeBox);
    this.add(controls, BorderLayout.SOUTH);
}

From source file:lu.lippmann.cdb.graph.GraphViewImpl.java

/**
 * {@inheritDoc}//from  w w  w . j  a  v a 2 s .  co  m
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void init() {
    this.setBackground(new Color(235, 240, 245));
    //this.setBackground(Color.WHITE);

    this.removeAll();

    //normal init
    final CadralShapeRenderer vlasr = new CadralShapeRenderer(null, vv.getRenderContext());

    // -----------------------------
    // customize the render context
    // -----------------------------
    final Transformer<CNode, String> vertexLabelTransformer = new Transformer<CNode, String>() {
        @Override
        public String transform(final CNode node) {
            final String tagString = (!node.getTags().isEmpty()) ? " [TAGGED!]" : "";
            final FontMetrics fm = vv.getFontMetrics(vv.getFont());
            final int textWidth = fm.stringWidth(node.getName());
            final int tagWidth = fm.stringWidth(tagString);
            int nodeWidth = (int) ShapeFactory.createShape(node.getShape()).getBounds().getWidth();
            final boolean hasTags = !node.getTags().isEmpty();
            final int realTextWidth = textWidth + (hasTags ? tagWidth : 0);
            final String modifiedNodeName = node.getName() + (hasTags ? tagString : "");
            if (realTextWidth > nodeWidth - 10) {
                int maxSubStringIndex = -1;
                for (int subStringIndex = node.getName().length(); subStringIndex >= 1; subStringIndex--) {
                    String newString = node.getName().substring(0, subStringIndex) + "..." + tagString;
                    if (fm.stringWidth(newString) < nodeWidth - 10) {
                        maxSubStringIndex = subStringIndex;
                        break;
                    }
                }
                return node.getName().substring(0, maxSubStringIndex) + "..." + tagString;
            } else {
                return modifiedNodeName;
            }
        }
    };

    vv.getRenderContext().setVertexLabelTransformer(vertexLabelTransformer);
    vv2.getRenderContext().setVertexLabelTransformer(vertexLabelTransformer);

    final Transformer<CNode, String> vertexTooltipTransformer = new Transformer<CNode, String>() {
        @Override
        public String transform(final CNode input) {
            if (!input.getTags().isEmpty()) {
                return buildTooltipFromTags(input.getName(), input.getTags());
            } else {
                if (!input.getName().equals(vertexLabelTransformer.transform(input))) {
                    return input.getName();
                } else {
                    return null;
                }
            }
        }
    };
    vv.setVertexToolTipTransformer(vertexTooltipTransformer);
    vv2.setVertexToolTipTransformer(vertexTooltipTransformer);

    final Transformer<CEdge, String> edgeTooltipTransformer = new Transformer<CEdge, String>() {
        @Override
        public String transform(final CEdge input) {
            if (!input.getTags().isEmpty()) {
                return buildTooltipFromTags(input.getName(), input.getTags());
            } else {
                return input.getName();
            }
        }
    };
    vv.setEdgeToolTipTransformer(edgeTooltipTransformer);
    vv2.setEdgeToolTipTransformer(edgeTooltipTransformer);

    vv.getRenderContext().setVertexFillPaintTransformer(new CadralVertexColorRenderer());
    vv2.getRenderContext().setVertexFillPaintTransformer(new CadralVertexColorRenderer());

    final CadralFontTransformer cadralFontTransformer = new CadralFontTransformer();
    vv.getRenderContext().setVertexFontTransformer(cadralFontTransformer);

    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv2.getRenderContext().setVertexShapeTransformer(vlasr);

    //VERTEX LABEL RENDERER
    vv.getRenderer().setVertexLabelRenderer(vlasr);
    vv2.getRenderer().setVertexLabelRenderer(vlasr);

    //FIXME : magic number
    vv.getRenderContext().setLabelOffset(16);
    vv2.getRenderContext().setLabelOffset(16);

    // custom edges
    final Transformer<CEdge, String> edgeLabelTransformer = new Transformer<CEdge, String>() {
        @Override
        public String transform(final CEdge input) {
            return input.getExpression() + (input.getTags().isEmpty() ? "" : " [TAGGED!]");
        }
    };
    vv.getRenderContext().setEdgeLabelTransformer(edgeLabelTransformer);
    vv2.getRenderContext().setEdgeLabelTransformer(edgeLabelTransformer);

    final Font myFont = new Font("Helvetica", 0, 12);

    //FAST EDGE LABEL RENDERER BUT NOT GOOD ENOUGH
    //sun.font.FontManager.getFont2D(myFont);   

    vv.getRenderContext().setEdgeFontTransformer(cadralFontTransformer);
    vv2.getRenderContext().setEdgeFontTransformer(new ConstantTransformer(myFont));

    vv.getRenderContext().setEdgeLabelClosenessTransformer(new ConstantTransformer(0.5));
    vv2.getRenderContext().setEdgeLabelClosenessTransformer(new ConstantTransformer(0.5));

    vv.getRenderContext().setEdgeDrawPaintTransformer(getDefaultEdgeDrawPaintTransformer());
    vv2.getRenderContext().setEdgeDrawPaintTransformer(getDefaultEdgeDrawPaintTransformer());

    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.BLUE, false));
    vv2.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.BLUE, false));

    vv.getRenderContext().setArrowDrawPaintTransformer(
            new PickableEdgePaintTransformer<CEdge>(vv.getPickedEdgeState(), Color.BLACK, Color.BLUE));
    vv.getRenderContext().setArrowFillPaintTransformer(
            new PickableEdgePaintTransformer<CEdge>(vv.getPickedEdgeState(), Color.BLACK, Color.BLUE));

    vv2.getRenderContext().setArrowDrawPaintTransformer(
            new PickableEdgePaintTransformer<CEdge>(vv.getPickedEdgeState(), Color.BLACK, Color.BLUE));
    vv2.getRenderContext().setArrowFillPaintTransformer(
            new PickableEdgePaintTransformer<CEdge>(vv.getPickedEdgeState(), Color.BLACK, Color.BLUE));

    //Manage Zoom
    vv.addMouseWheelListener(new MouseWheelListener() {

        private int zoom = 0;

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {

            if (e.getWheelRotation() < 0) {
                zoom++;
            } else {
                zoom--;
            }

            if (zoom > 0) {
                if (zoom < 9) {
                    double scale = 1 + zoom / 6.0;
                    CadralShapeRenderer.setScale(scale);
                    cadralFontTransformer.setScale(scale);
                }
            } else {
                CadralShapeRenderer.setScale(1);
                cadralFontTransformer.setScale(1);
            }
        }
    });

    final Container panel = new JPanel(new BorderLayout());
    final Container rightPanel = new JPanel(new GridLayout(2, 1));
    panel.add(vv);
    final JPanel top = new JPanel();
    final JButton button = new JButton("Rescale");
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            rescaleSatelliteView();
        }
    });
    top.add(button);
    rightPanel.add(top);
    rightPanel.add(vv2);
    panel.add(rightPanel, BorderLayout.EAST);

    setLayout(new BorderLayout());

    add(metaInfosPanel, BorderLayout.NORTH);

    if (!USE_EXPERIMENTAL_SATELLITE_VIEW) {
        add(vv, BorderLayout.EAST);
    } else {
        add(panel, BorderLayout.EAST);
    }

    add(sharedLabel, BorderLayout.SOUTH);

    add(aboutPanel, BorderLayout.CENTER);

    validate();
    repaint();
}

From source file:shuffle.fwk.service.roster.EditRosterService.java

private Component makeBottomPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.insets = new Insets(0, 10, 0, 10);
    c.weightx = 1.0;/*from  ww w.  j a  v  a 2  s .com*/
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx++;
    selectedDisplayLabel = new JLabel(getString(KEY_NONE_SELECTED));
    selectedDisplayLabel.setToolTipText(getString(KEY_SELECTED_TOOLTIP));
    ;
    ret.add(selectedDisplayLabel, c);
    c.insets = new Insets(0, 0, 0, 0);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 1.0;
    c.gridx++;
    teamFilter = new JCheckBox(getString(KEY_TEAM));
    JPanel teamFilterPanel = new JPanel(new BorderLayout());
    teamFilterPanel.add(teamFilter, BorderLayout.WEST);
    teamFilter.setToolTipText(getString(KEY_TEAM_TOOLTIP));
    ret.add(teamFilterPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    activeEffect = new EffectChooser(false, EffectChooser.DefaultEntry.SPECIES);
    JPanel activeEffectPanel = new JPanel(new BorderLayout());
    activeEffectPanel.add(activeEffect, BorderLayout.WEST);
    activeEffect.setToolTipText(getString(KEY_ACTIVE_EFFECT));
    ret.add(activeEffectPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JPanel skillPanel = new JPanel(new BorderLayout());
    ImageIcon skillBoosterIcon = getUser().getImageManager().getImageFor(KEY_SKILL_BOOSTER);
    JLabel skillBoosterLabel = new JLabel(skillBoosterIcon);
    skillPanel.add(skillBoosterLabel, BorderLayout.EAST);
    skillLevels = new JComboBox<Integer>();
    skillLevels.setEnabled(false);
    skillLevels.addItem(1);
    skillPanel.add(skillLevels, BorderLayout.WEST);
    skillPanel.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP));
    skillLevels.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP));
    ret.add(skillPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JPanel speedupPanel = new JPanel(new BorderLayout());
    ImageIcon candyIcon = getUser().getImageManager().getImageFor(KEY_CANDY_ICON);
    JLabel candyLabel = new JLabel(candyIcon);
    speedupPanel.add(candyLabel, BorderLayout.EAST);
    speedups = new JComboBox<Integer>();
    speedups.setEnabled(false);
    speedups.addItem(0);
    speedupPanel.add(speedups, BorderLayout.WEST);
    speedupPanel.setToolTipText(getString(KEY_CANDY_TOOLTIP));
    speedups.setToolTipText(getString(KEY_CANDY_TOOLTIP));
    ret.add(speedupPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JButton okButton = new JButton(getString(KEY_OK));
    okButton.setToolTipText(getString(KEY_OK_TOOLTIP));
    ret.add(okButton, c);
    setDefaultButton(okButton);

    c.anchor = GridBagConstraints.CENTER;
    c.weightx = 0.0;
    c.gridx++;
    JButton applyButton = new JButton(getString(KEY_APPLY));
    applyButton.setToolTipText(getString(KEY_APPLY_TOOLTIP));
    ret.add(applyButton, c);

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx++;
    JButton cancelButton = new JButton(new DisposeAction(getString(KEY_CANCEL), this));
    cancelButton.setToolTipText(getString(KEY_CANCEL_TOOLTIP));
    ret.add(cancelButton, c);

    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onOK();
        }
    });
    applyButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onApply();
        }
    });
    addSpeedupsListener();
    return ret;
}