Example usage for javax.swing JPanel setBorder

List of usage examples for javax.swing JPanel setBorder

Introduction

In this page you can find the example usage for javax.swing JPanel setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:org.gumtree.vis.hist2d.Hist2DChartEditor.java

private JPanel createHelpPanel(JFreeChart chart) {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = new Hist2DHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);//from  w  w w.  ja v a  2s . co  m
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;

}

From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.graph.CollapsableGraphView.java

public CollapsableGraphView(Graph graph, boolean val) throws HeadlessException {
    super();//from   w w w.  j  av a 2s . c  om
    setGraph(graph);

    layout = new FRLayout(graph);
    Dimension preferredSize = new Dimension(400, 400);
    final VisualizationModel visualizationModel = new DefaultVisualizationModel(layout, preferredSize);
    VisualizationViewer vv = new VisualizationViewer(visualizationModel, preferredSize);

    vv.addGraphMouseListener(new CollapsableGraphMouseListener<Number>());

    vv.getRenderContext().setVertexShapeTransformer(new ClusterVertexShapeTransformer());

    PickedState<Integer> picked_state = vv.getPickedVertexState();

    // create decorators
    vv.getRenderContext().setVertexFillPaintTransformer(IB_TransformerFactory.getDefaultPaintTransformer(vv));

    setVisViewer(vv);

    final PredicatedParallelEdgeIndexFunction eif = PredicatedParallelEdgeIndexFunction.getInstance();
    final Set exclusions = new HashSet();
    eif.setPredicate(new Predicate() {

        public boolean evaluate(Object e) {

            return exclusions.contains(e);
        }
    });

    vv.getRenderContext().setParallelEdgeIndexFunction(eif);

    vv.setBackground(Color.white);

    // add a listener for ToolTips

    vv.setVertexToolTipTransformer(new ToStringLabeller() {

        /*
         * (non-Javadoc)
         * 
         * @see edu.uci.ics.jung.visualization.decorators.DefaultToolTipFunction#
         * getToolTipText(java.lang.Object)
         */
        @Override
        public String transform(Object v) {
            if (v instanceof Graph) {
                return ((Graph) v).getVertices().toString();
            }
            return super.transform(v);
        }
    });

    /**
     * the regular graph mouse for the normal view
     */
    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);

    Container content = getContentPane();
    GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(gzsp);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VisualizationViewer vv = getVisViewer();
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VisualizationViewer vv = getVisViewer();
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JButton collapse = new JButton("Collapse");
    collapse.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            System.out.println("Collapsing the graph");

            // Pick all port zeros, and their IMMEDIATE links
            //        PickManager.getInstance().pickAllSwitches(vv);

            VisualizationViewer vv = getVisViewer();
            Collection picked = new HashSet(vv.getPickedVertexState().getPicked());
            if (picked.size() > 1) {
                System.out.println("CGV: The number picked is: " + picked.size());
                Graph inGraph = layout.getGraph();
                Graph clusterGraph = collapser.getClusterGraph(inGraph, picked);

                Graph g = collapser.collapse(layout.getGraph(), clusterGraph);
                collapsedGraph = g;
                double sumx = 0;
                double sumy = 0;
                for (Object v : picked) {
                    Point2D p = (Point2D) layout.transform(v);
                    sumx += p.getX();
                    sumy += p.getY();
                }
                Point2D cp = new Point2D.Double(sumx / picked.size(), sumy / picked.size());
                vv.getRenderContext().getParallelEdgeIndexFunction().reset();
                layout.setGraph(g);
                layout.setLocation(clusterGraph, cp);
                vv.getPickedVertexState().clear();
                vv.repaint();
            }

            // Collection picked = new
            // HashSet(vv.getPickedVertexState().getPicked());
            // if (picked.size() > 1)
            // {
            // Graph inGraph = layout.getGraph();
            // Graph clusterGraph = collapser.getClusterGraph(inGraph, picked);
            //
            // Graph g = collapser.collapse(layout.getGraph(), clusterGraph);
            // collapsedGraph = g;
            // double sumx = 0;
            // double sumy = 0;
            // for (Object v : picked)
            // {
            // Point2D p = (Point2D) layout.transform(v);
            // sumx += p.getX();
            // sumy += p.getY();
            // }
            // Point2D cp = new Point2D.Double(sumx / picked.size(), sumy /
            // picked.size());
            // vv.getRenderContext().getParallelEdgeIndexFunction().reset();
            // layout.setGraph(g);
            // layout.setLocation(clusterGraph, cp);
            // vv.getPickedVertexState().clear();
            // vv.repaint();
            // }

        }

    });

    JButton compressEdges = new JButton("Compress Edges");
    compressEdges.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            VisualizationViewer vv = getVisViewer();
            Collection picked = vv.getPickedVertexState().getPicked();
            if (picked.size() == 2) {
                Pair pair = new Pair(picked);
                Graph graph = layout.getGraph();
                Collection edges = new HashSet(graph.getIncidentEdges(pair.getFirst()));
                edges.retainAll(graph.getIncidentEdges(pair.getSecond()));
                getExclusions().addAll(edges);
                vv.repaint();
            }

        }
    });

    JButton expandEdges = new JButton("Expand Edges");
    expandEdges.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            VisualizationViewer vv = getVisViewer();
            Collection picked = vv.getPickedVertexState().getPicked();
            if (picked.size() == 2) {
                Pair pair = new Pair(picked);
                Graph graph = layout.getGraph();
                Collection edges = new HashSet(graph.getIncidentEdges(pair.getFirst()));
                edges.retainAll(graph.getIncidentEdges(pair.getSecond()));
                getExclusions().removeAll(edges);
                vv.repaint();
            }

        }
    });

    JButton expand = new JButton("Expand");
    expand.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            VisualizationViewer vv = getVisViewer();
            Collection picked = new HashSet(vv.getPickedVertexState().getPicked());
            for (Object v : picked) {
                if (v instanceof Graph) {

                    Graph g = collapser.expand(layout.getGraph(), (Graph) v);
                    vv.getRenderContext().getParallelEdgeIndexFunction().reset();
                    layout.setGraph(g);
                }
                vv.getPickedVertexState().clear();
                vv.repaint();
            }
        }
    });

    JButton reset = new JButton("Reset");
    reset.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            VisualizationViewer vv = getVisViewer();
            Graph g = getGraph();
            layout.setGraph(g);
            getExclusions().clear();
            vv.repaint();
        }
    });

    JButton help = new JButton("Help");
    help.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog((JComponent) e.getSource(), getInstructions(), "Help",
                    JOptionPane.PLAIN_MESSAGE);
        }
    });
    Class[] combos = getCombos();
    final JComboBox jcb = new JComboBox(combos);
    // use a renderer to shorten the layout name presentation
    jcb.setRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            String valueString = value.toString();
            valueString = valueString.substring(valueString.lastIndexOf('.') + 1);
            return super.getListCellRendererComponent(list, valueString, index, isSelected, cellHasFocus);
        }
    });
    jcb.addActionListener(new LayoutChooser(jcb, vv, this));
    jcb.setSelectedItem(FRLayout.class);

    JPanel controls = new JPanel();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    zoomControls.add(plus);
    zoomControls.add(minus);
    controls.add(zoomControls);
    JPanel collapseControls = new JPanel(new GridLayout(3, 1));
    collapseControls.setBorder(BorderFactory.createTitledBorder("Picked"));
    collapseControls.add(collapse);
    collapseControls.add(expand);
    collapseControls.add(compressEdges);
    collapseControls.add(expandEdges);
    collapseControls.add(reset);
    controls.add(collapseControls);
    controls.add(modeBox);
    controls.add(help);
    controls.add(jcb);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:org.gumtree.vis.hist2d.Hist2DChartEditor.java

private JPanel createCordinatePanel() {
    JPanel wrap = new JPanel(new BorderLayout());

    JPanel coordinate = new JPanel(new GridLayout(3, 1));
    coordinate.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel horizontal = new JPanel(new BorderLayout());
    horizontal// ww w. j  a va 2s.co m
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Horizontal Axis"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Flip X Axis"));
    flipX = new JCheckBox();
    flipX.setActionCommand(FLIP_X_AXIS_COMMAND);
    flipX.addActionListener(this);
    inner.add(flipX);
    inner.add(new JLabel());

    horizontal.add(inner, BorderLayout.NORTH);

    //Vertical group
    JPanel vertical = new JPanel(new BorderLayout());
    vertical.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Vertical Axis"));

    inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Flip Y Axis"));
    flipY = new JCheckBox();
    flipY.setActionCommand(FLIP_Y_AXIS_COMMAND);
    flipY.addActionListener(this);
    inner.add(flipY);
    inner.add(new JLabel());

    vertical.add(inner, BorderLayout.NORTH);

    //Color scale group
    JPanel colorScale = new JPanel(new BorderLayout());
    colorScale.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Color Scale"));

    inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Show Color Scale"));
    showColorScale = new JCheckBox();
    showColorScale.setActionCommand(SHOW_SCALE_COMMAND);
    showColorScale.addActionListener(this);
    inner.add(showColorScale);
    inner.add(new JLabel());

    inner.add(new JLabel("Select Theme"));
    ColorScale[] scales = ColorScale.values();
    colourScaleCombo = new JComboBox(scales);
    //      colourScaleCombo.setMaximumRowCount(7);
    colourScaleCombo.setActionCommand(CHANGE_COLOUR_SCALE_COMMAND);
    colourScaleCombo.addActionListener(this);
    inner.add(colourScaleCombo);
    inner.add(new JLabel());

    inner.add(new JLabel("Use Logarithmic Scale"));
    logarithmScale = new JCheckBox();
    logarithmScale.setActionCommand(LOGARITHM_SCALE_COMMAND);
    logarithmScale.addActionListener(this);
    inner.add(logarithmScale);
    inner.add(new JLabel());

    colorScale.add(inner, BorderLayout.NORTH);

    coordinate.add(horizontal);
    coordinate.add(vertical);
    coordinate.add(colorScale);
    wrap.setName("Coordinate");

    wrap.add(coordinate, BorderLayout.NORTH);
    return wrap;
}

From source file:mekhq.gui.FinancesTab.java

@Override
public void initTab() {
    resourceMap = ResourceBundle.getBundle("mekhq.resources.FinancesTab", new EncodeControl()); //$NON-NLS-1$

    GridBagConstraints gridBagConstraints;

    setLayout(new GridBagLayout());
    ChartPanel financeAmountPanel = (ChartPanel) createGraphPanel(GraphType.BALANCE_AMOUNT);
    ChartPanel financeMonthlyPanel = (ChartPanel) createGraphPanel(GraphType.MONTHLY_FINANCES);

    financeModel = new FinanceTableModel();
    financeTable = new JTable(financeModel);
    financeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    financeTable.addMouseListener(new FinanceTableMouseAdapter(getCampaignGui(), financeTable, financeModel));
    financeTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    TableColumn column = null;/*  www  .j av  a2 s  .  c  o m*/
    for (int i = 0; i < FinanceTableModel.N_COL; i++) {
        column = financeTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(financeModel.getColumnWidth(i));
        column.setCellRenderer(financeModel.getRenderer());
    }
    financeTable.setIntercellSpacing(new Dimension(0, 0));
    financeTable.setShowGrid(false);

    loanModel = new LoanTableModel();
    loanTable = new JTable(loanModel);
    loanTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    loanTable.addMouseListener(new LoanTableMouseAdapter(getCampaignGui(), loanTable, loanModel));
    loanTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    column = null;
    for (int i = 0; i < LoanTableModel.N_COL; i++) {
        column = loanTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(loanModel.getColumnWidth(i));
        column.setCellRenderer(loanModel.getRenderer());
    }
    loanTable.setIntercellSpacing(new Dimension(0, 0));
    loanTable.setShowGrid(false);
    JScrollPane scrollLoanTable = new JScrollPane(loanTable);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    JPanel panBalance = new JPanel(new GridBagLayout());
    panBalance.add(new JScrollPane(financeTable), gridBagConstraints);
    panBalance.setMinimumSize(new java.awt.Dimension(350, 100));
    panBalance.setBorder(BorderFactory.createTitledBorder("Balance Sheet"));
    JPanel panLoan = new JPanel(new GridBagLayout());
    panLoan.add(scrollLoanTable, gridBagConstraints);

    JTabbedPane financeTab = new JTabbedPane();
    financeTab.setMinimumSize(new java.awt.Dimension(450, 300));
    financeTab.setPreferredSize(new java.awt.Dimension(450, 300));

    JSplitPane splitFinances = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panBalance, financeTab);
    splitFinances.setOneTouchExpandable(true);
    splitFinances.setContinuousLayout(true);
    splitFinances.setResizeWeight(1.0);
    splitFinances.setName("splitFinances");

    financeTab.addTab(resourceMap.getString("activeLoans.text"), panLoan);
    financeTab.addTab(resourceMap.getString("cbillsBalanceTime.text"), financeAmountPanel);
    financeTab.addTab(resourceMap.getString("monthlyRevenueExpenditures.text"), financeMonthlyPanel);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(splitFinances, gridBagConstraints);

    JPanel panelFinanceRight = new JPanel(new BorderLayout());

    JPanel pnlFinanceBtns = new JPanel(new GridLayout(2, 2));
    btnAddFunds = new JButton("Add Funds (GM)");
    btnAddFunds.addActionListener(ev -> addFundsActionPerformed());
    btnAddFunds.setEnabled(getCampaign().isGM());
    pnlFinanceBtns.add(btnAddFunds);
    JButton btnGetLoan = new JButton("Get Loan");
    btnGetLoan.addActionListener(e -> showNewLoanDialog());
    pnlFinanceBtns.add(btnGetLoan);

    btnManageAssets = new JButton("Manage Assets (GM)");
    btnManageAssets.addActionListener(e -> manageAssets());
    btnManageAssets.setEnabled(getCampaign().isGM());
    pnlFinanceBtns.add(btnManageAssets);

    panelFinanceRight.add(pnlFinanceBtns, BorderLayout.NORTH);

    areaNetWorth = new JTextArea();
    areaNetWorth.setLineWrap(true);
    areaNetWorth.setWrapStyleWord(true);
    areaNetWorth.setFont(new Font("Courier New", Font.PLAIN, 12));
    areaNetWorth.setText(getCampaign().getFinancialReport());
    areaNetWorth.setEditable(false);

    JScrollPane descriptionScroll = new JScrollPane(areaNetWorth);
    panelFinanceRight.add(descriptionScroll, BorderLayout.CENTER);
    areaNetWorth.setCaretPosition(0);
    descriptionScroll.setMinimumSize(new Dimension(300, 200));

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 0.0;
    gridBagConstraints.weighty = 1.0;
    add(panelFinanceRight, gridBagConstraints);
}

From source file:com.ibm.issw.odc.gui.BPMArgumentsPanel.java

/**
 * Create a panel containing the add and delete buttons.
 *
 * @return a GUI panel containing the buttons
 *//* w ww .  ja v a 2 s.c om*/
private JPanel makeButtonPanel() {
    JButton showDetail = new JButton(JMeterUtils.getResString("detail")); // $NON-NLS-1$
    showDetail.setActionCommand(DETAIL);
    showDetail.setEnabled(true);

    add = new JButton(JMeterUtils.getResString("add")); // $NON-NLS-1$
    add.setActionCommand(ADD);
    add.setEnabled(true);
    /** A button for adding new arguments to the table from the clipboard. */
    JButton addFromClipboard = new JButton(JMeterUtils.getResString("add_from_clipboard")); // $NON-NLS-1$
    addFromClipboard.setActionCommand(ADD_FROM_CLIPBOARD);
    addFromClipboard.setEnabled(true);

    delete = new JButton(JMeterUtils.getResString("delete")); // $NON-NLS-1$
    delete.setActionCommand(DELETE);

    if (enableUpDown) {
        up = new JButton(JMeterUtils.getResString("up")); // $NON-NLS-1$
        up.setActionCommand(UP);

        down = new JButton(JMeterUtils.getResString("down")); // $NON-NLS-1$
        down.setActionCommand(DOWN);
    }
    checkDeleteStatus();

    JPanel buttonPanel = new JPanel();
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
    if (this.background != null) {
        buttonPanel.setBackground(this.background);
    }
    showDetail.addActionListener(this);
    add.addActionListener(this);
    addFromClipboard.addActionListener(this);
    delete.addActionListener(this);
    buttonPanel.add(showDetail);
    buttonPanel.add(add);
    buttonPanel.add(addFromClipboard);
    buttonPanel.add(delete);
    if (enableUpDown) {
        up.addActionListener(this);
        down.addActionListener(this);
        buttonPanel.add(up);
        buttonPanel.add(down);
    }
    return buttonPanel;
}

From source file:fedroot.dacs.swingdemo.DacsSingleFrameApplication.java

private JComponent createActionsPanel() {
    JButton clientCredentialsButton = new JButton(actionMap().get("clientCredentials"));
    JButton componentButton = new JButton(actionMap().get("blockComponent"));
    JButton applicationButton = new JButton(actionMap().get("blockApplication"));
    JButton windowButton = new JButton(actionMap().get("blockWindow"));

    JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 50));
    panel1.add(clientCredentialsButton);
    panel1.add(componentButton);/*from   w  ww .j  a  v a 2 s.c  om*/
    panel1.add(applicationButton);
    panel1.add(windowButton);

    JPanel panel2 = new JPanel(new BorderLayout());
    panel2.add(createGotoPanel(), BorderLayout.NORTH);
    panel2.add(new JSeparator(), BorderLayout.CENTER);
    panel2.add(panel1, BorderLayout.SOUTH);
    panel2.setBorder(new EmptyBorder(0, 2, 0, 2)); // top, left, bottom, right
    return panel2;
}

From source file:com.francetelecom.rd.dashboard.pc.DashboardPC.java

private void initDashboardWithRules() {
    // get existing rules and display them
    try {/*from w  w w.  java2s.  co m*/
        Rule[] ruleList = busConnector.getAllRules();
        for (int i = 0; i < ruleList.length; i++) {
            if (!ruleList[i].isPrivate())
                addRulePanelToDashboard(ruleList[i].getId());
        }
    } catch (HomeBusException e) {
        logger.error("Could not retrieve bus rules : " + e.getMessage());
        e.printStackTrace();
    }

    // small add rule panel init
    JPanel panelAddRule = new JPanel();
    panelAddRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelAddRule.setLayout(null);

    JLabel addRuleLbl = new JLabel("Configure new rule");
    addRuleLbl.setHorizontalAlignment(SwingConstants.CENTER);
    addRuleLbl.setForeground(new Color(169, 169, 169));
    addRuleLbl.setFont(new Font("Arial", Font.BOLD, 13));
    addRuleLbl.setBounds(10, 25, 229, 27);
    panelAddRule.add(addRuleLbl);

    JButton addRuleBtn = new JButton("+");
    addRuleBtn.setForeground(new Color(128, 128, 128));
    addRuleBtn.setBounds(100, 57, 41, 23);
    panelAddRule.add(addRuleBtn);

    rulesContent.add(panelAddRule);
    myRulePanelMap.put("0", panelAddRule);
    updateRuleListDisplay();

    // add panel elements : photo, service friendly name, IF label, condition parameter
    JPanel panelRule1 = new JPanel();
    panelRule1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelRule1.setLayout(null);

    JPanel rulePanelServicePhoto1 = new JPanel();
    rulePanelServicePhoto1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    rulePanelServicePhoto1.setBounds(10, 16, 27, 27);
    panelRule1.add(rulePanelServicePhoto1);

    String serviceName1 = "Visio TV";
    JLabel ruleLblServiceName1 = new JLabel(serviceName1);
    ruleLblServiceName1.setFont(new Font("Arial", Font.BOLD, 15));
    ruleLblServiceName1.setForeground(new Color(100, 149, 237));
    ruleLblServiceName1.setBounds(47, 11, 212, 18);
    panelRule1.add(ruleLblServiceName1);

    String serviceDeviceOwner1 = "Set-top Box";
    JLabel ruleLblOnDevice1 = new JLabel("on " + serviceDeviceOwner1);
    ruleLblOnDevice1.setForeground(Color.GRAY);
    ruleLblOnDevice1.setFont(new Font("Arial", Font.PLAIN, 11));
    ruleLblOnDevice1.setBounds(47, 29, 212, 14);
    panelRule1.add(ruleLblOnDevice1);

    JLabel ruleLblIf1 = new JLabel("IF");
    ruleLblIf1.setForeground(Color.GRAY);
    ruleLblIf1.setFont(new Font("Arial", Font.BOLD, 30));
    ruleLblIf1.setBounds(10, 49, 27, 35);
    panelRule1.add(ruleLblIf1);

    // condition 
    String condition1 = "IncomingVoIP" + " = " + "true";
    JLabel ruleLblConditionParam1 = new JLabel(condition1);
    ruleLblConditionParam1.setFont(new Font("Arial", Font.BOLD, 13));
    ruleLblConditionParam1.setForeground(Color.GRAY);
    ruleLblConditionParam1.setBounds(47, 49, 192, 35);
    panelRule1.add(ruleLblConditionParam1);

    myRulePanelMap.put("1", panelRule1);
    rulesContent.add(panelRule1);

    // add panel elements : photo, service friendly name, IF label, condition parameter
    JPanel panelRule2 = new JPanel();
    panelRule2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelRule2.setLayout(null);

    JPanel rulePanelServicePhoto2 = new JPanel();
    rulePanelServicePhoto2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    rulePanelServicePhoto2.setBounds(10, 16, 27, 27);
    panelRule2.add(rulePanelServicePhoto2);

    String serviceName2 = "Wi-Fi Off";
    JLabel ruleLblServiceName2 = new JLabel(serviceName2);
    ruleLblServiceName2.setFont(new Font("Arial", Font.BOLD, 15));
    ruleLblServiceName2.setForeground(new Color(100, 149, 237));
    ruleLblServiceName2.setBounds(47, 11, 212, 18);
    panelRule2.add(ruleLblServiceName2);

    String serviceDeviceOwner2 = "Livebox";
    JLabel ruleLblOnDevice2 = new JLabel("on " + serviceDeviceOwner2);
    ruleLblOnDevice2.setForeground(Color.GRAY);
    ruleLblOnDevice2.setFont(new Font("Arial", Font.PLAIN, 11));
    ruleLblOnDevice2.setBounds(47, 29, 212, 14);
    panelRule2.add(ruleLblOnDevice2);

    JLabel ruleLblIf2 = new JLabel("IF");
    ruleLblIf2.setForeground(Color.GRAY);
    ruleLblIf2.setFont(new Font("Arial", Font.BOLD, 30));
    ruleLblIf2.setBounds(10, 49, 27, 35);
    panelRule2.add(ruleLblIf2);

    // condition 
    String condition2 = "Absence" + " = " + "true";
    JLabel ruleLblConditionParam2 = new JLabel(condition2);
    ruleLblConditionParam2.setFont(new Font("Arial", Font.BOLD, 13));
    ruleLblConditionParam2.setForeground(Color.GRAY);
    ruleLblConditionParam2.setBounds(47, 49, 192, 35);
    panelRule2.add(ruleLblConditionParam2);

    myRulePanelMap.put("2", panelRule2);
    rulesContent.add(panelRule2);

    updateRuleListDisplay();

    busConnector.addRuleDefinitionsListener(this);
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.heatmap.HeatMapImgGenerator.java

private JPanel initCell(String color, int x, int y) {
    JPanel cell = new JPanel();
    cell.setSize(50, 50);// w  w w .  j av a2  s.  co m
    Color c;
    if (color.contains("#")) {
        c = Color.decode(color);
    } else if (color.toLowerCase().contains("rgb")) {
        String rgb = color.toLowerCase().replace("rgb", "").replace("(", "").replace(")", "").replace(" ", "");
        String[] stringRGBArr = rgb.split(",");
        c = new Color(Integer.valueOf(stringRGBArr[0]), Integer.valueOf(stringRGBArr[1]),
                Integer.valueOf(stringRGBArr[2]));
    } else {
        c = Color.RED;
    }

    cell.setBackground(c);
    cell.setOpaque(true);
    cell.setLocation(x, y);
    cell.setBorder(new LineBorder(Color.WHITE));
    return cell;

}

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

/**
 * Create a panel containing the proxy server details
 *
 * @return the panel//from ww w .  ja v  a 2s.  com
 */
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:net.sf.xmm.moviemanager.gui.DialogIMDB.java

private void createListDialog() {
    /* Dialog properties...*/

    setModal(true);/*from  w  w  w  .j  ava  2s .  co m*/
    setResizable(true);

    panelMoviesList = createMoviehitsList();
    JPanel searchPanel = createSearchStringPanel();
    JPanel panelButtons = createButtonsPanel();

    JPanel panelSearchAndButtons = new JPanel();
    panelSearchAndButtons.setLayout(new BorderLayout());
    panelSearchAndButtons.add(searchPanel, BorderLayout.NORTH);
    panelSearchAndButtons.add(panelButtons, BorderLayout.SOUTH);

    subclassButtons = new JPanel();

    JPanel sharedPanel = new JPanel();
    sharedPanel.setLayout(new BorderLayout());
    sharedPanel.add(panelSearchAndButtons, BorderLayout.NORTH);
    sharedPanel.add(subclassButtons, BorderLayout.SOUTH);

    /* To add outside border... */
    JPanel all = new JPanel();
    all.setLayout(new BorderLayout());
    all.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5), null));
    all.add(panelMoviesList, BorderLayout.CENTER);
    all.add(sharedPanel, BorderLayout.SOUTH);

    getContentPane().add(all, BorderLayout.CENTER);
    //getContentPane().add(sharedPanel,BorderLayout.SOUTH);

    getMoviesList().ensureIndexIsVisible(0);

    setPreferredSize(new Dimension(500, 440));
    setMinimumSize(new Dimension(500, 440));

    pack();

    setLocation(
            (int) MovieManager.getIt().getLocation().getX()
                    + (MovieManager.getIt().getWidth() - getWidth()) / 2,
            (int) MovieManager.getIt().getLocation().getY()
                    + (MovieManager.getIt().getHeight() - getHeight()) / 2);

}