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:embedding.ExampleJava2D2PDF.java
/** * Creates a PDF file. The contents are painted using a Graphics2D implementation that * generates an PDF file.// www. ja v a2s.co m * @param outputFile the target file * @throws IOException In case of an I/O error * @throws ConfigurationException if an error occurs configuring the PDF output */ public void generatePDF(File outputFile) throws IOException, ConfigurationException { OutputStream out = new java.io.FileOutputStream(outputFile); out = new java.io.BufferedOutputStream(out); try { //Instantiate the PDFDocumentGraphics2D instance PDFDocumentGraphics2D g2d = new PDFDocumentGraphics2D(false); g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext()); //Configure the G2D with the necessary fonts configure(g2d, createAutoFontsConfiguration()); //Set up the document size Dimension pageSize = new Dimension((int) Math.ceil(UnitConv.mm2pt(210)), (int) Math.ceil(UnitConv.mm2pt(297))); //page size A4 (in pt) g2d.setupDocument(out, pageSize.width, pageSize.height); g2d.translate(144, 72); //Establish some page borders //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 / c, 70, 90); } copy.dispose(); //Some text g2d.rotate(-0.25); g2d.setColor(Color.RED); g2d.setFont(new Font("sans-serif", Font.PLAIN, 36)); g2d.drawString("Hello world!", 140, 140); g2d.setColor(Color.RED.darker()); g2d.setFont(new Font("serif", Font.PLAIN, 36)); g2d.drawString("Hello world!", 140, 180); pageSize = new Dimension(pageSize.height, pageSize.width); g2d.nextPage(pageSize.width, pageSize.height); //Demonstrate painting rich text String someHTML = "<html><body style=\"font-family:Verdana\">" + "<p>Welcome to <b>page 2!</b></p>" + "<h2>PDFDocumentGraphics2D Demonstration</h2>" + "<p>We can <i>easily</i> paint some HTML here!</p>" + "<p style=\"color:green;\">" + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin accumsan" + " condimentum ullamcorper. Sed varius quam id arcu fermentum luctus. Praesent" + " nisi ligula, cursus sed vestibulum vel, sodales sed lectus.</p>" + "</body></html>"; JEditorPane htmlComp = new JEditorPane(); htmlComp.setContentType("text/html"); htmlComp.read(new StringReader(someHTML), null); htmlComp.setSize(new Dimension(pageSize.width - 72, pageSize.height - 72)); //htmlComp.setBackground(Color.ORANGE); htmlComp.validate(); htmlComp.printAll(g2d); //Cleanup g2d.finish(); } finally { IOUtils.closeQuietly(out); } }
From source file:com.joey.software.memoryToolkit.MemoryUsagePanel.java
/** * Creates a new application.//from ww w .j av a 2 s . co m * * @param historyCount * the history count (in milliseconds). */ public MemoryUsagePanel(int historyCount, int interval) { super(new BorderLayout()); // create two series that automatically discard data more than 30 // seconds old... this.total = new TimeSeries("Total Memory", Millisecond.class); this.total.setMaximumItemCount(historyCount); this.free = new TimeSeries("Free Memory", Millisecond.class); this.free.setMaximumItemCount(historyCount); this.used = new TimeSeries("Used Memory", Millisecond.class); this.used.setMaximumItemCount(historyCount); this.max = new TimeSeries("Used Memory", Millisecond.class); this.max.setMaximumItemCount(historyCount); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(this.total); dataset.addSeries(this.free); dataset.addSeries(this.used); dataset.addSeries(this.max); DateAxis domain = new DateAxis("Time"); NumberAxis range = new NumberAxis("Memory"); domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14)); range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14)); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); renderer.setSeriesPaint(0, Color.red); renderer.setSeriesPaint(1, Color.green); renderer.setSeriesPaint(2, Color.black); renderer.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); 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); range.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", Font.BOLD, 24), plot, true); chart.setBackgroundPaint(Color.white); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); add(chartPanel); gen = new DataGenerator(interval); }
From source file:org.sonar.plugins.buildstability.BuildStabilityChart.java
private Font getFont(String fontSize) { int size = FONT_SIZE; if (!StringUtils.isBlank(fontSize)) { size = Integer.parseInt(fontSize); }/*from w w w . j a v a 2s . c o m*/ return new Font(FONT_NAME, Font.PLAIN, size); }
From source file:de.perdian.apps.dashboard.support.chart.ChartCreator.java
public JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart(this.getTitle(), null, null, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(null);/*from ww w. jav a 2 s. c om*/ chart.setBackgroundImageAlpha(0.0f); if (chart.getTitle() != null) { chart.getTitle().setFont(new Font(this.getFontName(), Font.BOLD, 14)); } XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(null); plot.setBackgroundAlpha(0.0f); plot.setOutlinePaint(this.getColor()); plot.getDomainAxis().setVisible(false); plot.getDomainAxis().setAxisLineVisible(false); plot.getDomainAxis().setMinorTickCount(10); plot.getDomainAxis().setTickMarksVisible(false); if (this.getDomainTickUnits() != null) { plot.getDomainAxis().setStandardTickUnits(this.getDomainTickUnits()); } plot.getRangeAxis().setVisible(true); plot.getRangeAxis().setAxisLineVisible(false); plot.getRangeAxis().setTickLabelFont(new Font(this.getFontName(), Font.PLAIN, 10)); plot.getRangeAxis().setTickLabelPaint(this.getColor()); plot.getRangeAxis().setTickMarksVisible(false); if (this.getRangeTickUnits() != null) { plot.getRangeAxis().setStandardTickUnits(this.getRangeTickUnits()); } plot.getRangeAxis().setAttributedLabel(this.getRangeAxisLabel()); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); for (int i = 0; i < this.getStrokeDefinitions().size(); i++) { ChartStrokeDefinition strokeDefinition = this.getStrokeDefinitions().get(i); strokeDefinition.applyTo(renderer, i); } return chart; }
From source file:NormSample.java
public void init() { // preparing values for the normalization forms ComboBox formValues.put("NFC", Normalizer.Form.NFC); formValues.put("NFD", Normalizer.Form.NFD); formValues.put("NFKC", Normalizer.Form.NFKC); formValues.put("NFKD", Normalizer.Form.NFKD); formComboBox = new JComboBox(); for (Iterator it = formValues.keySet().iterator(); it.hasNext();) { formComboBox.addItem((String) it.next()); }//from w w w . ja va 2 s . c om // preparing samples for normalization // text with the acute accent symbol templateValues.put("acute accent", "touch" + "\u00e9"); // text with ligature templateValues.put("ligature", "a" + "\ufb03" + "ance"); // text with the cedilla templateValues.put("cedilla", "fa" + "\u00e7" + "ade"); // text with half-width katakana templateValues.put("half-width katakana", "\uff81\uff6e\uff7a\uff9a\uff70\uff84"); normalizationTemplate = new JComboBox(); for (Iterator it = templateValues.keySet().iterator(); it.hasNext();) { normalizationTemplate.addItem((String) it.next()); } // defining a component to output normalization results paintingComponent = new JComponent() { static final long serialVersionUID = -3725620407788489160L; public Dimension getSize() { return new Dimension(550, 200); } public Dimension getPreferredSize() { return new Dimension(550, 200); } public Dimension getMinimumSize() { return new Dimension(550, 200); } public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(new Font("Serif", Font.PLAIN, 20)); g2.setColor(Color.BLACK); g2.drawString("Original string:", 100, 80); g2.drawString("Normalized string:", 100, 120); g2.setFont(new Font("Serif", Font.BOLD, 24)); // output of the original sample selected from the ComboBox String original_string = templateValues.get(normalizationTemplate.getSelectedItem()); g2.drawString(original_string, 320, 80); // normalization and output of the normalized string String normalized_string; java.text.Normalizer.Form currentForm = formValues.get(formComboBox.getSelectedItem()); normalized_string = Normalizer.normalize(original_string, currentForm); g2.drawString(normalized_string, 320, 120); } }; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(paintingComponent); JPanel controls = new JPanel(); controls.setLayout(new BoxLayout(controls, BoxLayout.X_AXIS)); controls.add(new Label("Normalization Form: ")); controls.add(formComboBox); controls.add(new Label("Normalization Template:")); controls.add(normalizationTemplate); add(controls); formComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { paintingComponent.repaint(); } }); normalizationTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { paintingComponent.repaint(); } }); }
From source file:PickText3DGeometry.java
public BranchGroup createSceneGraph(Canvas3D canvas) { Color3f eColor = new Color3f(0.0f, 0.0f, 0.0f); Color3f sColor = new Color3f(1.0f, 1.0f, 1.0f); Color3f objColor = new Color3f(0.6f, 0.6f, 0.6f); Color3f lColor1 = new Color3f(1.0f, 0.0f, 0.0f); Color3f lColor2 = new Color3f(0.0f, 1.0f, 0.0f); Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f); Color3f bgColor = new Color3f(0.05f, 0.05f, 0.2f); Transform3D t;//from w w w. j a va 2 s . c om // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // Create a Transformgroup to scale all objects so they // appear in the scene. TransformGroup objScale = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setScale(0.4); objScale.setTransform(t3d); objRoot.addChild(objScale); // Create a bounds for the background and lights BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); // Set up the background Background bg = new Background(bgColor); bg.setApplicationBounds(bounds); objScale.addChild(bg); Material m = new Material(objColor, eColor, objColor, sColor, 100.0f); Appearance a = new Appearance(); m.setLightingEnable(true); a.setMaterial(m); Font3D f3d = new Font3D(new Font("TestFont", Font.PLAIN, 1), new FontExtrusion()); Text3D text3D = new Text3D(f3d, new String("TEXT3D"), new Point3f(-2.0f, 0.7f, 0.0f)); text3D.setCapability(Geometry.ALLOW_INTERSECT); Shape3D s3D1 = new Shape3D(); s3D1.setGeometry(text3D); s3D1.setAppearance(a); // Create a transform group node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. TransformGroup spinTg1 = new TransformGroup(); spinTg1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); spinTg1.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); spinTg1.setCapability(TransformGroup.ENABLE_PICK_REPORTING); spinTg1.addChild(s3D1); objScale.addChild(spinTg1); Text3D pick = new Text3D(f3d, new String("Pick me"), new Point3f(-2.0f, -0.7f, 0.0f)); pick.setCapability(Geometry.ALLOW_INTERSECT); Shape3D s3D2 = new Shape3D(); s3D2.setGeometry(pick); s3D2.setAppearance(a); // Create a transform group node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. TransformGroup spinTg2 = new TransformGroup(); spinTg2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); spinTg2.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); spinTg2.setCapability(TransformGroup.ENABLE_PICK_REPORTING); spinTg2.addChild(s3D2); objScale.addChild(spinTg2); // Create the transform group node for the each light and initialize // it to the identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. Add them to the root // of the subgraph. // Create transformations for the positional lights t = new Transform3D(); Vector3d lPos1 = new Vector3d(0.0, 0.0, 2.0); t.set(lPos1); TransformGroup l1Trans = new TransformGroup(t); l1Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); l1Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); l1Trans.setCapability(TransformGroup.ENABLE_PICK_REPORTING); objScale.addChild(l1Trans); t = new Transform3D(); Vector3d lPos2 = new Vector3d(0.5, 1.2, 2.0); t.set(lPos2); TransformGroup l2Trans = new TransformGroup(t); l2Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); l2Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); l2Trans.setCapability(TransformGroup.ENABLE_PICK_REPORTING); objScale.addChild(l2Trans); // Create Geometry for point lights ColoringAttributes caL1 = new ColoringAttributes(); ColoringAttributes caL2 = new ColoringAttributes(); caL1.setColor(lColor1); caL2.setColor(lColor2); Appearance appL1 = new Appearance(); Appearance appL2 = new Appearance(); appL1.setColoringAttributes(caL1); appL2.setColoringAttributes(caL2); l1Trans.addChild(new Sphere(0.05f, Sphere.GENERATE_NORMALS | Sphere.ENABLE_GEOMETRY_PICKING, 15, appL1)); l2Trans.addChild(new Sphere(0.05f, Sphere.GENERATE_NORMALS | Sphere.ENABLE_GEOMETRY_PICKING, 15, appL2)); // Create lights AmbientLight aLgt = new AmbientLight(alColor); Light lgt1; Light lgt2; Point3f lPoint = new Point3f(0.0f, 0.0f, 0.0f); Point3f atten = new Point3f(1.0f, 0.0f, 0.0f); lgt1 = new PointLight(lColor1, lPoint, atten); lgt2 = new PointLight(lColor2, lPoint, atten); // Set the influencing bounds aLgt.setInfluencingBounds(bounds); lgt1.setInfluencingBounds(bounds); lgt2.setInfluencingBounds(bounds); // Add the lights into the scene graph objScale.addChild(aLgt); l1Trans.addChild(lgt1); l2Trans.addChild(lgt2); PickRotateBehavior behavior1 = new PickRotateBehavior(objRoot, canvas, bounds); behavior1.setMode(PickTool.GEOMETRY); behavior1.setTolerance(0.0f); objRoot.addChild(behavior1); PickZoomBehavior behavior2 = new PickZoomBehavior(objRoot, canvas, bounds); behavior2.setMode(PickTool.GEOMETRY); behavior2.setTolerance(0.0f); objRoot.addChild(behavior2); PickTranslateBehavior behavior3 = new PickTranslateBehavior(objRoot, canvas, bounds); behavior3.setMode(PickTool.GEOMETRY); behavior3.setTolerance(0.0f); objRoot.addChild(behavior3); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }
From source file:PrintTest.java
/** * This method draws the page both on the screen and the printer graphics context. * @param g2 the graphics context/*from w w w . ja v a 2 s. c om*/ */ public void drawPage(Graphics2D g2) { FontRenderContext context = g2.getFontRenderContext(); Font f = new Font("Serif", Font.PLAIN, 72); GeneralPath clipShape = new GeneralPath(); TextLayout layout = new TextLayout("Hello", f, context); AffineTransform transform = AffineTransform.getTranslateInstance(0, 72); Shape outline = layout.getOutline(transform); clipShape.append(outline, false); layout = new TextLayout("World", f, context); transform = AffineTransform.getTranslateInstance(0, 144); outline = layout.getOutline(transform); clipShape.append(outline, false); g2.draw(clipShape); g2.clip(clipShape); final int NLINES = 50; Point2D p = new Point2D.Double(0, 0); for (int i = 0; i < NLINES; i++) { double x = (2 * getWidth() * i) / NLINES; double y = (2 * getHeight() * (NLINES - 1 - i)) / NLINES; Point2D q = new Point2D.Double(x, y); g2.draw(new Line2D.Double(p, q)); } }
From source file:net.sf.webphotos.gui.util.FtpClient.java
/** * Construtor da classe. Prepara a interface de sincronizao. Configura o * sistema de sincronizao e confere o valor de enviarAltaResoluo para * enviar originais ou no. Seta os valores dos listeners de sincronizao * implementando os mtodos da interface Sync. *//*from w w w. ja va 2s .co m*/ public FtpClient() { cp = getContentPane(); /** * Preparando a interface de sincronizao */ retry = 3; try { //TODO: transformar este acesso em parmetro do sistema ftp = (Sync) ApplicationContextResource.getBean("syncObject"); /** * Configurao do sistema de sincronizao */ ftp.setSyncFolder(ftpRoot); enviarAltaResolucao = ftp.isEnviarAltaResolucao(); ftp.loadSyncCache(); } catch (Exception ex) { Util.log("[FtpClient.run]/ERRO: Inexperado."); log.error(ex); System.exit(1); } // ajusta o valor de enviarAltaResolucao if (enviarAltaResolucao == false) { this.setTitle("Transmisso FTP - Sem Enviar Originais"); } else { this.setTitle("Transmisso FTP - Enviando Originais"); } txtLog.setFont(new Font("courier", Font.PLAIN, 11)); Util.setLoggingTextArea(txtLog); cp.setLayout(null); cp.add(lblArquivos); lblArquivos.setBounds(348, 3, 60, 18); cp.add(lblServidor); lblServidor.setBounds(8, 3, 340, 18); txtLog.setWrapStyleWord(true); txtLog.setLineWrap(true); cp.add(scrLog); scrLog.setBounds(8, 127, 400, 70); modeloTabela = new FTPTabelModel(ftp.getListaArquivos()); tabela = new JTable(modeloTabela); cp.add(tabela); scrTabela = new JScrollPane(tabela); cp.add(scrTabela); scrTabela.setBounds(8, 20, 400, 100); cp.validate(); // barraArquivoAtual, kbytes, botao cp.add(barraArquivoAtual); barraArquivoAtual.setStringPainted(true); barraArquivoAtual.setBounds(8, 235, 234, 18); barraArquivoAtual.setToolTipText("Progresso do arquivo atual"); cp.add(lblKbytesArquivoAtual); lblKbytesArquivoAtual.setBounds(246, 235, 58, 18); // barra, kbytes, botao cp.add(barra); barra.setStringPainted(true); barra.setBounds(8, 205, 234, 18); barra.setToolTipText("Progresso total"); cp.add(lblKbytes); lblKbytes.setBounds(246, 205, 58, 18); cp.add(btFechar); btFechar.setBounds(308, 204, 100, 20); btFechar.setEnabled(false); this.setSize(420, 300); this.setResizable(false); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(FtpClient.DO_NOTHING_ON_CLOSE); this.getContentPane().repaint(); this.setVisible(true); modal = new Modal(this); this.addWindowFocusListener(modal); // ouvinte para o boto fechar btFechar.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { exit(); } }); // ouvinte para o fechamento convencional do JFrame // TODO: trocar o if para checagem de parmetro if (1 == 2) { addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent evt) { exit(); } }); } ftp.setSyncListener(new SyncAdapter() { @Override public void connected(SyncEvent e) { lblServidor.setText(ftpHost + ":" + ftpPort + " / usurio: " + usuario); } @Override public void logonStarted(SyncEvent event) { // Autenticacao if (!event.isRetrying()) { if (BancoImagem.getBancoImagem().getUserFTP() != null) { // Vamos tentar conectar com a senha prpria de FTP usuario = BancoImagem.getBancoImagem().getUserFTP(); senha = BancoImagem.getBancoImagem().getPasswordFTP(); } else if (BancoImagem.getBancoImagem().getUser() != null) { // Ou o mesmo usurio/senha do banco de dados usuario = BancoImagem.getBancoImagem().getUser(); senha = BancoImagem.getBancoImagem().getPassword(); } else { showLogonDialog(); } } else { showLogonDialog(); } ftp.setUsuario(usuario); ftp.setSenha(senha); } @Override public void disconnected(SyncEvent e) { //TODO: repensar esse comando //Util.setLoggingTextArea(PainelWebFotos.getTxtLog()); btFechar.setEnabled(true); } private void showLogonDialog() { // Ou requisitamos do usurio Login l = new Login("FTP " + ftpHost); removeWindowFocusListener(modal); l.show(); addWindowFocusListener(modal); usuario = l.getUser(); senha = l.getPassword(); } }); ftp.setCopyStreamListener(new CopyStreamAdapter() { @Override public void bytesTransferred(long totalBytesTransferred, int bytesTransferred, long streamSize) { barraArquivoAtual.setValue((int) totalBytesTransferred); lblKbytesArquivoAtual.setText(Math.round((float) totalBytesTransferred / 1024) + " Kb"); } }); }
From source file:de.hs.mannheim.modUro.diagram.JTimeSeriesDiagram.java
protected JFreeChart createChart(XYDataset dataset, String name) { String title = name;/*from ww w. j av a 2 s . com*/ 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); if (isMetric) { 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(); 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.blue); 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:BillboardTest.java
private TransformGroup createBillboard(String szText, Point3f locationPoint, int nMode, Point3f billboardPoint, BoundingSphere bounds) {/*from w w w . j av a 2s . co m*/ TransformGroup subTg = new TransformGroup(); subTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Font3D f3d = new Font3D(new Font("SansSerif", Font.PLAIN, 10), new FontExtrusion()); Text3D label3D = new Text3D(f3d, szText, locationPoint); Appearance app = new Appearance(); Color3f black = new Color3f(0.1f, 0.1f, 0.1f); Color3f objColor = new Color3f(0.2f, 0.2f, 0.2f); app.setMaterial(new Material(objColor, black, objColor, black, 90.0f)); Shape3D sh = new Shape3D(label3D, app); subTg.addChild(sh); Billboard billboard = new Billboard(subTg, nMode, billboardPoint); billboard.setSchedulingBounds(bounds); subTg.addChild(billboard); return subTg; }