List of usage examples for java.awt Font Font
private Font(String name, int style, float sizePts)
From source file:org.jfree.eastwood.ChartApplet.java
/** * Starts the applet./* www.j a v a 2 s. c om*/ */ public void start() { String chartSpec = getParameter("chart"); try { Map params = Parameters.parseQueryString(chartSpec); JFreeChart chart = ChartEngine.buildChart(params, new Font("Dialog", Font.PLAIN, 12)); this.chartPanel.setChart(chart); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementsmanager.view.charts.StatView.java
/** * Creates a chart.//from www . ja v a 2s.c om * * @param dataset * the dataset. * * @return A chart. */ private static JFreeChart createPieStatusChart() { final StatusRequirementStatistics statusRequirementStatistics = new StatusRequirementStatistics(); final JFreeChart chart = statusRequirementStatistics.buildPieChart(); final PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(true); plot.setLabelGap(0.02); return chart; }
From source file:jmbench.plots.SummaryWhiskerPlot.java
public JFreeChart createChart() { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(title, "Matrix Libraries", "Relative Performance", dataSet, true);/*from w ww . jav a 2 s .co m*/ CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(true); plot.setBackgroundPaint(new Color(230, 230, 230)); plot.setDomainGridlinePaint(new Color(50, 50, 50, 50)); plot.setDomainGridlineStroke(new BasicStroke(78f)); chart.getTitle().setFont(new Font("Times New Roman", Font.BOLD, 24)); String foo = "( Higher is Better )"; if (subtitle != null) foo += " ( " + subtitle + " )"; chart.addSubtitle(new TextTitle(foo, new Font("SansSerif", Font.ITALIC, 12))); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:jflowmap.JFlowMapApplet.java
public JFlowMapApplet() { instantiated = true;/*from w w w .j a v a2 s .co m*/ if (!JFlowMapMain.IS_OS_MAC) { SwingUtils.initNimbusLF(); UIDefaults defaults = UIManager.getLookAndFeelDefaults(); // defaults.put("Panel.background", new Color(0xf0, 0xf0, 0xf0)); // defaults.put("TabbedPane.background", new Color(0xf0, 0xf0, 0xf0)); defaults.put("background", new Color(0xf0, 0xf0, 0xf0)); defaults.put("defaultFont", new Font("Arial", Font.PLAIN, 14)); } blockingGlassPane = new BlockingGlassPane(); setGlassPane(blockingGlassPane); blockingGlassPane.setVisible(false); }
From source file:org.sonar.server.charts.deprecated.BaseChart.java
protected Font getFont() { return new Font("SansSerif", Font.PLAIN, FONT_SIZE); }
From source file:org.fhcrc.cpl.toolbox.gui.chart.PanelWithBoxAndWhiskerChart.java
protected void init() { dataset = new DefaultBoxAndWhiskerCategoryDataset(); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false);/*from w ww . j av a 2 s .co m*/ renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryAxis xAxis = new CategoryAxis("Type"); final NumberAxis yAxis = new NumberAxis("Value"); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); final JFreeChart chart = new JFreeChart(getName(), new Font("SansSerif", Font.BOLD, 14), plot, true); init(chart.getPlot()); }
From source file:org.jfree.chart.demo.MarkerDemo2.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("Marker Demo 2", "X", "Temperature", xydataset, PlotOrientation.VERTICAL, false, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainGridlinePaint(Color.lightGray); xyplot.setDomainGridlineStroke(new BasicStroke(1.0F)); xyplot.setRangeGridlinePaint(Color.lightGray); xyplot.setRangeGridlineStroke(new BasicStroke(1.0F)); xyplot.setRangeTickBandPaint(new Color(240, 240, 240)); PeriodAxis periodaxis = new PeriodAxis(null, new Hour(0, 30, 6, 2005), new Hour(23, 30, 6, 2005)); PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Hour.class, new SimpleDateFormat("HH")); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("dd-MMM")); periodaxis.setLabelInfo(aperiodaxislabelinfo); xyplot.setDomainAxis(periodaxis);/*from w w w . ja v a 2 s .c o m*/ ValueAxis valueaxis = xyplot.getRangeAxis(); valueaxis.setRange(0.0D, 100D); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(0, Color.green); xyitemrenderer.setSeriesStroke(0, new BasicStroke(2.0F)); ValueMarker valuemarker = new ValueMarker(80D); valuemarker.setLabelOffsetType(LengthAdjustmentType.EXPAND); valuemarker.setPaint(Color.red); valuemarker.setStroke(new BasicStroke(2.0F)); valuemarker.setLabel("Temperature Threshold"); valuemarker.setLabelFont(new Font("SansSerif", 0, 11)); valuemarker.setLabelPaint(Color.red); valuemarker.setLabelAnchor(RectangleAnchor.TOP_LEFT); valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT); xyplot.addRangeMarker(valuemarker); Hour hour = new Hour(18, 30, 6, 2005); Hour hour1 = new Hour(20, 30, 6, 2005); double d = hour.getFirstMillisecond(); double d1 = hour1.getFirstMillisecond(); IntervalMarker intervalmarker = new IntervalMarker(d, d1); intervalmarker.setLabelOffsetType(LengthAdjustmentType.EXPAND); intervalmarker.setPaint(new Color(150, 150, 255)); intervalmarker.setLabel("Automatic Cooling"); intervalmarker.setLabelFont(new Font("SansSerif", 0, 11)); intervalmarker.setLabelPaint(Color.blue); intervalmarker.setLabelAnchor(RectangleAnchor.TOP_LEFT); intervalmarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); xyplot.addDomainMarker(intervalmarker, Layer.BACKGROUND); ValueMarker valuemarker1 = new ValueMarker(d, Color.blue, new BasicStroke(2.0F)); ValueMarker valuemarker2 = new ValueMarker(d1, Color.blue, new BasicStroke(2.0F)); xyplot.addDomainMarker(valuemarker1, Layer.BACKGROUND); xyplot.addDomainMarker(valuemarker2, Layer.BACKGROUND); return jfreechart; }
From source file:image.writer.ImageWriterExample1.java
/** * Paints a few things on a Graphics2D instance. * @param g2d the Graphics2D instance//from w w w. j av a 2 s .co m * @param pageNum a page number */ protected void paintSome(Graphics2D g2d, int pageNum) { //Paint a bounding box g2d.drawRect(0, 0, 400, 200); //A few rectangles rotated and with different color Graphics2D copy = (Graphics2D) g2d.create(); int c = 12; for (int i = 0; i < c; i++) { float f = ((i + 1) / (float) c); Color col = new Color(0.0f, 1 - f, 0.0f); copy.setColor(col); copy.fillRect(70, 90, 50, 50); copy.rotate(-2 * Math.PI / (double) c, 70, 90); } copy.dispose(); //Some text copy = (Graphics2D) g2d.create(); copy.rotate(-0.25); copy.setColor(Color.RED); copy.setFont(new Font("sans-serif", Font.PLAIN, 36)); copy.drawString("Hello world!", 140, 140); copy.setColor(Color.RED.darker()); copy.setFont(new Font("serif", Font.PLAIN, 36)); copy.drawString("Hello world!", 140, 180); copy.dispose(); //Try attributed text AttributedString aString = new AttributedString("This is attributed text."); aString.addAttribute(TextAttribute.FAMILY, "SansSerif"); aString.addAttribute(TextAttribute.FAMILY, "Serif", 8, 18); aString.addAttribute(TextAttribute.FOREGROUND, Color.orange, 8, 18); g2d.drawString(aString.getIterator(), 250, 170); g2d.drawString("Page: " + pageNum, 250, 190); }
From source file:view.GerarGrafico.java
private JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Grfico de Transaes", // chart title dataset, // data true, // include legend true, false/*from w w w .j a v a 2 s .c o m*/ ); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionPaint("Provento", new Color(68, 157, 68)); plot.setSectionPaint("Despesa", new Color(217, 83, 79)); plot.setLabelFont(new Font("Segoue UI", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }
From source file:Main.java
public ListRenderingFrame() { setTitle("ListRendering"); setSize(400, 300);/*from w w w.j av a 2s .c o m*/ addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Vector fonts = new Vector(); fonts.add(new Font("Serif", Font.PLAIN, 8)); fonts.add(new Font("SansSerif", Font.BOLD, 12)); fonts.add(new Font("Monospaced", Font.PLAIN, 16)); fonts.add(new Font("Dialog", Font.ITALIC, 12)); fonts.add(new Font("DialogInput", Font.PLAIN, 12)); JList fontList = new JList(fonts); fontList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fontList.setCellRenderer(new FontCellRenderer()); JScrollPane scrollPane = new JScrollPane(fontList); JPanel p = new JPanel(); p.add(scrollPane); fontList.addListSelectionListener(this); getContentPane().add(p, "Center"); getContentPane().add(label, "South"); }