Example usage for java.awt BorderLayout BorderLayout

List of usage examples for java.awt BorderLayout BorderLayout

Introduction

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

Prototype

public BorderLayout() 

Source Link

Document

Constructs a new border layout with no gaps between components.

Usage

From source file:de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.TypeStatisticsPanel.java

public TypeStatisticsPanel() {
    setName("EinsatzTyp");

    setLayout(new BorderLayout());

    DefaultPieDataset dataset = new DefaultPieDataset();

    HashMap<String, Integer> alarmCount = new HashMap<>();

    try {/*from w  w  w  .j a v a  2s.  com*/
        ResultSet resultSet = Starter.getDatabase().getStatement()
                .executeQuery("SELECT TYPE, COUNT(*) AS COUNT FROM ALARMHISTORY GROUP BY TYPE");

        while (resultSet.next()) {
            String type = resultSet.getString("TYPE");
            if (type.isEmpty())
                type = "unbekannt";

            int count = resultSet.getInt("COUNT");
            type += " (" + count + ")";

            alarmCount.put(type, count);
        }

    } catch (SQLException e) {
        e.printStackTrace();
    }

    for (String key : alarmCount.keySet()) {
        dataset.setValue(key, alarmCount.get(key));
    }

    JFreeChart chart = ChartFactory.createPieChart3D("Einsatztypen", dataset, false, false, false);

    chart.setBackgroundPaint(getBackground());

    ChartPanel panel = new ChartPanel(chart);

    panel.setPopupMenu(null);
    panel.setBackground(getBackground());

    add(panel, BorderLayout.CENTER);

}

From source file:teambootje.A2.java

public A2() {
    initComponents();//ww  w  .  ja va 2s.  c  o m
    setLocationRelativeTo(null);
    setLayout(new BorderLayout());

    //Create and set up the window.
    setTitle("SS Rotterdam Analyse || Analyse 2");
    ImageIcon icon = new ImageIcon("img/bootje.jpg");
    setIconImage(icon.getImage());

    // back BTN
    JButton back = new JButton("Back");
    add(back, BorderLayout.NORTH);

    back.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    });

    // panel en Label
    JPanel ana = new JPanel();
    add(ana, BorderLayout.CENTER);

    //tabel
    String sql = "SELECT Datum, COUNT(*) AS Aantal FROM posts GROUP BY Datum";
    List<Object[]> list = new ArrayList<Object[]>();
    ResultSet rs = null;
    try {
        rs = db.runSql(sql);
        while (rs.next()) {
            String datum = rs.getString("Datum");
            int aantal = rs.getInt("Aantal");
            String[] row = new String[rs.getMetaData().getColumnCount()];
            for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
                row[i - 1] = rs.getString(i);
            }
            list.add(row);
            //chart
            JButton chart = new JButton("Chart");
            add(chart, BorderLayout.SOUTH);

            chart.addActionListener(new ActionListener() {
                String dat = datum;
                int a1 = aantal;

                @Override
                public void actionPerformed(ActionEvent e) {

                    DefaultPieDataset pieDataset = new DefaultPieDataset();
                    pieDataset.setValue(dat, a1);
                    pieDataset.setValue("2015-04-06", new Integer(5));
                    pieDataset.setValue("2015-04-05", new Integer(5));
                    pieDataset.setValue("2015-04-04", new Integer(14));
                    pieDataset.setValue("2015-04-03", new Integer(4));
                    pieDataset.setValue("2015-04-02", new Integer(1));
                    pieDataset.setValue("2015-04-01", new Integer(32));
                    pieDataset.setValue("2015-03-31", new Integer(32));
                    pieDataset.setValue("2015-03-30", new Integer(9));
                    pieDataset.setValue("2015-03-29", new Integer(4));
                    pieDataset.setValue("2015-03-28", new Integer(1));
                    pieDataset.setValue("2015-03-27", new Integer(3));
                    pieDataset.setValue("2015-03-26", new Integer(6));
                    pieDataset.setValue("2015-03-25", new Integer(1));
                    pieDataset.setValue("2015-03-24", new Integer(1));
                    pieDataset.setValue("2015-03-23", new Integer(1));
                    pieDataset.setValue("2015-03-22", new Integer(1));
                    pieDataset.setValue("2015-03-21", new Integer(1));
                    pieDataset.setValue("2015-03-20", new Integer(1));
                    pieDataset.setValue("2015-03-19", new Integer(1));
                    pieDataset.setValue("2015-03-18", new Integer(2));
                    pieDataset.setValue("2015-03-17", new Integer(1));
                    JFreeChart chart = ChartFactory.createPieChart3D("Aantal Posts per datum", pieDataset, true,
                            true, true);
                    PiePlot3D p = (PiePlot3D) chart.getPlot();
                    //p.setForegroundAlpha(TOP_ALIGNMENT);
                    ChartFrame pie = new ChartFrame("Aantal Posts per datum", chart);
                    pie.setVisible(true);
                    pie.setSize(500, 500);
                    pie.setLocationRelativeTo(null);

                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
            });

        }
    } catch (SQLException e) {
        JOptionPane.showMessageDialog(null, e);
    }

    Object[][] array = new Object[list.size()][];
    Object columnNames[] = { "Datum", "Aantal" };
    list.toArray(array);

    JTable table = new JTable(array, columnNames);
    JScrollPane scroll = new JScrollPane(table);
    scroll.setPreferredSize(new Dimension(400, 400));
    ana.add(scroll);

}

From source file:com.jtk.pengelolaanujian.view.dashboard.PiePanelVnv.java

public void preparation() {
    uploaded = 0;//from   www . j  av a2s  .c om
    unuploaded = 0;
    triggerDashboardController = new TriggerDashboardController();

    panel = createChart(createData());
    panel.setPreferredSize(new Dimension(250, 250));

    setLayout(new BorderLayout());
    add(panel, BorderLayout.CENTER);
}

From source file:pwm.visualizer.MDPPolicyPanel.java

public MDPPolicyPanel() {
    super();//from w ww  . j a v  a 2s. com
    JFreeChart jfreechart = createChart();
    this.setLayout(new BorderLayout());
    this.add(new ChartPanel(jfreechart), BorderLayout.CENTER);
    setPreferredSize(new Dimension(500, 500));
    this.revalidate();

}

From source file:com.jtk.pengelolaanujian.view.dashboard.PiePanelNilai.java

public void preparation() {
    uploaded = 0;/* w  w  w. j a v  a 2s .com*/
    unuploaded = 0;
    triggerDashboardController = new TriggerDashboardController();
    panel = createChart(createData());
    panel.setPreferredSize(new Dimension(250, 250));

    setLayout(new BorderLayout());
    add(panel, BorderLayout.CENTER);
}

From source file:vic.collaborativeClouds.forms.Login.java

/**
 * Creates new form Login/*from  w w w .j  ava2  s. c o  m*/
 */
public Login() {
    initComponents();
    //this.setExtendedState(Login.MAXIMIZED_BOTH);
    this.setAlwaysOnTop(true);

    setLayout(new BorderLayout());
    ImageLocator mImage = new ImageLocator();
    //System.err.println(mImage.login_dash);
    JLabel background = new JLabel(new ImageIcon(mImage.login_dash));
    this.add(background);
    background.setLayout(new FlowLayout());

    Toolkit tk = Toolkit.getDefaultToolkit();
    int xSize = ((int) tk.getScreenSize().getWidth());
    int ySize = ((int) tk.getScreenSize().getHeight());
    this.setSize(xSize, ySize);
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
    heading.setLocation((xSize / 2) - 100, (ySize / 4) - 100);
    username.setLocation((xSize / 2) - 150, (ySize / 4));
    password.setLocation((xSize / 2) - 150, (ySize / 4) + 50);
    login.setLocation((xSize / 2) - 150, (ySize / 4) + 100);
    cancel.setLocation((xSize / 2) + 120, (ySize / 4) + 100);
    username.setOpaque(false);

}

From source file:com.joey.software.memoryToolkit.MemoryUsagePanel.java

public static JFrame getMemoryUsagePanel(int dataNum, int delay) {
    final MemoryUsagePanel u = new MemoryUsagePanel(dataNum, delay);
    JFrame f = new JFrame("Memory Usage");
    f.setLayout(new BorderLayout());
    f.getContentPane().add(u, BorderLayout.CENTER);
    f.setSize(800, 400);/*from w  w w .jav a  2  s  . c o m*/
    f.setVisible(true);

    final JButton runButton = new JButton("Start");
    runButton.addActionListener(new ActionListener() {

        boolean running = false;

        @Override
        public void actionPerformed(ActionEvent e) {
            if (running) {
                running = false;
                u.stopUpdating();
                runButton.setText("Start");
            } else {
                running = true;
                u.startUpdating();
                runButton.setText("Stop");
            }
        }
    });

    JButton garbage = new JButton("Run GC");
    garbage.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.gc();
        }
    });

    JPanel temp = new JPanel(new GridLayout(1, 1));

    temp.add(runButton);
    temp.add(garbage);

    f.getContentPane().add(temp, BorderLayout.SOUTH);

    return f;
}

From source file:coolmap.application.widget.impl.console.WidgetConsole.java

public WidgetConsole() {
    super("Console", W_DATA, L_DATAPORT, UI.getImageIcon("console"), "Displays console information");
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(_container, BorderLayout.CENTER);
    _container.setLayout(new BorderLayout());
    _container.add(new JScrollPane(consolePane), BorderLayout.CENTER);

    ///*from w  ww . java 2s  . c  om*/
    consolePane.setFont(UI.fontMono.deriveFont(12f));
    consolePane.setBackground(new Color(255, 255, 204));

    //        for (int i = 0; i < 100; i++) {
    //            logError("abcdefgh\n");
    //            logInfo("ABCDEFGH\n");
    //            log("DEFGHIJKL\n");
    //        }
    JPopupMenu popupMenu = new JPopupMenu();
    consolePane.setComponentPopupMenu(popupMenu);
    JMenuItem item = new JMenuItem("Clear", UI.getImageIcon("trashBin"));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            consolePane.setText("");
        }
    });
    popupMenu.add(item);
}

From source file:de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.WeekDayStatisticsPanel.java

public WeekDayStatisticsPanel() {
    setName("Wochentag");

    setLayout(new BorderLayout());

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    String weekDays[] = { "Mo", "Die", "Mi", "Do", "Fr", "Sa", "So" };
    int alarmCount[] = new int[7];

    try {/*from w  w  w .j  a  v a 2  s .  c om*/
        ResultSet resultSet = Starter.getDatabase().getStatement().executeQuery(
                "SELECT STARTDATE_WEEKDAY, COUNT(*) AS COUNT FROM ALARMHISTORY GROUP BY STARTDATE_WEEKDAY");

        while (resultSet.next()) {
            alarmCount[resultSet.getInt("STARTDATE_WEEKDAY") - 1] = resultSet.getInt("COUNT");
        }

    } catch (SQLException e) {
        e.printStackTrace();
    }

    for (int i = 0; i < 7; i++) {
        String dayName;
        int dayNumber;

        if (i != 6) {
            dayNumber = i + 1;
            dayName = weekDays[i];
        } else {
            dayName = weekDays[6]; //Sunday
            dayNumber = 0;
        }

        dataset.addValue(alarmCount[dayNumber], "", dayName);
    }

    JFreeChart chart = ChartFactory.createBarChart3D("Wochentagsbersicht", "Wochentag", "Einstze", dataset,
            PlotOrientation.VERTICAL, false, false, false);

    chart.setBackgroundPaint(getBackground());

    ChartPanel panel = new ChartPanel(chart);
    panel.setPopupMenu(null);
    add(panel, BorderLayout.CENTER);
}

From source file:Main.java

public MyPanel() {
    JTextField labelA = new JTextField("Your A component");
    JTextField labelB = new JTextField("Your B component");
    JTextField labelC = new JTextField("Your C component");
    JTextField labelD = new JTextField("Top Right D");

    JPanel north = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.FIRST_LINE_END;
    gbc.weightx = 1;//from www  .  j av a 2  s .c o  m
    gbc.insets = new Insets(10, 10, 10, 10);
    north.add(labelD, gbc);

    JPanel south = new JPanel(new GridBagLayout());
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.gridy = 0;
    south.add(labelA, gbc);
    gbc.gridy = 1;
    south.add(labelB, gbc);
    gbc.gridy = 2;
    south.add(labelC, gbc);

    setLayout(new BorderLayout());
    add(north, BorderLayout.NORTH);
    add(south, BorderLayout.CENTER);
}