List of usage examples for java.awt Font BOLD
int BOLD
To view the source code for java.awt Font BOLD.
Click Source Link
From source file:org.webcat.grader.graphs.WCChartTheme.java
/** * Initializes a new WCChartTheme, which is a JFreeChart theme that is * customized for Web-CAT and can eventually pull values directly from the * user's currently selected Web-CAT theme. * * @param theme the user's currently selected Web-CAT theme *//*ww w .j av a 2s .c om*/ public WCChartTheme(Theme theme) { super("Web-CAT"); if (theme != null) { this.theme = theme; } else { this.theme = Theme.defaultTheme(); } // Use the font that we currently have as the default Web-CAT font. String fontName = defaultFontName(); setExtraLargeFont(new Font(fontName, Font.BOLD, 20)); setLargeFont(new Font(fontName, Font.BOLD, 14)); setRegularFont(new Font(fontName, Font.BOLD, 12)); setSmallFont(new Font(fontName, Font.BOLD, 10)); // Set the text color based on whether the theme is light or dark. Color textColor = textColor(); setAxisLabelPaint(textColor); setItemLabelPaint(textColor); setLegendItemPaint(textColor); setSubtitlePaint(textColor); setTickLabelPaint(textColor); setTitlePaint(textColor); // Make the background of the charts transparent. setPlotBackgroundPaint(new Color(144, 144, 144, 128)); Color transparent = new Color(0, 0, 0, 0); setChartBackgroundPaint(transparent); setLegendBackgroundPaint(transparent); // Kill the gradients that newer versions of JFreeChart add by default. setDrawingSupplier(new ThemeBasedDrawingSupplier()); setBarPainter(new StandardBarPainter()); setXYBarPainter(new StandardXYBarPainter()); }
From source file:org.openfaces.component.chart.impl.plots.MultiplePiePlotAdapter.java
private TextTitle getSeriesTitle(Chart chart) { StyleObjectModel cssChartViewModel = chart.getChartView().getStyleObjectModel(); TextTitle seriesTitle;/*from w ww.j av a2 s. co m*/ Font f = CSSUtil.getFont(cssChartViewModel); if (f != null) { seriesTitle = new TextTitle("Series Title", f); } else { seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); } if (cssChartViewModel.getColor() != null) { seriesTitle.setPaint(cssChartViewModel.getColor()); } seriesTitle.setPosition(RectangleEdge.BOTTOM); return seriesTitle; }
From source file:be.ac.ua.comp.scarletnebula.gui.BareGraph.java
/** * @see Graph/* w ww . j a v a 2s . c o m*/ */ @Override public ChartPanel getChartPanel() { final XYPlot plot = new XYPlot(dataset, domain, range, renderer); plot.setBackgroundPaint(Color.darkGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setInsets(new RectangleInsets(0, 0, 0, 0)); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); final JFreeChart chart = new JFreeChart(null, new Font("SansSerif", Font.BOLD, 24), plot, true); chart.setBackgroundPaint(Color.white); chart.removeLegend(); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); return chartPanel; }
From source file:com.yanbang.portal.controller.PortalController.java
/** * ???/*from ww w.j ava2s. c om*/ * * @param request * @param response * @return * @throws Exception */ @RequestMapping(params = "action=handleRnd") public void handleRnd(HttpServletRequest request, HttpServletResponse response) throws Exception { response.setHeader("Cache-Control", "no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0L); response.setContentType("image/jpeg"); BufferedImage image = new BufferedImage(65, 25, BufferedImage.TYPE_INT_RGB); Graphics g = image.getGraphics(); g.setColor(Color.GRAY); g.fillRect(0, 0, 65, 25); g.setColor(Color.yellow); Font font = new Font("", Font.BOLD, 20); g.setFont(font); Random r = new Random(); String rnd = ""; int ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 5, 18); g.setColor(Color.red); ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 20, 18); g.setColor(Color.blue); ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 35, 18); g.setColor(Color.green); ir = r.nextInt(10); rnd = rnd + "" + ir; g.drawString("" + ir, 50, 18); request.getSession().setAttribute("RND", rnd); ServletOutputStream out = response.getOutputStream(); out.write(ImageUtil.imageToBytes(image, "gif")); out.flush(); out.close(); }
From source file:de.fub.maps.project.detector.model.inference.ui.charts.PrecisionRecallBarChartPanel.java
/** * Creates new form PrecisionRecallBarChartPanel *//*w w w . j a va 2 s. c o m*/ public PrecisionRecallBarChartPanel() { super(); initComponents(); barChart = ChartFactory.createBarChart( NbBundle.getMessage(PrecisionRecallBarChartPanel.class, "CLT_Chart_Precision_Recall_Name"), NbBundle.getMessage(PrecisionRecallBarChartPanel.class, "CLT_Doman_Axis_Name"), NbBundle.getMessage(PrecisionRecallBarChartPanel.class, "CLT_Value_Axis_Name"), dataset, PlotOrientation.VERTICAL, true, true, true); Font font = new JLabel().getFont().deriveFont(Font.BOLD, 14); barChart.getTitle().setFont(font); barChart.getTitle().setPaint(new Color(153, 153, 153)); plot = barChart.getCategoryPlot(); NumberAxis preciAxis = new NumberAxis( NbBundle.getMessage(PrecisionRecallBarChartPanel.class, "CLT_Value_Axis_Name")); preciAxis.setAutoRange(true); preciAxis.setUpperMargin(.20); plot.setRangeAxis(0, preciAxis); plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT); plot.setBackgroundPaint(Color.white); BarRenderer barRenderer = new BarRenderer(); barRenderer.setBarPainter(new StandardBarPainter()); barRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); barRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, new CustomNumberFormat())); barRenderer.setBaseItemLabelsVisible(true); barRenderer.setSeriesPaint(0, precColor); barRenderer.setSeriesPaint(1, recColor); plot.setRenderer(barRenderer); chartPanel = new ChartPanel(barChart, false); chartPanel.setVerticalAxisTrace(false); add(chartPanel, BorderLayout.CENTER); }
From source file:agentlogfileanalyzer.gui.ComparisonFrame.java
/** * Creates a chart frame for comparing a selected classifier to a set of * other classifiers.//from ww w . j av a 2 s . c o m * * @param firstTitle * the first line of the chart title * @param secondTitle * the second line of the chart title * @param compDataForColumns * the data the will be displayed in the chart */ public ComparisonFrame(String firstTitle, String secondTitle, Vector<ComparisonDataSet> compDataForColumns) { super("Classifier comparison"); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < compDataForColumns.size(); i++) { ComparisonDataSet mms = compDataForColumns.get(i); dataset.addValue(mms.getMax(), "max", mms.getColumnName()); dataset.addValue(mms.getMin(), "min", mms.getColumnName()); dataset.addValue(mms.getSelected(), "selected", mms.getColumnName()); } JFreeChart jfreechart = ChartFactory.createBarChart("", // title "", // x-axis title "", // y-axis title dataset, PlotOrientation.VERTICAL, true, true, false); TextTitle subtitle1 = new TextTitle(firstTitle, new Font("SansSerif", Font.BOLD, 12)); TextTitle subtitle2 = new TextTitle(secondTitle, new Font("SansSerif", Font.BOLD, 12)); jfreechart.addSubtitle(0, subtitle1); jfreechart.addSubtitle(1, subtitle2); jfreechart.setBackgroundPaint(Color.white); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setRangeGridlinePaint(Color.white); MinMaxCategoryRenderer minmaxcategoryrenderer = new MinMaxCategoryRenderer(); categoryplot.setRenderer(minmaxcategoryrenderer); ChartPanel chartpanel = new ChartPanel(jfreechart); chartpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartpanel); }
From source file:AttributesApp.java
public AttributesApp() { setBackground(Color.lightGray); setSize(500, 200);//from w w w.j a v a2 s. com attribString = new AttributedString(text); GeneralPath star = new GeneralPath(); star.moveTo(0, 0); star.lineTo(10, 30); star.lineTo(-10, 10); star.lineTo(10, 10); star.lineTo(-10, 30); star.closePath(); GraphicAttribute starShapeAttr = new ShapeGraphicAttribute(star, GraphicAttribute.TOP_ALIGNMENT, false); attribString.addAttribute(TextAttribute.CHAR_REPLACEMENT, starShapeAttr, 0, 1); attribString.addAttribute(TextAttribute.FOREGROUND, new Color(255, 255, 0), 0, 1); int index = text.indexOf("Java Source"); attribString.addAttribute(TextAttribute.FOREGROUND, Color.blue, index, index + 7); Font font = new Font("sanserif", Font.ITALIC, 40); attribString.addAttribute(TextAttribute.FONT, font, index, index + 7); loadImage(); BufferedImage bimage = new BufferedImage(image.getWidth(this), image.getHeight(this), BufferedImage.TYPE_INT_ARGB); Graphics2D big = bimage.createGraphics(); big.drawImage(image, null, this); GraphicAttribute javaImageAttr = new ImageGraphicAttribute(bimage, GraphicAttribute.TOP_ALIGNMENT, 0, 0); index = text.indexOf("Java"); attribString.addAttribute(TextAttribute.CHAR_REPLACEMENT, javaImageAttr, index - 1, index); font = new Font("serif", Font.BOLD, 60); attribString.addAttribute(TextAttribute.FONT, font, index, index + 4); attribString.addAttribute(TextAttribute.FOREGROUND, new Color(243, 63, 163), index, index + 4); // Start and end indexes. index = text.indexOf("source"); attribString.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, index, index + 2); index = text.indexOf("and support"); font = new Font("sanserif", Font.ITALIC, 40); attribString.addAttribute(TextAttribute.FONT, font, index, index + 10); attribString.addAttribute(TextAttribute.FOREGROUND, Color.white, index, index + 2); // Start and end indexes. attribString.addAttribute(TextAttribute.FOREGROUND, Color.blue, index + 3, index + 10); // Start and end indexes. }
From source file:net.sf.mzmine.chartbasics.chartthemes.ChartThemeFactory.java
public static EStandardChartTheme createBlackNWhiteTheme() { EStandardChartTheme theme = new EStandardChartTheme(THEME.BNW_PRINT, "BnW"); // Fonts//w w w. j av a 2 s . c om theme.setExtraLargeFont(new Font("Arial", Font.BOLD, 16)); theme.setLargeFont(new Font("Arial", Font.BOLD, 11)); theme.setRegularFont(new Font("Arial", Font.PLAIN, 11)); theme.setSmallFont(new Font("Arial", Font.PLAIN, 11)); // Paints theme.setTitlePaint(Color.black); theme.setSubtitlePaint(Color.black); theme.setLegendItemPaint(Color.black); theme.setPlotOutlinePaint(Color.black); theme.setBaselinePaint(Color.black); theme.setCrosshairPaint(Color.black); theme.setLabelLinkPaint(Color.black); theme.setTickLabelPaint(Color.black); theme.setAxisLabelPaint(Color.black); theme.setShadowPaint(Color.black); theme.setItemLabelPaint(Color.black); theme.setLegendBackgroundPaint(Color.white); theme.setChartBackgroundPaint(Color.white); theme.setPlotBackgroundPaint(Color.white); // paint sequence: add black Paint[] colors = new Paint[] { Color.BLACK, new Color(0xFF, 0x55, 0x55), new Color(0x55, 0x55, 0xFF), new Color(0x55, 0xFF, 0x55), new Color(0xFF, 0xFF, 0x55), new Color(0xFF, 0x55, 0xFF), new Color(0x55, 0xFF, 0xFF), Color.pink, Color.gray, ChartColor.DARK_RED, ChartColor.DARK_BLUE, ChartColor.DARK_GREEN, ChartColor.DARK_YELLOW, ChartColor.DARK_MAGENTA, ChartColor.DARK_CYAN, Color.darkGray, ChartColor.LIGHT_RED, ChartColor.LIGHT_BLUE, ChartColor.LIGHT_GREEN, ChartColor.LIGHT_YELLOW, ChartColor.LIGHT_MAGENTA, ChartColor.LIGHT_CYAN, Color.lightGray, ChartColor.VERY_DARK_RED, ChartColor.VERY_DARK_BLUE, ChartColor.VERY_DARK_GREEN, ChartColor.VERY_DARK_YELLOW, ChartColor.VERY_DARK_MAGENTA, ChartColor.VERY_DARK_CYAN, ChartColor.VERY_LIGHT_RED, ChartColor.VERY_LIGHT_BLUE, ChartColor.VERY_LIGHT_GREEN, ChartColor.VERY_LIGHT_YELLOW, ChartColor.VERY_LIGHT_MAGENTA, ChartColor.VERY_LIGHT_CYAN }; theme.setDrawingSupplier( new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE)); theme.setErrorIndicatorPaint(Color.black); theme.setGridBandPaint(new Color(255, 255, 255, 20)); theme.setGridBandAlternatePaint(new Color(255, 255, 255, 40)); // axis Color transp = new Color(0, 0, 0, 200); theme.setRangeGridlinePaint(transp); theme.setDomainGridlinePaint(transp); theme.setAxisLinePaint(Color.black); // axis offset theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); return theme; }
From source file:br.ufrgs.enq.jcosmo.ui.SigmaProfileAreaPanel.java
public SigmaProfileAreaPanel() { setLayout(new BorderLayout()); sigmaProfileChart = ChartFactory.createStackedXYAreaChart(null, "sigma [e/]", "p(sigma)area []", dataset, PlotOrientation.VERTICAL, true, true, false); sigmaProfilePlot = sigmaProfileChart.getXYPlot(); sigmaProfilePlot.getDomainAxis().setAutoRange(false); sigmaProfilePlot.getDomainAxis().setRange(new Range(-0.025, 0.025)); sigmaProfilePlot.setBackgroundPaint(Color.WHITE); sigmaProfilePlot.setAxisOffset(new RectangleInsets(8, 0, 0, 16)); sigmaProfilePlot.setDomainGridlinesVisible(false); sigmaProfilePlot.setRangeGridlinesVisible(false); Font font = new Font("DeJaVu Serif", Font.BOLD, 16); Font fontMini = new Font("DeJaVu Serif", 0, 12); sigmaProfileChart.getLegend().setItemFont(fontMini); sigmaProfilePlot.getDomainAxis().setLabelFont(font); sigmaProfilePlot.getRangeAxis().setLabelFont(font); sigmaProfilePlot.getDomainAxis().setTickLabelFont(fontMini); sigmaProfilePlot.getRangeAxis().setTickLabelFont(fontMini); sigmaProfilePlot.getDomainAxis().setAxisLinePaint(Color.BLACK); sigmaProfilePlot.getDomainAxis().setTickMarkPaint(Color.BLACK); sigmaProfilePlot.getDomainAxis().setTickMarkInsideLength(4); sigmaProfilePlot.getDomainAxis().setTickMarkOutsideLength(0); sigmaProfilePlot.getRangeAxis().setAxisLinePaint(Color.BLACK); sigmaProfilePlot.getRangeAxis().setTickMarkPaint(Color.BLACK); sigmaProfilePlot.getRangeAxis().setTickMarkInsideLength(4); sigmaProfilePlot.getRangeAxis().setTickMarkOutsideLength(0); add(new ChartPanel(sigmaProfileChart), BorderLayout.CENTER); }
From source file:com.aw.swing.mvp.grid.GridManager.java
private void configureGridTitleColor() { JPanel pnlGrid = ipView.getPnlGrid(gridIndex); pnlGrid.setBorder(BorderFactory.createLineBorder(new Color(131, 172, 219))); JPanel pnlTitGrid = ipView.getPnlTitGrid(gridIndex); pnlTitGrid.setBackground(new Color(131, 172, 219)); pnlTitGrid.setLayout(/* ww w. jav a 2s. co m*/ new FormLayout("fill:16dlu:noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,right:pref:grow", "center:16dlu:noGrow")); JLabel lblTitGrid = ipView.getLblTitGrid(gridIndex); lblTitGrid.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); lblTitGrid.setForeground(Color.black); numRecords = new JLabel(""); numRecords.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); numRecords.setForeground(Color.black); numRecords.setVisible(showTotalRegistros); pnlTitGrid.remove(lblTitGrid); CellConstraints cc = new CellConstraints(); pnlTitGrid.add(lblTitGrid, cc.xy(3, 1)); pnlTitGrid.add(numRecords, cc.xy(5, 1)); }