List of usage examples for java.awt Font PLAIN
int PLAIN
To view the source code for java.awt Font PLAIN.
Click Source Link
From source file:TextLayoutWithCarets.java
private void initialize(Graphics2D g2) { String s = "Java Source and Support."; // Create a plain and italic font. int fontSize = 32; Font font = new Font("Lucida Sans Regular", Font.PLAIN, fontSize); Font italicFont = new Font("Lucida Sans Oblique", Font.ITALIC, fontSize); // Create an Attributed String AttributedString as = new AttributedString(s); as.addAttribute(TextAttribute.FONT, font); as.addAttribute(TextAttribute.FONT, italicFont, 2, 5); // Get the iterator. AttributedCharacterIterator iterator = as.getIterator(); // Create a TextLayout. FontRenderContext frc = g2.getFontRenderContext(); mLayout = new TextLayout(iterator, frc); mHit = mLayout.getNextLeftHit(1);/*w w w . j a va2s.c o m*/ // Respond to left and right arrow keys. mInitialized = true; }
From source file:MessageDigestTest.java
public MessageDigestFrame() { setTitle("MessageDigestTest"); setSize(400, 200);//from www. j a v a 2 s .com addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); JPanel panel = new JPanel(); ButtonGroup group = new ButtonGroup(); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { JCheckBox b = (JCheckBox) event.getSource(); setAlgorithm(b.getText()); } }; addCheckBox(panel, "SHA-1", group, true, listener); addCheckBox(panel, "MD5", group, false, listener); Container contentPane = getContentPane(); contentPane.add(panel, "North"); contentPane.add(new JScrollPane(message), "Center"); contentPane.add(digest, "South"); digest.setFont(new Font("Monospaced", Font.PLAIN, 12)); setAlgorithm("SHA-1"); JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("File"); JMenuItem fileDigestItem = new JMenuItem("File digest"); fileDigestItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { loadFile(); } }); menu.add(fileDigestItem); JMenuItem textDigestItem = new JMenuItem("Text area digest"); textDigestItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { String m = message.getText(); computeDigest(m.getBytes()); } }); menu.add(textDigestItem); menuBar.add(menu); setJMenuBar(menuBar); }
From source file:DemoFonts.java
public static Font getFont(String name) { Font font = null;//from w w w .java 2s . com if (cache != null) { if ((font = cache.get(name)) != null) { return font; } } String fName = "/fonts/" + name; try { InputStream is = DemoFonts.class.getResourceAsStream(fName); font = Font.createFont(Font.TRUETYPE_FONT, is); } catch (Exception ex) { ex.printStackTrace(); System.err.println(fName + " not loaded. Using serif font."); font = new Font("serif", Font.PLAIN, 24); } return font; }
From source file:com.orange.atk.results.logger.log.Action.java
/** * Set Annotation properties used in Analysis Tool (keypress,log,screenshot...) * For each action a marker and an Annotation is related * @param Xvalue StartTime of Marker Action * @param Yvalue Position where to display the comment 1 for the top 0 for the bottom * @param color Color of Marker/*ww w . j ava 2 s . co m*/ */ public void setAnnotation(double Xvalue, Paint color) { if (szActionName != null) { annotation = new XYTextAnnotation(szActionName, Xvalue, 0.05); annotation.setFont(new Font("SansSerif", Font.PLAIN, 12)); annotation.setRotationAngle(3 * Math.PI / 2); annotation.setRotationAnchor(TextAnchor.BOTTOM_LEFT); annotation.setTextAnchor(TextAnchor.BOTTOM_LEFT); annotation.setToolTipText(szActionName); annotation.setPaint(color); } }
From source file:include.picture.MyBarChart.java
/** *? */// w w w .ja v a2 s .c o m public void paint() { try { check(); CategoryDataset dataset = getDataSet(series, category, data); JFreeChart chart = ChartFactory.createBarChart3D(title, axisXLabel, axisYLabel, dataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(Color.WHITE); BarRenderer3D renderer = new BarRenderer3D(); CategoryPlot plot = chart.getCategoryPlot(); renderer.setMaxBarWidth(0.01); renderer.setBaseOutlinePaint(Color.BLACK); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setItemLabelFont(new Font("", Font.PLAIN, 15)); renderer.setItemLabelsVisible(true); renderer.setItemMargin(0.1); plot.setRenderer(renderer); FileOutputStream fos_jpg = null; try { fos_jpg = new FileOutputStream(fileName); ChartUtilities.writeChartAsJPEG(fos_jpg, 1000, chart, width, height, null); } finally { try { fos_jpg.close(); } catch (Exception e) { } } } catch (Exception e) { e.printStackTrace(); } // end of try-catch }
From source file:net.sf.mzmine.chartbasics.chartthemes.ChartThemeFactory.java
public static EStandardChartTheme changeChartThemeForPrintOrPresentation(EStandardChartTheme theme, boolean forPrint) { if (forPrint) { // Fonts/*from w w w.j ava 2 s. c o m*/ 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)); } else { // for presentation larger fonts // Fonts theme.setExtraLargeFont(new Font("Arial", Font.BOLD, 30)); theme.setLargeFont(new Font("Arial", Font.BOLD, 20)); theme.setRegularFont(new Font("Arial", Font.PLAIN, 16)); theme.setSmallFont(new Font("Arial", Font.PLAIN, 16)); } return theme; }
From source file:de.hs.mannheim.modUro.diagram.JCellCountDiagram.java
protected JFreeChart createChart(XYDataset dataset, String name) { String title = name;/*w ww .j ava 2s.co m*/ JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title "t", // x-axis label "n", // y-axis label dataset); String fontName = "Palatino"; xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18)); XYPlot plot = (XYPlot) xyLineChart.getPlot(); plot.setDomainPannable(true); plot.setRangePannable(true); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); plot.getRangeAxis().setLowerMargin(0.0); // plot.getRangeAxis().setRange(0.0, 1.01); plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.gray); xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14)); xyLineChart.getLegend().setFrame(BlockBorder.NONE); xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER); XYItemRenderer r = plot.getRenderer(); // set the default stroke for all series int i = 0; for (String celltype : getTimeSeries().getDataSeriesNames()) { r.setSeriesPaint(i, CellTypeColor.getColor(celltype)); i++; } r.setSeriesPaint(i, Color.BLACK); return xyLineChart; }
From source file:de.hs.mannheim.modUro.controller.diagram.DiagramController.java
/** * Creates JFreeChart. XYLineDiagram.// www .j a v a 2 s .c om * * @param dataset * @return */ protected JFreeChart createChart(XYDataset dataset, String metricTypeName) { String title = metricTypeName; JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title "t", // x-axis label "f", // y-axis label dataset); String fontName = "Palatino"; xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18)); XYPlot plot = (XYPlot) xyLineChart.getPlot(); plot.setDomainPannable(true); plot.setRangePannable(true); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); plot.getRangeAxis().setLowerMargin(0.0); plot.getRangeAxis().setRange(0.0, 1.01); plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14)); xyLineChart.getLegend().setFrame(BlockBorder.NONE); xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(false); renderer.setDrawSeriesLineAsPath(true); // set the default stroke for all series renderer.setAutoPopulateSeriesStroke(false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, new Color(24, 123, 58)); renderer.setSeriesPaint(2, new Color(149, 201, 136)); renderer.setSeriesPaint(3, new Color(1, 62, 29)); renderer.setSeriesPaint(4, new Color(81, 176, 86)); renderer.setSeriesPaint(5, new Color(0, 55, 122)); renderer.setSeriesPaint(6, new Color(0, 92, 165)); } return xyLineChart; }
From source file:ec.nbdemetra.benchmarking.calendarization.CalendarizationChartView.java
private static JFreeChart createChart(String title) { JFreeChart result = ChartFactory.createXYLineChart("", "", "", Charts.emptyXYDataset(), PlotOrientation.VERTICAL, false, false, false); result.setPadding(TsCharts.CHART_PADDING); result.setTitle(new TextTitle(title, new Font("SansSerif", Font.PLAIN, 12))); XYPlot plot = result.getXYPlot();//from w ww . j a v a2 s . co m plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); LinesThickness linesThickness = LinesThickness.Thin; XYLineAndShapeRenderer daily = new XYLineAndShapeRenderer(true, false); daily.setAutoPopulateSeriesPaint(false); daily.setAutoPopulateSeriesStroke(false); daily.setBaseStroke(TsCharts.getStrongStroke(linesThickness)); plot.setRenderer(DAILY_INDEX, daily); XYDifferenceRenderer difference = new XYDifferenceRenderer(); difference.setAutoPopulateSeriesPaint(false); difference.setAutoPopulateSeriesStroke(false); difference.setBaseStroke(TsCharts.getNormalStroke(linesThickness)); plot.setRenderer(DIFF_INDEX, difference); XYLineAndShapeRenderer smooth = new XYLineAndShapeRenderer(true, false); smooth.setAutoPopulateSeriesPaint(false); smooth.setAutoPopulateSeriesStroke(false); smooth.setBaseStroke(TsCharts.getStrongStroke(linesThickness)); plot.setRenderer(SMOOTH_INDEX, smooth); DateAxis domainAxis = new DateAxis(); domainAxis.setTickMarkPosition(DateTickMarkPosition.START); domainAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR); plot.setDomainAxis(domainAxis); NumberAxis rangeAxis = new NumberAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR); plot.setRangeAxis(rangeAxis); return result; }
From source file:org.jfree.chart.swt.demo.SWTPieChartDemo1.java
/** * Creates a chart./*ww w . ja v a2 s. c o m*/ * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 1", // chart title dataset, // data true, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionOutlinesVisible(false); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }