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:edu.virginia.speclab.juxta.author.view.DocumentSourceCard.java

public DocumentSourceCard() {
    setLayout(new BorderLayout());
    this.dsTextArea = new DocumentSourceTextArea();
    this.textScroller = new JScrollPane(this.dsTextArea);
    add(this.textScroller, BorderLayout.CENTER);
}

From source file:de.huxhorn.lilith.swing.AboutDialog.java

public AboutDialog(Frame owner, String title, String appName) {
    super(owner, title, false);
    wasScrolling = true;//from   www .j  a  va 2  s . c om
    setLayout(new BorderLayout());
    InputStream is = MainFrame.class.getResourceAsStream("/about/aboutText.txt");
    String aboutText = null;
    final Logger logger = LoggerFactory.getLogger(AboutDialog.class);
    if (is != null) {
        try {
            aboutText = IOUtils.toString(is, StandardCharsets.UTF_8);
        } catch (IOException e) {
            if (logger.isErrorEnabled())
                logger.error("Exception while loading aboutText!! *grrr*");
        }
    }
    try {
        aboutPanel = new AboutPanel(MainFrame.class.getResource("/about/lilith_big.jpg"),
                new Rectangle(50, 50, 400, 200), aboutText, MainFrame.class.getResource("/about/lilith.jpg"),
                appName, 20);
        //aboutPanel.setDebug(true);
        add(aboutPanel, BorderLayout.CENTER);
    } catch (IOException e) {
        if (logger.isErrorEnabled())
            logger.error("Exception creating about panel!!");
    }
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        /**
         * Invoked when a window is in the process of being closed.
         * The close operation can be overridden at this point.
         */
        @Override
        public void windowClosing(WindowEvent e) {
            setVisible(false);
        }
    });

}

From source file:ch.zhaw.ias.dito.ui.util.SingleHistogramPanel.java

public SingleHistogramPanel(Matrix m) {
    super(new BorderLayout());
    this.m = m;/* w  w w . j  a v  a  2s  .co m*/
    this.chart = createChart();
    this.chartPanel = new ChartPanel(this.chart);

    Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createEtchedBorder());
    this.chartPanel.setBorder(border);
    add(this.chartPanel, BorderLayout.CENTER);

    JPanel dashboard = new JPanel(new BorderLayout());
    dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4));

    this.spinner = new JSpinner(new SpinnerNumberModel(0, 0, m.getColCount() - 1, 1));
    spinner.addChangeListener(this);
    this.slider = new JSlider(0, m.getColCount() - 1, 0);
    slider.setPaintLabels(true);

    slider.setMajorTickSpacing(Math.max(50, 10 * Math.round(m.getColCount() / 100)));
    slider.setPaintTicks(true);
    this.slider.addChangeListener(this);

    FormLayout layout = new FormLayout("fill:0:g, max(20dlu; pref)", "top:pref");
    CellConstraints cc = new CellConstraints();
    DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle());

    fb.add(slider, cc.xy(1, 1));
    fb.add(spinner, cc.xy(2, 1));

    dashboard.add(fb.getPanel(), BorderLayout.CENTER);
    add(dashboard, BorderLayout.SOUTH);
    switchColumn(0);
}

From source file:com.tencent.wstt.apt.chart.PieChart.java

public PieChart() {
    super(new BorderLayout());
    chart = createChart();/*from  w  ww. ja va 2 s  .c  om*/
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    this.add(chartPanel);
}

From source file:org.jfree.chart.demo.MemoryUsageDemo.java

public MemoryUsageDemo(int i) {
    super(new BorderLayout());
    total = new TimeSeries("Total Memory");
    total.setMaximumItemAge(i);/* w  ww. j a v  a2 s.c  om*/
    free = new TimeSeries("Free Memory");
    free.setMaximumItemAge(i);
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    timeseriescollection.addSeries(total);
    timeseriescollection.addSeries(free);
    DateAxis dateaxis = new DateAxis("Time");
    NumberAxis numberaxis = new NumberAxis("Memory");
    dateaxis.setTickLabelFont(new Font("SansSerif", 0, 12));
    numberaxis.setTickLabelFont(new Font("SansSerif", 0, 12));
    dateaxis.setLabelFont(new Font("SansSerif", 0, 14));
    numberaxis.setLabelFont(new Font("SansSerif", 0, 14));
    XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
    xylineandshaperenderer.setSeriesPaint(0, Color.red);
    xylineandshaperenderer.setSeriesPaint(1, Color.green);
    xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(3F, 0, 2));
    xylineandshaperenderer.setSeriesStroke(1, new BasicStroke(3F, 0, 2));
    XYPlot xyplot = new XYPlot(timeseriescollection, dateaxis, numberaxis, xylineandshaperenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    dateaxis.setAutoRange(true);
    dateaxis.setLowerMargin(0.0D);
    dateaxis.setUpperMargin(0.0D);
    dateaxis.setTickLabelsVisible(true);
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    JFreeChart jfreechart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", 1, 24), xyplot, true);
    jfreechart.setBackgroundPaint(Color.white);
    ChartPanel chartpanel = new ChartPanel(jfreechart, true);
    chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    add(chartpanel);
}

From source file:compecon.dashboard.panel.AgentsPanel.java

public AgentsPanel() {

    this.setLayout(new BorderLayout());

    JTabbedPane jTabbedPane = new JTabbedPane();

    for (Currency currency : Currency.values()) {
        JPanel panelForCurrency = new JPanel();
        panelForCurrency.setLayout(new GridLayout(0, 2));
        jTabbedPane.addTab(currency.getIso4217Code(), panelForCurrency);

        panelForCurrency.setBackground(Color.lightGray);

        for (Class<? extends Agent> agentType : ApplicationContext.getInstance().getAgentFactory()
                .getAgentTypes()) {/*from  w w w . jav  a  2s  .co  m*/
            panelForCurrency.add(createAgentNumberPanel(currency, agentType));
        }
    }

    add(jTabbedPane, BorderLayout.CENTER);
}

From source file:com.waitwha.nessus.trendanalyzer.gui.PieChartPanel.java

public PieChartPanel(String title, PieDataset dataset) {
    super(new BorderLayout());

    JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(true);
    plot.setNoDataMessage("No data available");

    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);/*from   w ww  .  ja va 2 s. co  m*/
    this.add(panel, BorderLayout.CENTER);
    this.validate();
}

From source file:net.itransformers.topologyviewer.rightclick.impl.CLIReportViewer.java

public <G> void handleRightClick(JFrame parent, String v, Map<String, String> graphMLParams,
        Map<String, String> rightClickParams, File projectPath, File versionDir) throws Exception {
    Logger logger = Logger.getLogger(CLIReportViewer.class);

    JFrame frame = new JFrame(" report for " + v + " ");
    frame.setSize(600, 400);/*from w  w w.j  a  v a 2  s.  com*/
    frame.getContentPane().setLayout(new BorderLayout());
    JTextPane text = new JTextPane();
    text.setEditable(true);
    text.setContentType("text/html");
    String postDiscoveryFolderPath = rightClickParams.get("post-discovery-file-path");
    String reportFileName = rightClickParams.get("reportFileName");
    logger.info("CLI report executed in " + versionDir + " for " + File.separator + postDiscoveryFolderPath
            + File.separator + v + File.separator + reportFileName);

    File xmlReport = new File(versionDir.getAbsolutePath() + File.separator + postDiscoveryFolderPath
            + File.separator + v + File.separator + reportFileName);
    if (xmlReport.exists()) {
        text.setText(FileUtils.readFileToString(xmlReport));
        JScrollPane scrollPane = new JScrollPane(text);
        frame.getContentPane().add("Center", scrollPane);
        frame.setVisible(true);

    } else {
        JOptionPane.showMessageDialog(parent, "Report does not exist! Please generate it first!");
    }
}

From source file:GUI.PlotHere.java

/**
 * Creates new form PlotHere//from  w  w w.j a va 2  s. co  m
 */
public PlotHere(String Title) {
    initComponents();
    XYSeries Input00 = new XYSeries("Input 00");
    XYSeries Input01 = new XYSeries("Input 01");
    XYSeries Input02 = new XYSeries("Input 02");
    XYSeriesCollection data = new XYSeriesCollection(Input00);
    data.addSeries(Input01);
    data.addSeries(Input02);
    JFreeChart chart = ChartFactory.createXYLineChart(Title, "Angle", "Voltage", data, PlotOrientation.VERTICAL,
            true, true, false);
    ChartPanel chartpanel = new ChartPanel(chart);
    //chartpanel.setDomainZoomable(true);
    chartpanel.setPreferredSize(new java.awt.Dimension(200, 200));

    //JPanel jPanel4 = new JPanel();

    Component[] a = GraphHerePanel.getComponents();
    if (a.length == 0) {
        GraphHerePanel.setLayout(new BorderLayout());
        GraphHerePanel.add(chartpanel);
    }
    this.revalidate();
    this.repaint();

}

From source file:ws.moor.bt.gui.charts.BlockOrigin.java

public BlockOrigin(CounterRepository counterRepository) {
    super();/*from  w  w w  .ja va2s.c o m*/
    this.counterRepository = counterRepository;

    chart = createChart(getDataSet());
    setLayout(new BorderLayout());
    ChartPanel panel = new ChartPanel(chart, false, true, false, false, false);
    panel.setMouseZoomable(false);
    add(panel, BorderLayout.CENTER);
}