Example usage for java.awt BorderLayout PAGE_END

List of usage examples for java.awt BorderLayout PAGE_END

Introduction

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

Prototype

String PAGE_END

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

Click Source Link

Document

The component comes after the last line of the layout's content.

Usage

From source file:eu.cassandra.csn.gui.CSN.java

/**
 * //from   www .j a  v  a  2 s  . co  m
 * @param graph
 * @return
 */
public static JPanel setUpView() {
    JPanel csnPanel = new JPanel();
    vv.getGraphLayout().setSize(new Dimension(csnPanel.getWidth(), csnPanel.getHeight()));
    setUpVV();
    GraphZoomScrollPane graphZoomScrollPane = new GraphZoomScrollPane(vv);
    JPanel thisPanel = new JPanel(new BorderLayout());
    thisPanel.add(graphZoomScrollPane, BorderLayout.CENTER);

    slider.setBackground(Color.WHITE);
    slider.setPreferredSize(new Dimension(210, 50));
    slider.setPaintTicks(true);
    slider.setMaximum(100);
    slider.setMinimum(0);
    slider.setValue(0);
    slider.setMajorTickSpacing(50);
    slider.setPaintLabels(true);
    slider.setPaintTicks(true);
    slider.setBorder(BorderFactory.createLineBorder(Color.black));
    slider.setEnabled(false);
    sliderLabel.setEnabled(false);
    slider.addMouseListener(new MouseListener() {
        @Override
        public void mouseReleased(MouseEvent e) {
            if (sliderLabel.getText().contains("oltage"))
                ClusterGraph.clusterAndRecolor(ClusterGraph.VoltageClusterer, slider.getValue());
            else if (sliderLabel.getText().contains("etweenness"))
                ClusterGraph.clusterAndRecolor(ClusterGraph.BetweennessClusterer, slider.getValue());
        }

        public void mouseClicked(MouseEvent arg0) {
        }

        public void mouseEntered(MouseEvent arg0) {
        }

        public void mouseExited(MouseEvent arg0) {
        }

        public void mousePressed(MouseEvent arg0) {
        }
    });
    JPanel p = new JPanel(new BorderLayout());
    p.add(sliderLabel, BorderLayout.PAGE_START);
    p.add(slider, BorderLayout.CENTER);

    sliderEdge.setBackground(Color.WHITE);
    sliderEdge.setPreferredSize(new Dimension(210, 50));
    sliderEdge.setPaintTicks(true);
    sliderEdge.setValue(0);
    sliderEdge.setMajorTickSpacing(5);
    sliderEdge.setPaintLabels(true);
    sliderEdge.setPaintTicks(true);
    sliderEdge.setBorder(BorderFactory.createLineBorder(Color.black));
    sliderEdge.setEnabled(false);
    sliderLabelEdge.setEnabled(false);
    sliderEdge.addMouseListener(new MouseListener() {
        @Override
        public void mouseReleased(MouseEvent e) {
            double v = Double
                    .parseDouble(((JLabel) sliderEdge.getLabelTable().get(sliderEdge.getValue())).getText());
            CSNGraph.addEdgesBasedOnKL(v);
        }

        public void mouseClicked(MouseEvent arg0) {
        }

        public void mouseEntered(MouseEvent arg0) {
        }

        public void mouseExited(MouseEvent arg0) {
        }

        public void mousePressed(MouseEvent arg0) {
        }
    });
    JPanel pEdge = new JPanel(new BorderLayout());
    pEdge.add(sliderLabelEdge, BorderLayout.PAGE_START);
    pEdge.add(sliderEdge, BorderLayout.CENTER);

    JPanel p2 = new JPanel(new BorderLayout());
    p2.add(pEdge, BorderLayout.PAGE_START);
    p2.add(p, BorderLayout.PAGE_END);

    thisPanel.add(p2, BorderLayout.PAGE_END);

    return thisPanel;
}

From source file:BasicDnD.java

public BasicDnD() {
    super(new BorderLayout());
    JPanel leftPanel = createVerticalBoxPanel();
    JPanel rightPanel = createVerticalBoxPanel();

    //Create a table model.
    DefaultTableModel tm = new DefaultTableModel();
    tm.addColumn("Column 0");
    tm.addColumn("Column 1");
    tm.addColumn("Column 2");
    tm.addColumn("Column 3");
    tm.addRow(new String[] { "Table 00", "Table 01", "Table 02", "Table 03" });
    tm.addRow(new String[] { "Table 10", "Table 11", "Table 12", "Table 13" });
    tm.addRow(new String[] { "Table 20", "Table 21", "Table 22", "Table 23" });
    tm.addRow(new String[] { "Table 30", "Table 31", "Table 32", "Table 33" });

    //LEFT COLUMN
    //Use the table model to create a table.
    table = new JTable(tm);
    leftPanel.add(createPanelForComponent(table, "JTable"));

    //Create a color chooser.
    colorChooser = new JColorChooser();
    leftPanel.add(createPanelForComponent(colorChooser, "JColorChooser"));

    //RIGHT COLUMN
    //Create a textfield.
    textField = new JTextField(30);
    textField.setText("Favorite foods:\nPizza, Moussaka, Pot roast");
    rightPanel.add(createPanelForComponent(textField, "JTextField"));

    //Create a scrolled text area.
    textArea = new JTextArea(5, 30);
    textArea.setText("Favorite shows:\nBuffy, Alias, Angel");
    JScrollPane scrollPane = new JScrollPane(textArea);
    rightPanel.add(createPanelForComponent(scrollPane, "JTextArea"));

    //Create a list model and a list.
    DefaultListModel listModel = new DefaultListModel();
    listModel.addElement("Martha Washington");
    listModel.addElement("Abigail Adams");
    listModel.addElement("Martha Randolph");
    listModel.addElement("Dolley Madison");
    listModel.addElement("Elizabeth Monroe");
    listModel.addElement("Louisa Adams");
    listModel.addElement("Emily Donelson");
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    JScrollPane listView = new JScrollPane(list);
    listView.setPreferredSize(new Dimension(300, 100));
    rightPanel.add(createPanelForComponent(listView, "JList"));

    //Create a tree.
    DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Mia Familia");
    DefaultMutableTreeNode sharon = new DefaultMutableTreeNode("Sharon");
    rootNode.add(sharon);//www  . j  a  v  a2s  .  c o m
    DefaultMutableTreeNode maya = new DefaultMutableTreeNode("Maya");
    sharon.add(maya);
    DefaultMutableTreeNode anya = new DefaultMutableTreeNode("Anya");
    sharon.add(anya);
    sharon.add(new DefaultMutableTreeNode("Bongo"));
    maya.add(new DefaultMutableTreeNode("Muffin"));
    anya.add(new DefaultMutableTreeNode("Winky"));
    DefaultTreeModel model = new DefaultTreeModel(rootNode);
    tree = new JTree(model);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    JScrollPane treeView = new JScrollPane(tree);
    treeView.setPreferredSize(new Dimension(300, 100));
    rightPanel.add(createPanelForComponent(treeView, "JTree"));

    //Create the toggle button.
    toggleDnD = new JCheckBox("Turn on Drag and Drop");
    toggleDnD.setActionCommand("toggleDnD");
    toggleDnD.addActionListener(this);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
    splitPane.setOneTouchExpandable(true);

    add(splitPane, BorderLayout.CENTER);
    add(toggleDnD, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
}

From source file:com.raphfrk.craftproxyclient.gui.CraftProxyGUI.java

public CraftProxyGUI(String buildId) {

    pf = new PropertiesFile("CraftProxyClientGUI.txt");

    try {/*from www  . java2 s .c om*/
        pf.load();
    } catch (IOException e) {
        JOptionPane.showMessageDialog(CraftProxyGUI.this, "Unable to open settings file");
    }

    String defaultHostname = pf.getString("connect_hostname", "");
    int defaultPort = pf.getInt("connect_port", 20000);
    int listenPort = pf.getInt("listen_port", 25565);
    int desired = pf.getInt("cache_size", 48);

    try {
        pf.save();
    } catch (IOException e) {
        JOptionPane.showMessageDialog(CraftProxyGUI.this, "Unable to save settings file");
    }

    setTitle("CraftProxyClient Local (" + buildId + ")");
    setSize(500, 375);
    setLocation(40, 150);

    topPanel.setLayout(new BorderLayout());
    topPanel.setBorder(new TitledBorder("Remote Server"));
    topPanel.setBackground(Color.WHITE);
    secondPanel.setLayout(new BorderLayout());
    secondPanel.setBorder(new TitledBorder("Local Server"));
    secondPanel.setBackground(Color.WHITE);

    serverName = new JTextField(defaultHostname, 20);
    TitledBorder border = new TitledBorder("Name");
    serverName.setBorder(border);
    serverName.addActionListener(this);

    portNum = new JTextField(Integer.toString(defaultPort), 6);
    border = new TitledBorder("Port");
    portNum.setBorder(border);
    portNum.addActionListener(this);

    localServerName = new JLabel("localhost");
    localServerName.setBackground(Color.GRAY);
    border = new TitledBorder("Name");
    localServerName.setBorder(border);

    localServerPortnum = new JTextField(Integer.toString(listenPort), 6);
    border = new TitledBorder("Port");
    localServerPortnum.setBorder(border);
    localServerPortnum.addActionListener(this);

    topPanel.add(serverName, BorderLayout.CENTER);
    topPanel.add(portNum, BorderLayout.LINE_END);

    secondPanel.setLayout(new BorderLayout());
    secondPanel.add(localServerName, BorderLayout.CENTER);
    secondPanel.add(localServerPortnum, BorderLayout.LINE_END);

    combinedTop.setLayout(new BorderLayout());
    combinedTop.add(topPanel, BorderLayout.CENTER);
    combinedTop.add(secondPanel, BorderLayout.SOUTH);

    currentSize = new JTextField("Unknown");
    currentSize.setBorder(new TitledBorder("Current Size (MB)"));
    currentSize.setEditable(false);

    desiredSize = new JTextField(Integer.toString(desired));
    desiredSize.setBorder(new TitledBorder("Max Size (MB)"));

    connect = new JButton(buttonText);
    connect.addActionListener(this);

    filePanel = new JPanel();
    filePanel.setLayout(new BorderLayout());
    JPanel fileLinePanel = new JPanel();
    fileLinePanel.setBorder(new TitledBorder("Cache Size"));
    fileLinePanel.setLayout(new GridLayout(1, 3));
    fileLinePanel.add(currentSize);
    fileLinePanel.add(desiredSize);
    filePanel.add(fileLinePanel, BorderLayout.CENTER);
    filePanel.add(connect, BorderLayout.PAGE_END);

    info = new JLabel();
    border = new TitledBorder("Status");
    info.setBorder(border);

    setLayout(new BorderLayout());
    add(combinedTop, BorderLayout.PAGE_START);
    add(info, BorderLayout.CENTER);
    add(filePanel, BorderLayout.PAGE_END);

    this.setResizable(false);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    this.addWindowListener(this);

}

From source file:org.webcat.plugintester.ui.MainFrameBuilder.java

/**
 * Creates and lays out the Swing components for the window.
 *
 * @param frame the JFrame instance that will contain the components
 *//*w  ww  .  jav  a 2s.c o m*/
private void constructFrame(JFrame frame) {
    GridBagConstraints gridBagConstraints;

    fileChooser = new JFileChooser();
    bottomPanel = new JPanel();
    runButton = new JButton();
    mainPanel = new JPanel();
    JLabel webCatHomeLabel = new JLabel();
    webCatHomeField = new JTextField();
    webCatHomeBrowseButton = new JButton();
    JSeparator jSeparator0 = new JSeparator();
    JLabel submissionLabel = new JLabel();
    submissionField = new JTextField();
    submissionBrowseButton = new JButton();
    JSeparator jSeparator1 = new JSeparator();
    JLabel pluginsLabel = new JLabel();
    JPanel pluginsPanel = new JPanel();
    JScrollPane pluginsScrollPane = new JScrollPane();
    pluginsTable = new JTable();
    pluginAddButton = new JButton();
    pluginRemoveButton = new JButton();
    JSeparator jSeparator2 = new JSeparator();
    JTabbedPane tabPane = new JTabbedPane();
    propertiesPanel = new JPanel();
    JScrollPane propertiesScrollPane = new JScrollPane();
    propertiesEditor = new JEditorPane();
    documentationPanel = new JPanel();
    JScrollPane documentationScrollPane = new JScrollPane();
    documentationEditor = new JEditorPane();

    // File chooser
    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    // Bottom panel
    bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));

    // Run button
    runButton.setText("Run Plug-ins");
    runButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            runButtonActionPerformed(evt);
        }
    });
    bottomPanel.add(runButton);

    frame.getContentPane().add(bottomPanel, BorderLayout.PAGE_END);

    // Main panel
    mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    mainPanel.setLayout(new GridBagLayout());

    // Web-CAT Home field
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = GridBagConstraints.RELATIVE;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    webCatHomeLabel.setText("Web-CAT Home:");
    mainPanel.add(webCatHomeLabel, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    webCatHomeField.setTransferHandler(new WebCATHomeTransferHandler());
    mainPanel.add(webCatHomeField, gridBagConstraints);

    // Web-CAT Home browse button
    webCatHomeBrowseButton.setText("Browse...");
    webCatHomeBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            webCatHomeBrowseButtonActionPerformed(evt);
        }
    });
    mainPanel.add(webCatHomeBrowseButton, new GridBagConstraints());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator0, gridBagConstraints);

    // Submission field
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = GridBagConstraints.RELATIVE;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    submissionLabel.setText("Submission:");
    mainPanel.add(submissionLabel, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    submissionField.setTransferHandler(new SubmissionTransferHandler());
    mainPanel.add(submissionField, gridBagConstraints);

    // Submission browse button
    submissionBrowseButton.setText("Browse...");
    submissionBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            submissionBrowseButtonActionPerformed(evt);
        }
    });
    mainPanel.add(submissionBrowseButton, new GridBagConstraints());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator1, gridBagConstraints);

    // Plug-ins area
    pluginsLabel.setText("Plug-ins to run:");
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(pluginsLabel, gridBagConstraints);

    pluginsPanel.setPreferredSize(new Dimension(400, 80));
    pluginsPanel.setLayout(new GridBagLayout());

    pluginsModel = new PluginsTableModel();
    pluginsTable.setModel(pluginsModel);
    pluginsTable.setColumnSelectionAllowed(true);
    pluginsTable.getTableHeader().setReorderingAllowed(false);
    pluginsScrollPane.setViewportView(pluginsTable);
    pluginsTable.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    pluginsTable.getColumnModel().getColumn(0).setResizable(false);
    pluginsScrollPane.setTransferHandler(new PluginsTransferHandler());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pluginsPanel.add(pluginsScrollPane, gridBagConstraints);

    pluginAddButton.setText("Add...");
    pluginAddButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            pluginAddButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = GridBagConstraints.PAGE_START;
    pluginsPanel.add(pluginAddButton, gridBagConstraints);

    pluginRemoveButton.setText("Remove");

    pluginRemoveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            pluginRemoveButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = GridBagConstraints.PAGE_START;
    pluginsPanel.add(pluginRemoveButton, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 0.25;
    mainPanel.add(pluginsPanel, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator2, gridBagConstraints);

    tabPane.setPreferredSize(new Dimension(466, 150));

    propertiesPanel.setLayout(new GridBagLayout());

    propertiesEditor.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent e) {
            propertiesTimer.restart();
        }
    });

    propertiesTimer = new Timer(1000, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateGradingProperties();
        }
    });

    propertiesScrollPane.setViewportView(propertiesEditor);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    propertiesPanel.add(propertiesScrollPane, gridBagConstraints);

    tabPane.addTab("Properties", propertiesPanel);

    documentationPanel.setLayout(new GridBagLayout());

    documentationEditor.setContentType("text/html");
    documentationEditor.setEditable(false);
    documentationScrollPane.setViewportView(documentationEditor);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    documentationPanel.add(documentationScrollPane, gridBagConstraints);

    tabPane.addTab("Documentation", documentationPanel);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.gridheight = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 1.0;
    mainPanel.add(tabPane, gridBagConstraints);

    frame.getContentPane().add(mainPanel, BorderLayout.CENTER);

    frame.pack();
}

From source file:mrmc.chart.ROCCurvePlot.java

/**
 * Sole constructor. Creates a line plot display ROC curves
 * /*from   w w  w.j  ava 2  s  . co  m*/
 * @param title Title of the chart
 * @param xaxis x-axis label
 * @param yaxis y-axis label
 * @param treeMap Mapping of readers to a set of points defining an ROC curve
 */
public ROCCurvePlot(final String title, String xaxis, String yaxis, TreeMap<String, TreeSet<XYPair>> treeMap) {
    super(title);

    createDataset(treeMap);
    final JFreeChart chart = ChartFactory.createScatterPlot(title, xaxis, yaxis, seriesCollection,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) chart.getPlot();
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    NumberAxis domain = (NumberAxis) xyplot.getDomainAxis();
    domain.setRange(0.00, 1.00);
    domain.setTickUnit(new NumberTickUnit(0.1));
    NumberAxis range = (NumberAxis) xyplot.getRangeAxis();
    range.setRange(0.00, 1.00);
    range.setTickUnit(new NumberTickUnit(0.1));
    renderer = new XYLineAndShapeRenderer();
    chart.getXYPlot().setRenderer(renderer);
    ChartPanel chartPanel = new ChartPanel(chart);

    JPanel readerSelect = new JPanel(new WrapLayout());
    readerSeriesBoxes = new ArrayList<JCheckBox>();

    for (String r : treeMap.keySet()) {
        JCheckBox aBox = new JCheckBox("" + r);
        aBox.setSelected(false);
        aBox.addItemListener(new SeriesSelectListener());
        hideSeries("" + r);
        readerSeriesBoxes.add(aBox);
        readerSelect.add(aBox);
    }

    renderer.setSeriesShapesVisible(seriesCollection.getSeriesIndex("Vertical Average"), false);
    renderer.setSeriesStroke(seriesCollection.getSeriesIndex("Vertical Average"), new java.awt.BasicStroke(3f));
    renderer.setSeriesShapesVisible(seriesCollection.getSeriesIndex("Horizontal Average"), false);
    renderer.setSeriesStroke(seriesCollection.getSeriesIndex("Horizontal Average"),
            new java.awt.BasicStroke(3f));
    renderer.setSeriesShapesVisible(seriesCollection.getSeriesIndex("Diagonal Average"), false);
    renderer.setSeriesStroke(seriesCollection.getSeriesIndex("Diagonal Average"), new java.awt.BasicStroke(3f));
    renderer.setSeriesStroke(seriesCollection.getSeriesIndex("Pooled Average"), new java.awt.BasicStroke(3f));

    vert = new JCheckBox("Vertical Average");
    vert.setSelected(true);
    vert.addItemListener(new SeriesSelectListener());
    readerSelect.add(vert);
    horiz = new JCheckBox("Horizontal Average");
    horiz.setSelected(true);
    horiz.addItemListener(new SeriesSelectListener());
    readerSelect.add(horiz);
    diag = new JCheckBox("Diagonal Average");
    diag.setSelected(true);
    diag.addItemListener(new SeriesSelectListener());
    readerSelect.add(diag);
    pooled = new JCheckBox("Pooled Average");
    pooled.setSelected(true);
    pooled.addItemListener(new SeriesSelectListener());
    readerSelect.add(pooled);

    JCheckBox allReaders = new JCheckBox("Show Readers");
    allReaders.setSelected(false);
    allReaders.addItemListener(new ReadersSelectListener());
    readerSelect.add(allReaders);
    JCheckBox allAverages = new JCheckBox("Show Averages");
    allAverages.setSelected(true);
    allAverages.addItemListener(new AverageSelectListener());
    readerSelect.add(allAverages);

    chartPanel.setPreferredSize(new java.awt.Dimension(700, 700));
    this.add(chartPanel);
    this.add(readerSelect, BorderLayout.PAGE_END);

}

From source file:fi.elfcloud.client.dialog.ModifyDataItemDialog.java

public ModifyDataItemDialog(JFrame parent, HashMap<String, String> metaMap, String diName) {
    super(parent, true);
    setTitle(Messages.getString("ModifyDataItemDialog.window_title") + diName); //$NON-NLS-1$
    this.metamap = metaMap;
    tagVector = new Vector<String>();
    setLocationRelativeTo(parent);/*from w w  w. j av a  2  s. com*/
    panel.setLayout(new GridBagLayout());
    GridBagConstraints cs = new GridBagConstraints();
    cs.insets = new Insets(0, 0, 5, 0);

    lblName = new JLabel(Messages.getString("ModifyDataItemDialog.label_name")); //$NON-NLS-1$
    cs.gridx = 0;
    cs.gridy = 0;
    cs.fill = GridBagConstraints.HORIZONTAL;
    cs.gridwidth = 1;
    cs.weightx = 0;
    panel.add(lblName, cs);

    name = new JTextField(getWidth());
    cs.gridx = GridBagConstraints.RELATIVE;
    cs.gridy = 0;
    cs.fill = GridBagConstraints.HORIZONTAL;
    cs.gridwidth = 2;
    cs.weightx = 1.0;
    name.setText(diName);
    panel.add(name, cs);

    lblDescription = new JLabel(Messages.getString("ModifyDataItemDialog.label_description")); //$NON-NLS-1$
    cs.gridx = 0;
    cs.gridy = 1;
    cs.gridwidth = 1;
    cs.fill = GridBagConstraints.HORIZONTAL;
    cs.weightx = 0;
    panel.add(lblDescription, cs);

    description = new JTextField(getWidth());
    cs.gridx = GridBagConstraints.RELATIVE;
    cs.gridy = 1;
    cs.gridwidth = 2;
    cs.fill = GridBagConstraints.HORIZONTAL;
    cs.weightx = 1.0;
    description.setText(metaMap.get("DSC")); //$NON-NLS-1$
    panel.add(description, cs);

    lblTags = new JLabel(Messages.getString("ModifyDataItemDialog.label_tags")); //$NON-NLS-1$
    cs.gridx = 0;
    cs.gridy = 2;
    cs.gridwidth = 1;
    cs.fill = GridBagConstraints.HORIZONTAL;
    cs.weightx = 0;
    panel.add(lblTags, cs);

    tags = new JTextField(getWidth());
    cs.gridx = GridBagConstraints.RELATIVE;
    cs.gridy = 2;
    cs.fill = GridBagConstraints.HORIZONTAL;
    cs.weightx = 1.0;
    panel.add(tags, cs);

    JButton addButton = new JButton(Messages.getString("ModifyDataItemDialog.button_add_tag")); //$NON-NLS-1$
    cs.gridx = GridBagConstraints.RELATIVE;
    cs.gridy = 2;
    cs.gridwidth = 1;
    cs.weightx = 0;
    addButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String tagText = tags.getText().trim();
            if (!tagText.equals("")) { //$NON-NLS-1$
                addTags(tagText);
            }
            tags.setText(""); //$NON-NLS-1$

            checkboxPanel.revalidate();
            checkboxPanel.repaint();
        }
    });
    panel.add(addButton, cs);

    checkboxPanel = new JPanel(new WrapLayout(FlowLayout.LEFT));
    checkboxPanel.setSize(new Dimension(320, 1));
    try {
        addTags(metamap.get("TGS")); //$NON-NLS-1$
    } catch (NullPointerException e) {
        // No existing tags
    }
    panel.setBorder(new EmptyBorder(5, 5, 0, 5));
    getContentPane().add(panel, BorderLayout.NORTH);
    scrollPane = new JScrollPane(checkboxPanel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setBorder(null);
    getContentPane().add(scrollPane, BorderLayout.CENTER);

    JButton generateButton = new JButton(Messages.getString("ModifyDataItemDialog.button_save")); //$NON-NLS-1$
    generateButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (tags.getText().length() > 0) {
                addTags(tags.getText());
            }
            answer = true;
            setVisible(false);
        }
    });
    JButton cancelButton = new JButton(Messages.getString("ModifyDataItemDialog.button_cancel")); //$NON-NLS-1$
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            answer = false;
            setVisible(false);
        }
    });
    JPanel bp = new JPanel();
    bp.add(generateButton);
    bp.add(cancelButton);
    getContentPane().add(bp, BorderLayout.PAGE_END);

    setMinimumSize(new Dimension(320, 350));
    pack();
}

From source file:eu.cassandra.csn.gui.Stats.java

/**
 * //from  w ww  .  ja  v a 2 s.c o  m
 * @param frame
 */
public static JPanel setNetworkStats(JFrame frame) {
    String[][] data = new String[][] { { "Virtual Days:", "" }, { "Number of nodes:", "" },
            { "Number of edges:", "" }, { "Graph diameter:", "" }, { "Vertex Betweenness Centrality:", "" },
            { "Edge Betweenness Centrality:", "" }, { "Total consumption:", "" },
            { "Average consumption:", "" }, { "Peak consumption:", "" }, { "Unconnected vertices:", "" },
            { "Clusters:", "" } };
    String[] columnName = new String[] { "Metric", "Value" };

    tableModel = new MyDefaultTableModel(data, columnName);
    JTable table = new JTable(tableModel);
    JScrollPane scrollPane = new JScrollPane(table);
    table.setFillsViewportHeight(true);

    String[][] dataSelected = new String[5][];
    String[] columnNameSelected = new String[] { "Name", "Type", "Total Consumption", "Peak Comsumption",
            "Avg Consumption" };
    tableModelSelected = new MyDefaultTableModel(dataSelected, columnNameSelected);
    JTable tableSelected = new JTable(tableModelSelected);
    JScrollPane scrollPaneSelected = new JScrollPane(tableSelected);
    tableSelected.setFillsViewportHeight(true);
    tableSelected.setPreferredSize(new Dimension(1600, 100));
    scrollPaneSelected.setPreferredSize(new Dimension(1600, 100));

    JPanel statsPanel = new JPanel(new BorderLayout());
    statsPanel.add(scrollPane, BorderLayout.CENTER);
    chartPanel = Charts.createGraph("Power Consumption", "Hours", "Power (W)", new Double[0]);

    statsPanel.add(chartPanel, BorderLayout.PAGE_END);

    //frame.add(statsPanel,BorderLayout.EAST);
    frame.add(scrollPaneSelected, BorderLayout.PAGE_END);
    return statsPanel;
}

From source file:org.pdfsam.guiclient.gui.frames.JMainFrame.java

/**
 * initialization//from  www  .j a v  a  2  s .  c o  m
 */
private void initialize() {
    try {
        // center(this,800,600);
        URL iconUrl = this.getClass().getResource("/images/pdf_" + GuiClient.getVersionType() + ".png");
        URL iconUrl16 = this.getClass().getResource("/images/pdf_" + GuiClient.getVersionType() + "16.png");
        if (iconUrl == null) {
            iconUrl = this.getClass().getResource(DEFAULT_ICON);
        }
        if (iconUrl16 == null) {
            iconUrl16 = this.getClass().getResource(DEFAULT_ICON_16);
        }
        setIconImage(new ImageIcon(iconUrl).getImage());
        setTitle(GuiClient.getApplicationName() + " Ver. " + GuiClient.getVersion());

        // load plugins
        setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
                "Loading plugins.."));
        PlugInsLoader pluginsLoader = new PlugInsLoader(Configuration.getInstance().getPluginAbsolutePath());
        pluginsMap = pluginsLoader.loadPlugins();

        // Info panel
        JInfoPanel infoPanel = new JInfoPanel(pluginsMap);
        PluginDataModel infoDataModel = new PluginDataModel(infoPanel.getPluginName(), infoPanel.getVersion(),
                infoPanel.getPluginAuthor(), infoPanel.getClass().getName());
        mainPanel.add(infoPanel, infoPanel.getPluginName());

        // Settings panel
        JSettingsPanel settingsPanel = new JSettingsPanel();
        PluginDataModel settingsDataModel = new PluginDataModel(settingsPanel.getPluginName(),
                settingsPanel.getVersion(), settingsPanel.getPluginAuthor(),
                settingsPanel.getClass().getName());
        mainPanel.add(settingsPanel, settingsPanel.getPluginName());

        // sets main panel
        mainPanel.setPreferredSize(new Dimension(670, 500));
        for (AbstractPlugablePanel instance : pluginsMap.values()) {
            mainPanel.add(instance, instance.getPluginName());
        }

        // status panel
        setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
                "Building status bar.."));
        statusPanel = new JStatusPanel(new ImageIcon(iconUrl16), GuiClient.getApplicationName(),
                WorkDoneDataModel.MAX_PERGENTAGE);
        getContentPane().add(statusPanel, BorderLayout.PAGE_END);
        Configuration.getInstance().getConsoleServicesFacade().addExecutionObserver(statusPanel);

        // tree panel
        setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
                "Building tree.."));
        treePanel = new JTreePanel(
                new DefaultMutableTreeNode(GuiClient.UNIXNAME + " " + GuiClient.getVersion()));
        for (PluginDataModel item : pluginsMap.keySet()) {
            treePanel.addToPlugsNode(item);
        }
        treePanel.addToRootNode(settingsDataModel);
        treePanel.addToRootNode(infoDataModel);
        treePanel.getTree().addTreeSelectionListener(new TreeMediator(this));
        treePanel.expand();

        // add info and settings to plugins map
        pluginsMap.put(settingsDataModel, settingsPanel);
        pluginsMap.put(infoDataModel, infoPanel);

        // menu
        setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
                "Building menus.."));

        environment = new Environment(pluginsMap, treePanel);
        SaveEnvironmentAction saveAction = new SaveEnvironmentAction(environment, this);
        LoadEnvironmentAction loadAction = new LoadEnvironmentAction(environment, this);
        ApplicationExitMediator exitMediator = new ApplicationExitMediator(new ApplicationCloser(this));
        menuBar = new JMainMenuBar(saveAction, loadAction, exitMediator);
        getRootPane().setJMenuBar(menuBar);
        environment.addObserver(new EnvironmentLoadObserver());

        // buttons bar
        setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
                "Building buttons bar.."));
        buttonsPanel = new JButtonsPanel(saveAction, loadAction, exitMediator, new LogActionListener());
        getContentPane().add(buttonsPanel, BorderLayout.PAGE_START);

        initializeUpdateChecker(settingsPanel);

        // final set up
        mainScrollPanel = new JScrollPane(mainPanel);
        mainScrollPanel.setMinimumSize(new Dimension(100, 400));

        logPanel = new JLogPanel();

        horizSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treePanel, mainScrollPanel);
        horizSplitPane.setOneTouchExpandable(true);
        horizSplitPane.setDividerLocation(155);

        verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, horizSplitPane, logPanel);
        verticalSplitPane.setOneTouchExpandable(true);
        verticalSplitPane.setResizeWeight(1.0);
        verticalSplitPane.setDividerLocation(0.75);

        // load the default env if set
        String defaultEnvString = Configuration.getInstance().getDefaultEnvironment();
        if (defaultEnvString != null && defaultEnvString.length() > 0) {
            File defaultEnv = new File(defaultEnvString);
            if (defaultEnv != null && defaultEnv.exists() && defaultEnv.isFile()) {
                log.info(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
                        "Loading default environment."));
                environment.loadJobs(defaultEnv);
            }
        }
        getContentPane().add(verticalSplitPane, BorderLayout.CENTER);

        setSize(640, 480);
        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        addWindowListener(new MainWindowListener(this));

    } catch (Exception e) {
        log.fatal(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
                "Error starting pdfsam."), e);
    }

}

From source file:com.xtructure.xevolution.gui.XEvolutionGui.java

/**
 * Creates a new {@link XEvolutionGui}./*from www. j ava  2  s  .co m*/
 * 
 * @param title
 *            the base string for the title of the gui
 * @param visualizeData
 *            the visualize data
 * @param dataTracker
 *            the data tracker
 */
public XEvolutionGui(String title, VisualizeData visualizeData, DataTracker<?, ?> dataTracker) {
    this.title = title;
    frame = new JFrame(title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    populationFiles = new ArrayList<File>();
    menuBar = new MenuBar(this, frame, title);
    frame.setJMenuBar(menuBar);
    tabbedPane = new JTabbedPane();
    tabbedPane.setPreferredSize(new Dimension(600, 400));
    frame.getContentPane().add(tabbedPane);
    statusBar = new StatusBar();
    frame.add(statusBar, BorderLayout.PAGE_END);
    graphPanel = new JPanel();
    graphPanel.setLayout(new GridLayout(0, 1));
    bufferSize = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
    bufferCount = 3; // max,avg,min
    graphsMap = new HashMap<XValId<?>, Graph>();
    tabbedPane.addTab("Graphs", graphPanel);
    generationsPanel = new JPanel();
    generationsPanel.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0.5;
    c.weighty = 0.5;
    populationPanel = new PopulationPanel(popLock);
    genomePanel = new GenomePanel();
    genomePanel.addSortByAttributeId(Genome.FITNESS_ATTRIBUTE_ID);
    genomePanel.addSortByAttributeId(Genome.COMPLEXITY_ATTRIBUTE_ID);
    genomePanel.getSortComboBox().setSelectedItem(Genome.FITNESS_ATTRIBUTE_ID);
    c.gridx = 0;
    c.gridy = 0;
    generationsPanel.add(populationPanel, c);
    c.gridx = 1;
    c.gridy = 0;
    generationsPanel.add(genomePanel, c);
    tabbedPane.addTab("Generations", generationsPanel);
    genealogyPanel = new GenealogyPanel(dataTracker);
    tabbedPane.addTab("Genealogy", genealogyPanel);
    addGraph(Genome.FITNESS_ATTRIBUTE_ID);
    addGraph(Genome.COMPLEXITY_ATTRIBUTE_ID);
    this.dataTracker = dataTracker;
    new GuiListener(populationPanel, genomePanel, genealogyPanel, visualizeData, dataTracker);
    frame.setResizable(true);
    frame.pack();
    frame.setVisible(true);
    catchUp();
}

From source file:com.eviware.soapui.impl.wsdl.panels.mock.WsdlMockServiceDesktopPanel.java

private void buildUI() {
    add(buildToolbar(), BorderLayout.NORTH);

    contentInspector = JInspectorPanelFactory.build(buildContent());
    contentInspector.setDefaultDividerLocation(0.5F);
    contentInspector.addInspector(new JComponentInspector<JComponent>(buildLog(), "Message Log",
            "A log of processed requests and their responses", true));

    contentInspector.setCurrentInspector("Message Log");

    add(contentInspector.getComponent(), BorderLayout.CENTER);
    add(new JLabel("--"), BorderLayout.PAGE_END);
}