List of usage examples for javax.swing BorderFactory createCompoundBorder
public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder)
From source file:org.jfree.expdemo.SelectionDemo4.java
/** * Creates a new demo.//from w w w . j a v a 2s. c o m * * @param title * the frame title. */ public SelectionDemo4(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (SimpleHistogramDataset) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Item:", "Bin Start::", "Bin End:", "Value:" }, 0); this.table = new JTable(this.model); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:unusedClasses.MemoryUsageDemo.java
public MemoryUsageDemo(int paramInt) { super(new BorderLayout()); this.total.setMaximumItemAge(paramInt); this.free = new TimeSeries("Free Memory"); this.free.setMaximumItemAge(paramInt); TimeSeriesCollection localTimeSeriesCollection = new TimeSeriesCollection(); localTimeSeriesCollection.addSeries(this.total); localTimeSeriesCollection.addSeries(this.free); DateAxis localDateAxis = new DateAxis("Time"); NumberAxis localNumberAxis = new NumberAxis("Memory"); localDateAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localNumberAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localDateAxis.setLabelFont(new Font("SansSerif", 0, 14)); localNumberAxis.setLabelFont(new Font("SansSerif", 0, 14)); XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer(true, false); localXYLineAndShapeRenderer.setSeriesPaint(0, Color.red); localXYLineAndShapeRenderer.setSeriesPaint(1, Color.green); localXYLineAndShapeRenderer.setSeriesStroke(0, new BasicStroke(3.0F, 0, 2)); localXYLineAndShapeRenderer.setSeriesStroke(1, new BasicStroke(3.0F, 0, 2)); XYPlot localXYPlot = new XYPlot(localTimeSeriesCollection, localDateAxis, localNumberAxis, localXYLineAndShapeRenderer); localDateAxis.setAutoRange(true);//from w w w . ja v a 2s . c o m localDateAxis.setLowerMargin(0.0D); localDateAxis.setUpperMargin(0.0D); localDateAxis.setTickLabelsVisible(true); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFreeChart localJFreeChart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", 1, 24), localXYPlot, true); ChartUtilities.applyCurrentTheme(localJFreeChart); ChartPanel localChartPanel = new ChartPanel(localJFreeChart, true); localChartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); add(localChartPanel); }
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);/*from www . j a v a 2s. com*/ 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:org.jfree.chart.demo.selection.SelectionDemo1.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * /*from w ww. j a va 2s . co m*/ * @param title the frame title. */ public SelectionDemo1(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (TimeSeriesCollection) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "Period:", "Value:" }, 0); this.table = new JTable(this.model); TableColumnModel tcm = this.table.getColumnModel(); tcm.getColumn(3).setCellRenderer(new NumberCellRenderer()); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:org.jfree.chart.demo.selection.SelectionDemo2.java
/** * A demonstration application showing a scatter plot. * * @param title the frame title./*from www. j a v a 2s . c o m*/ */ public SelectionDemo2(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (XYSeriesCollection) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "X:", "Y:" }, 0); this.table = new JTable(this.model); TableColumnModel tcm = this.table.getColumnModel(); tcm.getColumn(2).setCellRenderer(new NumberCellRenderer()); tcm.getColumn(3).setCellRenderer(new NumberCellRenderer()); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:org.jfree.chart.demo.selection.SelectionDemo3.java
/** * A demonstration application showing a scatter plot. * * @param title the frame title.//from w w w . j ava 2 s .c o m */ public SelectionDemo3(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (XYSeriesCollection) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "X:", "Y:" }, 0); this.table = new JTable(this.model); TableColumnModel tcm = this.table.getColumnModel(); tcm.getColumn(2).setCellRenderer(new NumberCellRenderer()); tcm.getColumn(3).setCellRenderer(new NumberCellRenderer()); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
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 av a 2 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: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);//from w ww .ja va 2 s .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:components.SliderDemo.java
public SliderDemo() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); delay = 1000 / FPS_INIT;/*from www .java 2s. com*/ //Create the label. JLabel sliderLabel = new JLabel("Frames Per Second", JLabel.CENTER); sliderLabel.setAlignmentX(Component.CENTER_ALIGNMENT); //Create the slider. JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL, FPS_MIN, FPS_MAX, FPS_INIT); framesPerSecond.addChangeListener(this); //Turn on labels at major tick marks. framesPerSecond.setMajorTickSpacing(10); framesPerSecond.setMinorTickSpacing(1); framesPerSecond.setPaintTicks(true); framesPerSecond.setPaintLabels(true); framesPerSecond.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); Font font = new Font("Serif", Font.ITALIC, 15); framesPerSecond.setFont(font); //Create the label that displays the animation. picture = new JLabel(); picture.setHorizontalAlignment(JLabel.CENTER); picture.setAlignmentX(Component.CENTER_ALIGNMENT); picture.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(10, 10, 10, 10))); updatePicture(0); //display first frame //Put everything together. add(sliderLabel); add(framesPerSecond); add(picture); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); //Set up a timer that calls this object's action handler. timer = new Timer(delay, this); timer.setInitialDelay(delay * 7); //We pause animation twice per cycle //by restarting the timer timer.setCoalesce(true); }
From source file:org.jdal.swing.ApplicationContextGuiFactory.java
/** * // www . j av a 2 s. c o m * @param name title string * @return a new titled border * @deprecated use FormUtils.createTitledBorder instead. */ @Deprecated public static Border createTitledBorder(String name) { Border margin = BorderFactory.createEmptyBorder(10, 10, 10, 10); Border title = BorderFactory.createTitledBorder(name); return BorderFactory.createCompoundBorder(title, margin); }