Example usage for javax.swing BorderFactory createLineBorder

List of usage examples for javax.swing BorderFactory createLineBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createLineBorder.

Prototype

public static Border createLineBorder(Color color) 

Source Link

Document

Creates a line border with the specified color.

Usage

From source file:ec.nbdemetra.ui.demo.ComponentsDemo.java

private static void initStaticResources() {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    BarRenderer.setDefaultBarPainter(new StandardBarPainter());
    UIManager.put("Nb.Editor.Toolbar.border", BorderFactory.createLineBorder(Color.WHITE));
    TsFactory.instance.add(new FakeTsProvider());
}

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

public MemoryUsageDemo(int i) {
    super(new BorderLayout());
    total = new TimeSeries("Total Memory");
    total.setMaximumItemAge(i);/*from   w w w.  j  a va 2s .  c  o  m*/
    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:ComboBoxDemo2.java

public ComboBoxDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z",
            "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" };

    currentPattern = patternExamples[0];

    //Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Enter the pattern string or");
    JLabel patternLabel2 = new JLabel("select one from the list:");

    JComboBox patternList = new JComboBox(patternExamples);
    patternList.setEditable(true);/*  ww  w  .  ja  v a2s .  c o m*/
    patternList.addActionListener(this);

    //Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); //==
    // LEFT
    result = new JLabel(" ");
    result.setForeground(Color.black);
    result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    reformat();
}

From source file:savant.view.swing.FrameCommandBar.java

/**
 * Create command bar/*ww  w  .  ja  v  a2s .c o m*/
 */
FrameCommandBar(Frame f) {
    frame = f;
    graphPane = (GraphPane) f.getGraphPane();
    mainTrack = (Track) f.getTracks()[0];
    setMinimumSize(new Dimension(50, 22));
    setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));

    // TODO: Should we really be doing BAM-specific stuff in this class?
    JMenu toolsMenu = createToolsMenu();
    add(toolsMenu);

    if (mainTrack.getValidDrawingModes().length > 1) {
        JMenu modeMenu = createDisplayModeMenu();
        add(modeMenu);
    }

    JMenu appearanceMenu = createAppearanceMenu();
    add(appearanceMenu);

    DataFormat df = mainTrack.getDataFormat();
    if (df == DataFormat.ALIGNMENT || df == DataFormat.GENERIC_INTERVAL || df == DataFormat.RICH_INTERVAL) {
        intervalMenu = createIntervalMenu();
        add(intervalMenu);

        drawModeChanged(mainTrack.getDrawingMode());
        int h = getIntervalHeight();
        graphPane.setUnitHeight(h);
        graphPane.setScaledToFit(false);
    }
}

From source file:org.executequery.gui.browser.FindAction.java

private void init() {

    searchPanel = new JPanel(new GridBagLayout());
    popup = new JPopupMenu();

    searchField = WidgetFactory.createTextField();
    searchField.setPreferredSize(new Dimension(270, 22));

    resultsList = initSearchResultsList();
    JScrollPane scrollPane = new JScrollPane(resultsList);
    scrollPane.setPreferredSize(new Dimension(300, 150));

    JLabel label = new JLabel(" Search: ");

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;/* w  w w.j  a  va2s .c  om*/
    gbc.gridy = 0;
    gbc.insets.left = 3;
    gbc.insets.top = 3;
    gbc.insets.bottom = 3;
    searchPanel.add(label, gbc);
    gbc.gridx = 1;
    gbc.insets.right = 3;
    gbc.insets.left = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    searchPanel.add(searchField, gbc);
    gbc.gridx = 0;
    gbc.gridy++;
    gbc.gridwidth = 2;
    gbc.insets.left = 3;
    gbc.insets.top = 0;
    gbc.fill = GridBagConstraints.BOTH;
    searchPanel.add(scrollPane, gbc);

    popup.setBorder(BorderFactory.createLineBorder(UIUtils.getDefaultBorderColour()));
    popup.add(searchPanel);

    // when the window containing the "comp" has registered Esc key
    // then on pressing Esc instead of search popup getting closed
    // the event is sent to the window. to overcome this we
    // register an action for Esc.
    searchField.registerKeyboardAction(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            popup.setVisible(false);
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_FOCUSED);
}

From source file:com.github.cmisbox.ui.BaseFrame.java

public BaseFrame() {
    super(AWTUtilitiesWrapper.isTranslucencyCapable(BaseFrame.gc) ? BaseFrame.gc : null);
    this.log = LogFactory.getLog(this.getClass());

    this.gradient = false;
    this.setUndecorated(true);
    this.mainPanel = new JPanel(new GridBagLayout()) {

        private static final long serialVersionUID = 1035974033526970010L;

        protected void paintComponent(Graphics g) {
            if ((g instanceof Graphics2D) && BaseFrame.this.gradient) {
                final int R = 0;
                final int G = 0;
                final int B = 0;

                Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 192), this.getWidth(),
                        this.getHeight(), new Color(R, G, B, 255), true);
                Graphics2D g2d = (Graphics2D) g;
                g2d.setPaint(p);/*from   w w w .  ja  va 2  s .  c  o  m*/
                g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
            } else {
                super.paintComponent(g);
            }
        }
    };

    this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    GridBagConstraints gbc = new GridBagConstraints();

    this.mainPanel.setDoubleBuffered(false);
    this.mainPanel.setOpaque(false);
    this.mainPanel.setBorder(BorderFactory.createLineBorder(Color.white));

    JLabel title = new JLabel(this.getWindowTitle(), SwingConstants.CENTER);
    title.setForeground(Color.white);

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.weightx = 100;

    this.mainPanel.add(title, gbc);

    Image closeImg = this.getImage("images/application-exit.png", 32, 32);
    JLabel close = new JLabel(new ImageIcon(closeImg), SwingConstants.RIGHT);

    gbc.fill = GridBagConstraints.NONE;
    gbc.gridx = 2;
    gbc.weightx = 0;

    this.mainPanel.add(close, gbc);

    close.addMouseListener(this.closeAdapter);

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

    this.initComponents();

    this.pack();

    this.mainPanel.setOpaque(!this.gradient);
    if (!this.gradient) {
        this.mainPanel.setBackground(new Color(0, 0, 0, 208));
    }

    this.setLocationRelativeTo(null);
    AWTUtilitiesWrapper.setWindowOpaque(this, false);
    this.setVisible(true);
    this.setAlwaysOnTop(true);

}

From source file:mediamatrix.gui.JVMMemoryProfilerPanel.java

public JVMMemoryProfilerPanel() {
    initComponents();// ww w .ja v  a 2 s.  c  om
    profiler = new JVMMemoryProfiler(frequency);
    profiler.addListener(new JVMMemoryProfilerListener() {

        @Override
        public void addScore(long t, long f) {
            total.add(new Millisecond(), t);
            free.add(new Millisecond(), f);
        }
    });

    total = new TimeSeries("Total Memory");
    total.setMaximumItemCount(historyCount);
    free = new TimeSeries("Free Memory");
    free.setMaximumItemCount(historyCount);

    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(total);
    dataset.addSeries(free);

    final DateAxis domain = new DateAxis("Time");
    final NumberAxis range = new NumberAxis("Memory");
    domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
    range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
    range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    final XYItemRenderer renderer = new DefaultXYItemRenderer();
    renderer.setSeriesPaint(0, Color.red);
    renderer.setSeriesPaint(1, Color.green);
    renderer.setBaseStroke(new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));

    final XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    domain.setAutoRange(true);
    domain.setLowerMargin(0.0);
    domain.setUpperMargin(0.0);
    domain.setTickLabelsVisible(true);

    final JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", Font.BOLD, 24), plot,
            true);
    chart.setBackgroundPaint(Color.white);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 12));

    add(chartPanel, BorderLayout.CENTER);
}

From source file:org.perfmon4j.visualvm.chart.DynamicTimeSeriesChart.java

public DynamicTimeSeriesChart(int maxAgeInSeconds) {
    super(new BorderLayout());
    this.maxAgeInSeconds = maxAgeInSeconds;

    dataset = new TimeSeriesCollection();
    renderer = new MyXYRenderer();
    renderer.setBaseStroke(NORMAL_STROKE);

    NumberAxis numberAxis = new NumberAxis();
    numberAxis.setAutoRange(false);//  w w w.jav a 2 s  .c  o  m
    numberAxis.setRange(new Range(0d, 100d));

    DateAxis dateAxis = new DateAxis();
    dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));
    dateAxis.setAutoRange(true);
    dateAxis.setFixedAutoRange(maxAgeInSeconds * 1000);
    dateAxis.setTickUnit(new DateTickUnit(DateTickUnitType.SECOND, 30));

    XYPlot plot = new XYPlot(dataset, dateAxis, numberAxis, renderer);
    JFreeChart chart = new JFreeChart(null, null, plot, false);
    chart.setBackgroundPaint(Color.white);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setDomainZoomable(false);
    chartPanel.setRangeZoomable(false);
    chartPanel.setPopupMenu(null);

    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1),
            BorderFactory.createLineBorder(Color.black)));

    add(chartPanel);
}

From source file:ome.formats.importer.gui.GuiCommonElements.java

/**
 * Add a 'main panel' to a Frame or other container
 * //w  ww .j av  a 2 s . c  o m
 * @param container - parent container
 * @param tableSize - TableLayout table array
 * @param margin_top - top margin
 * @param margin_left - left margin
 * @param margin_bottom - bottom margin
 * @param margin_right - right margin
 * @param debug - turn on/off red debug borders
 * @return new JPanel
 */
public static JPanel addMainPanel(Container container, double tableSize[][], int margin_top, int margin_left,
        int margin_bottom, int margin_right, boolean debug) {
    JPanel panel = new JPanel();
    panel.setOpaque(false);

    TableLayout layout = new TableLayout(tableSize);
    panel.setLayout(layout);
    panel.setBorder(BorderFactory.createEmptyBorder(margin_top, margin_left, margin_bottom, margin_right));

    if (debug == true)
        panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red),
                panel.getBorder()));

    return panel;
}

From source file:utilities.GraphViewer.java

public GraphViewer() {

    super("Graph Viewer");
    setRootPaneCheckingEnabled(false);/*from w  ww  . j a  v  a  2s  .c om*/

    this.setLocation(0, 0);
    this.setVisible(false);
    dataset = new XYSeriesCollection();
    this.db = new Db();
    this.sensors = new LinkedList<JCheckBox>();
    this.sensors1 = new LinkedList<JCheckBox>();

    getContentPane().setLayout(new BorderLayout(0, 0));

    this.setName("Graph Viewer");
    setIconifiable(true);
    setClosable(true);
    setBounds(6, 95, 1000, 600);

    option = new JPanel();
    option.setBackground(new Color(240, 240, 255));
    option.setPreferredSize(new Dimension(200, 500));
    option.setLayout(new BorderLayout(10, 10));
    getContentPane().add(option, BorderLayout.WEST);

    parcourir = new JButton("Add Sensor");
    parcourir.setAlignmentX(Component.CENTER_ALIGNMENT);
    parcourir.addActionListener(this);
    option.add(parcourir, BorderLayout.NORTH);

    this.sensorsList = new JPanel();
    sensorsList.setLayout(new VerticalLayout());
    sensorsList.setBackground(Color.WHITE);

    scpane = new JScrollPane(sensorsList);
    scpane.setBorder(BorderFactory.createLineBorder(Color.black));
    scpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    option.add(scpane, BorderLayout.CENTER);

    paneGraphe = new JPanel();
    paneGraphe.setLayout(new BorderLayout(0, 0));
    graphe = graphe();
    paneGraphe.add(graphe, BorderLayout.CENTER);
    getContentPane().add(paneGraphe);

}