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.cyberoam.iview.charts.CustomDomainAxis.java
public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null;/* w w w.j a va 2s . c o m*/ // DefaultCategoryDataset dataset=null; CustomCategoryDataset datasetCustom = null; try { ReportColumnBean reportColumnBeanX = null; ReportColumnBean reportColumnBeanY = null; ReportColumnBean reportColumnBeanZ = null; GraphBean graphBean = null; graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId()); reportColumnBeanX = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getXColumnId());//getting ReportColumnBean For X Axis String xColumnDBname = reportColumnBeanX.getDbColumnName(); reportColumnBeanY = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBeanY.getDbColumnName(); String zColumnDBname = null; datasetCustom = new CustomCategoryDataset(); rsw.beforeFirst(); String data = ""; int count = -1; Boolean showLegend = false; if (graphBean.getZColumnId() == -1) { while (rsw.next()) { data = rsw.getString(xColumnDBname); datasetCustom.addValue(rsw.getLong(yColumnDBname), "", data); } } else { String zData; showLegend = true; reportColumnBeanZ = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getZColumnId()); zColumnDBname = reportColumnBeanZ.getDbColumnName(); while (rsw.next()) { data = rsw.getString(xColumnDBname); zData = rsw.getString(zColumnDBname); datasetCustom.addValue(rsw.getLong(yColumnDBname), zData, data); count++; } } chart = ChartFactory.createLineChart("", // chart title "", // domain axis label "", // range axis label datasetCustom, // data PlotOrientation.VERTICAL, // orientation showLegend, // include legend true, // tooltips false // urls ); LegendTitle legendTitle = chart.getLegend(); if (legendTitle != null) legendTitle.setItemFont(new Font("Vandara", Font.BOLD, 11)); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); rangeAxis.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); rangeAxis.setTickLabelInsets(new RectangleInsets(0, 0, 0, 5)); rangeAxis.setTickLabelsVisible(true); rangeAxis.setTickMarksVisible(false); rangeAxis.setAxisLineVisible(false); CustomDomainAxis catAxis = new CustomDomainAxis(); CustomDomainAxis.counter = 0; CustomDomainAxis.colCount = datasetCustom.getColumnCount(); catAxis.setTickLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10)); catAxis.setTickMarksVisible(false); catAxis.setTickLabelInsets(new RectangleInsets(10, 15, 30, 10)); catAxis.setAxisLineVisible(false); catAxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(20 * Math.PI / 180)); plot.setDomainAxis(catAxis); final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.DARK_GRAY); if (count > 0) { Color[] colors = null; colors = new Color[5]; colors[0] = new Color(24, 112, 176); colors[1] = new Color(168, 192, 232); colors[2] = new Color(248, 120, 8); colors[3] = new Color(248, 184, 120); colors[4] = new Color(152, 216, 136); for (int i = 0; i < count && i < colors.length; i++) renderer.setSeriesPaint(i, colors[i]); } } catch (Exception e) { CyberoamLogger.appLog.debug("LineChart: " + e.getMessage(), e); } return chart; }
From source file:JVMSimulator.java
public void init() { setBackground(SimData.appletBackgroundColor); setLayout(new BorderLayout(5, 5)); threeParts = new ThreeParts(SimData.methodAreaMemorySectionSize); simulationController = new ControlPanel(); stepButton = simulationController.getStepButton(); resetButton = simulationController.getResetButton(); runButton = simulationController.getRunButton(); stopButton = simulationController.getStopButton(); ColoredLabel title = new ColoredLabel(SimData.appletTitle, Label.CENTER, SimData.titleColor); title.setFont(new Font("Helvetica", Font.BOLD, 12)); add("North", title); add("South", simulationController); add("Center", threeParts); // Get a reference to the UI objects that are actually manipulated by // the handlers of the Step and Reset buttons. These aren't available // without this explicit get() because these objects are buried several // levels down in embedded panels. stackMemoryView = threeParts.getStackMemoryViewReference(); methodAreaMemoryView = threeParts.getMethodAreaMemoryViewReference(); registers = threeParts.getRegisterPanel(); // Place the bytecodes into the method area for (int i = 0; i < SimData.methodAreaMemorySectionSize; ++i) { methodAreaMemorySection.setAtAddress(methodAreaBase + i, SimData.theProgram[i]); methodAreaMemorySection.setLogicalValueAtAddress(methodAreaBase + i, SimData.byteCodeMnemonics[i]); }//w ww . j a va 2s. c o m ResetState(); UpdateStateDisplay(); }
From source file:view.caja.Despacho.java
private void initGUI() { try {//from w w w .j a va2s. c om { panRoot = new JPanel(); getContentPane().add(panRoot, BorderLayout.CENTER); panRoot.setLayout(null); panRoot.setPreferredSize(new java.awt.Dimension(810, 498)); { scrollProds = getTablaProductos(); panRoot.add(scrollProds); scrollProds.setBounds(15, 106, 390, 287); } { lbTitulo = new JLabel(); panRoot.add(lbTitulo); lbTitulo.setText("LISTA DE PRODUCTOS :"); lbTitulo.setFont(new Font("Helvetica", Font.BOLD, 15)); lbTitulo.setBounds(15, 76, 243, 16); } { lbTituloCodigo = new JLabel(); panRoot.add(lbTituloCodigo); lbTituloCodigo.setText("Agregando Productos"); lbTituloCodigo.setFont(new Font("Helvetica", Font.BOLD, 15)); lbTituloCodigo.setBounds(572, 179, 168, 16); } { btAdd = new JButton(); panRoot.add(btAdd); btAdd.setBounds(529, 220, 57, 45); btAdd.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/add.png"))); btAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { agregarNuevoProductoParaVender(); } }); } { btQuitar = new JButton(); panRoot.add(btQuitar); btQuitar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/delete.png"))); btQuitar.setBounds(529, 270, 57, 48); btQuitar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { quitarFila(); } }); btQuitar.setEnabled(false); } { btRemoveAll = new JButton(); panRoot.add(btRemoveAll); btRemoveAll.setBounds(532, 324, 54, 54); btRemoveAll .setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/deleteAll.png"))); btRemoveAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { quitarTodo(); } }); btRemoveAll.setEnabled(false); } { lbTituloForm = new JLabel(); panRoot.add(lbTituloForm); lbTituloForm.setText("REALIZANDO VENTA"); lbTituloForm.setBounds(241, 20, 253, 44); lbTituloForm.setFont(new Font("Monospaced", Font.BOLD, 25)); } { jlblAniadir = new JLabel(); panRoot.add(jlblAniadir); jlblAniadir.setText("Aadir"); jlblAniadir.setFont(new Font("Helvetica", Font.BOLD, 13)); jlblAniadir.setBounds(592, 230, 68, 23); } { jlblQuitar = new JLabel(); panRoot.add(jlblQuitar); jlblQuitar.setText("Quitar"); jlblQuitar.setFont(new Font("Helvetica", Font.BOLD, 13)); jlblQuitar.setBounds(592, 281, 68, 16); } { jlblQuitarTodos = new JLabel(); panRoot.add(jlblQuitarTodos); jlblQuitarTodos.setText("Quitar Todos"); jlblQuitarTodos.setFont(new Font("Helvetica", Font.BOLD, 13)); jlblQuitarTodos.setBounds(592, 338, 88, 16); } { jbtnConfirmar = new JButton(); panRoot.add(jbtnConfirmar); jbtnConfirmar.setText(" Confirmar"); jbtnConfirmar .setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/acepted3.png"))); jbtnConfirmar.setBounds(85, 412, 167, 62); jbtnConfirmar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (contador != 0 && jtxtCampo.getText() != "" && jtxtnit.getText() != "") { cambio = aCobrar - Double.parseDouble(jspn.getValue().toString()); efectuar(); JOptionPane.showMessageDialog(null, "Se debe dar el cambio de " + cambio, "Alerta", 2); } else { JOptionPane.showMessageDialog(null, "Existen Campos Obligatorios para la venta", "Alerta", 2); } } public void efectuar() { FactoryFactura factFactura = new FactoryFactura(); int idFactura = 0; int idCliente = comprador.getId_Cliente(); int idUsuario = usuario.getIdusuario(); Factura fact = new Factura(); fact.setNit(comprador.getNit()); fact.setTotal(Float.parseFloat(Double.toString(aCobrar))); fact.setCambio(Float.parseFloat(cambio + "")); try { idFactura = factFactura.insertFactura(fact); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } FactoryVenta factVenta = new FactoryVenta(); Venta nuevaVenta = new Venta(); nuevaVenta.setFechaVenta(factVenta.getFechaHoy()); nuevaVenta.setHventa(factVenta.getHora()); nuevaVenta.setId_Cliente(idCliente); nuevaVenta.setId_factura(idFactura); nuevaVenta.setId_Usario(idUsuario); try { if (factVenta.insertVenta(nuevaVenta)) { } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } FactoryDetalleVenta factDVenta = new FactoryDetalleVenta(); for (int i = 0; i < tbCarrito.getRowCount(); i++) { int idprod = (Integer) tbCarrito.getValueAt(i, 5); int idventaMax = factVenta.getIdMaximo(); int cantidad = (Integer) tbCarrito.getValueAt(i, 4); try { factDVenta.insertDetalleVenta(idprod, idventaMax, cantidad); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } setVisible(false); JOptionPane.showMessageDialog(null, "La Venta se ha realizado exitosamente...", "Felicidades", 1); } }); } { jbtnCancelar = new JButton(); panRoot.add(jbtnCancelar); jbtnCancelar.setText(" Cancelar"); jbtnCancelar .setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/cancelShop.png"))); jbtnCancelar.setBounds(294, 413, 170, 60); jbtnCancelar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); } { jlblDatosCliente = new JLabel(); panRoot.add(jlblDatosCliente); jlblDatosCliente.setText("Datos de Cliente"); jlblDatosCliente.setFont(new Font("Helvetica", Font.BOLD, 15)); jlblDatosCliente.setBounds(580, 64, 126, 16); } { jlblNombre = new JLabel(); panRoot.add(jlblNombre); jlblNombre.setText("Nombre : "); jlblNombre.setBounds(545, 138, 69, 18); } { jtxtCampo = new JTextField(); panRoot.add(jtxtCampo); jtxtCampo.setBounds(603, 133, 137, 28); } { jtxtnit = new JTextField(); panRoot.add(jtxtnit); jtxtnit.setBounds(602, 92, 140, 28); jtxtnit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String cad = jtxtnit.getText(); comprador = clienteABuscar(cl, cad); jtxtCampo.setText(comprador.getNombreCliente()); jtxtCampo.setEditable(false); } }); TextAutoCompleter autoCompl = new TextAutoCompleter(jtxtnit); for (int i = 0; i < cl.size(); i++) { Cliente c = cl.get(i); autoCompl.addItem(c.getNit()); } autoCompl.setMode(0); } { jlblNit = new JLabel(); panRoot.add(jlblNit); jlblNit.setText("Nit o CI :"); jlblNit.setBounds(542, 99, 46, 16); } { jlblCantidad = new JLabel(); panRoot.add(jlblCantidad); jlblCantidad.setText("Cantidad :"); jlblCantidad.setFont(new Font("Helvetica", Font.BOLD, 15)); jlblCantidad.setBounds(424, 169, 79, 16); } { jlblCantMostrar = new JLabel(); panRoot.add(jlblCantMostrar); jlblCantMostrar.setBounds(435, 183, 68, 58); jlblCantMostrar.setText("0"); jlblCantMostrar.setFont(new Font("Monospaced", Font.BOLD, 35)); } { jlblACobrar = new JLabel(); panRoot.add(jlblACobrar); jlblACobrar.setText("A Cobrar :"); jlblACobrar.setFont(new Font("Helvetica", Font.BOLD, 15)); jlblACobrar.setBounds(424, 270, 79, 16); } { jlblACobrarMostrar = new JLabel(); panRoot.add(jlblACobrarMostrar); jlblACobrarMostrar.setBounds(430, 292, 68, 58); jlblACobrarMostrar.setText("0.0"); jlblACobrarMostrar.setFont(new Font("Monospaced", Font.BOLD, 29)); } { jlblPagado = new JLabel(); panRoot.add(jlblPagado); jlblPagado.setText("Monto con el que se pago Bs :"); jlblPagado.setBounds(532, 420, 168, 16); } { SpinnerNumberModel jSpinnerCantidadModel = new SpinnerNumberModel(0, 0, 1000, 1); jspn = new JSpinner(); panRoot.add(jspn); jspn.setModel(jSpinnerCantidadModel); jspn.setBounds(706, 414, 59, 28); } } pack(); } catch (Exception e) { e.printStackTrace(); } }
From source file:edu.ku.brc.specify.plugins.imgproc.ImageProcessorPanel.java
@Override public void paint(Graphics g) { ((Graphics2D) g).addRenderingHints(hints); super.paint(g); if (font == null) { font = (new JLabel()).getFont(); font = font.deriveFont(18.0f);/* www .j a v a 2s .co m*/ font = font.deriveFont(Font.BOLD); } String title = "Specify Image Processor"; g.setColor(new Color(32, 131, 155)); g.setFont(font); int w = g.getFontMetrics().stringWidth(title); int y = g.getFontMetrics().getHeight() - 5; int x = (getSize().width - w) / 2; g.drawString(title, x, y); }
From source file:it.cnr.istc.iloc.gui.TimelinesChart.java
@Override public void currentNode(Solver.Node n) { final CombinedDomainXYPlot combined_plot = new CombinedDomainXYPlot(new DateAxis("Time")); combined_plot.setGap(3.0);//from w ww.j a v a2 s. c om combined_plot.setOrientation(PlotOrientation.VERTICAL); Set<Type> c_types = new HashSet<>(); LinkedList<Type> queue = new LinkedList<>(); queue.addAll(solver.getTypes()); while (!queue.isEmpty()) { Type c_type = queue.pollFirst(); if (!c_types.contains(c_type)) { c_types.add(c_type); queue.addAll(c_type.getTypes()); } } for (Type type : c_types) { if (visualizers.containsKey(type.getClass())) { for (XYPlot plot : visualizers.get(type.getClass()).getPlots(type)) { TextTitle title = new TextTitle(type.name, new Font("SansSerif", Font.PLAIN, 11), Color.BLACK, RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, new RectangleInsets(4, 4, 4, 4)); XYTitleAnnotation titleAnn = new XYTitleAnnotation(0.01, 1, title, RectangleAnchor.TOP_LEFT); plot.addAnnotation(titleAnn); combined_plot.add(plot, 1); } } } setChart(new JFreeChart("", new Font("SansSerif", Font.BOLD, 14), combined_plot, false)); setBorder(BorderFactory.createEtchedBorder()); }
From source file:Main_Window.java
public Main_Window() { super("Google Places Application"); //First call Constructor of JFrame this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //We do not want our application to terminate when a JFrame is closed this.addWindowListener(new java.awt.event.WindowAdapter() { @Override// w w w .java 2 s .co m public void windowClosing(java.awt.event.WindowEvent windowEvent) { int Answer = JOptionPane.showConfirmDialog(null, "Exit Application ? ", "Exit ? ", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (Answer == JOptionPane.YES_OPTION) { if (POI_List.isEmpty()) { POI_List.clear(); } if (Distances_List.isEmpty()) { Distances_List.clear(); } if (Temp_List.isEmpty()) { Temp_List.clear(); } if (Distances_List_2.isEmpty()) { Distances_List_2.clear(); } System.exit(1); } else { setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); } } }); //The listener object created from that class is then registered with a Window using the window's addWindowListener method. // this.setSize(1100, 700); // Size of Window this.setLocationRelativeTo(null); // Display Window in center of Screen this.setVisible(true); this.getContentPane().setBackground(Color.LIGHT_GRAY); // //Initialization of J Components POIS_Label = new JLabel("Points of Interest:"); POIS_Label.setForeground(Color.black); POIS_Label.setFont(new Font("Courier New", Font.BOLD, 25)); POIS_Label.setBounds(600, 30, 350, 150); Retrieve_POIs_Button = new JButton("Retrieve POIs"); Retrieve_POIs_Button.setForeground(Color.black); Retrieve_POIs_Button.setFont(new Font("Courier New", Font.BOLD, 35)); Retrieve_POIs_Button.setBounds(25, 450, 350, 150); Open_Status = new JRadioButton(" Open Now?"); Open_Status.setForeground(Color.black); Open_Status.setBackground(Color.LIGHT_GRAY); Open_Status.setBounds(20, 380, 100, 30); Welcome_Label = new JLabel("Welcome to Google Places"); Welcome_Label.setForeground(Color.BLUE); Welcome_Label.setFont(new Font("Courier New", Font.BOLD, 35)); Welcome_Label.setBounds(240, 20, 600, 60); Latitude_Label = new JLabel("Latitude:"); Latitude_Label.setForeground(Color.BLACK); Latitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Latitude_Label.setBounds(15, 80, 200, 100); Longitude_Label = new JLabel("Longitude:"); Longitude_Label.setForeground(Color.BLACK); Longitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Longitude_Label.setBounds(15, 130, 250, 100); Radius_Label = new JLabel("Radius:"); Radius_Label.setForeground(Color.BLACK); Radius_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Radius_Label.setBounds(15, 180, 250, 100); Category_Label = new JLabel("Category:"); Category_Label.setForeground(Color.BLACK); Category_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Category_Label.setBounds(15, 250, 250, 100); Latitude_TextField = new JTextField(7); Latitude_TextField.setForeground(Color.BLACK); Latitude_TextField.setBounds(165, 116, 180, 30); Longitude_TextField = new JTextField(7); Longitude_TextField.setForeground(Color.BLACK); Longitude_TextField.setBounds(170, 168, 180, 30); Radius_TextField = new JTextField(7); Radius_TextField.setForeground(Color.BLACK); Radius_TextField.setBounds(125, 215, 180, 30); Categories = new JComboBox(Categories_Names); Categories.setForeground(Color.BLACK); Categories.setBackground(Color.white); Categories.setBounds(15, 320, 180, 30); POI_List = new ArrayList(); pane = getContentPane(); //Manager pane.setLayout(null); // Deactivate Manager Layout //JPANEL P = new JPanel(); P.setBackground(Color.GRAY); P.setBounds(600, 120, 450, 180); P.setBackground(Color.GRAY); pane.add(P); pane.add(POIS_Label); pane.add(Retrieve_POIs_Button); pane.add(Welcome_Label); pane.add(Longitude_Label); pane.add(Latitude_Label); pane.add(Radius_Label); pane.add(Category_Label); pane.add(Latitude_TextField); pane.add(Longitude_TextField); pane.add(Radius_TextField); pane.add(Categories); pane.add(Open_Status); Retrieve_POIs_Button.addActionListener(this); setContentPane(pane); }
From source file:org.bench4Q.console.ui.section.E_ErrorSection.java
private JPanel printErrorPic() throws IOException { CategoryDataset dataset = getDataSet(); JFreeChart chart = ChartFactory.createBarChart3D("Error", "Error type", "Error number", dataset, PlotOrientation.VERTICAL, true, true, true); CategoryPlot plot = chart.getCategoryPlot(); org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.1);//from w ww. j av a2 s . c o m domainAxis.setUpperMargin(0.1); domainAxis.setCategoryLabelPositionOffset(10); domainAxis.setCategoryMargin(0.2); domainAxis.setCategoryLabelPositionOffset(10); org.jfree.chart.axis.ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setUpperMargin(0.1); org.jfree.chart.renderer.category.BarRenderer3D renderer; renderer = new org.jfree.chart.renderer.category.BarRenderer3D(); renderer.setBaseOutlinePaint(Color.red); renderer.setSeriesPaint(0, new Color(0, 255, 255)); renderer.setSeriesOutlinePaint(0, Color.BLACK); renderer.setSeriesPaint(1, new Color(0, 255, 0)); renderer.setSeriesOutlinePaint(1, Color.red); renderer.setItemMargin(0.1); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setItemLabelFont(new Font("", Font.BOLD, 12)); renderer.setItemLabelPaint(Color.black); renderer.setItemLabelsVisible(true); plot.setRenderer(renderer); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setBackgroundPaint(Color.WHITE); return new ChartPanel(chart); }
From source file:com.xilinx.kintex7.PowerDial.java
public void createDial() { plot = new MeterPlot(); dset = new DefaultValueDataset(0); plot.setUnits("Watts"); plot.setRange(new Range(1, 10)); plot.addInterval(new MeterInterval("Acceptable", new Range(1.0, 6.0), Color.lightGray, new BasicStroke(2.0f), Color.GREEN)); plot.addInterval(new MeterInterval("Warning", new Range(6.0, 8.0), Color.lightGray, new BasicStroke(2.0f), Color.YELLOW));/*from w w w. java 2 s. c om*/ plot.addInterval(new MeterInterval("Dangerous", new Range(8.0, 10.0), Color.lightGray, new BasicStroke(2.0f), Color.RED)); //sets different marks for (int i = 0; i < 10; i += 1) { if (i == 0) plot.addInterval( new MeterInterval("", new Range(1, 1), Color.lightGray, new BasicStroke(2.0f), null)); else plot.addInterval( new MeterInterval("", new Range(i, i), Color.lightGray, new BasicStroke(2.0f), null)); } plot.setNeedlePaint(Color.darkGray); plot.setDialBackgroundPaint(Color.white); plot.setDialOutlinePaint(Color.gray); plot.setDialShape(DialShape.PIE); plot.setMeterAngle(180); plot.setTickLabelsVisible(true); plot.setTickLabelFont(new Font("Dialog", Font.BOLD, 10)); plot.setTickLabelPaint(Color.DARK_GRAY); plot.setTickSize(10.0); plot.setTickPaint(Color.lightGray); plot.setValuePaint(Color.BLACK); plot.setDataset(dset); LegendItemCollection legendItemsOld = plot.getLegendItems(); final LegendItemCollection legendItemsNew = new LegendItemCollection(); for (int i = 0; i < 3; i++) { LegendItem item = legendItemsOld.get(i); item.setLabelPaint(Color.WHITE); legendItemsNew.add(item); } LegendItemSource source = new LegendItemSource() { LegendItemCollection lic = new LegendItemCollection(); { lic.addAll(legendItemsNew); } @Override public LegendItemCollection getLegendItems() { return lic; } }; chart = new JFreeChart(plot); chart.addLegend(new LegendTitle(source)); chart.removeLegend(); chart.setTitle(""); //chart.setBackgroundPaint(new GradientPaint(0,0,new Color(139,137,137),0,height,Color.BLUE )); // chart.getTitle().setPaint(Color.white); plot.setValueFont(new Font("Dialog", Font.BOLD, 14)); //chartpanel = new ChartPanel(chart); }
From source file:edu.ku.brc.ui.skin.SkinItem.java
/** * Constructs the font or return null./*from w w w. jav a2 s. c om*/ * @return return the font or null */ public Font getFont() { if (font == null && StringUtils.isNotEmpty(fontName) && fontSize > 0) { int style = Font.PLAIN; if (StringUtils.isNotEmpty(fontStyle)) { if (fontStyle.equalsIgnoreCase("plain")) { style = Font.PLAIN; } else if (fontStyle.equalsIgnoreCase("bold")) { style = Font.BOLD; } else if (fontStyle.equalsIgnoreCase("italic")) { style = Font.ITALIC; } else if (fontStyle.equalsIgnoreCase("bolditalic")) { style = Font.BOLD | Font.ITALIC; } } font = new Font(fontName, style, fontSize); } return font; }
From source file:com.controlj.addon.gwttree.server.GraphServlet.java
/**<!====== getChart ======================================================> Generates the chart. Note that most of these options are not required for a simple chart, but we wanted to try to get a particular look that matched another charting package, so we went to some trouble to set a lot of non-standard options. In particular, the OpaqueBarRenderer3D is a non-standard renderer that gives much better looking 3D bars. <!=======================================================================>*/ private static JFreeChart getChart(DefaultCategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D("Integration Over Time", "24 Hour Period", "", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.black); chart.getTitle().setPaint(Color.white); chart.getTitle().setFont(new Font("Verdana", Font.BOLD, 20)); chart.setAntiAlias(true);//w w w . ja v a2 s .c o m chart.setTextAntiAlias(true); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setForegroundAlpha(1); OpaqueBarRenderer3D renderer = new OpaqueBarRenderer3D(); renderer.setItemMargin(0.1); plot.setRenderer(renderer); renderer.setSeriesPaint(0, new Color(116, 225, 118)); renderer.setSeriesPaint(1, new Color(245, 107, 107)); renderer.setSeriesPaint(2, new Color(250, 187, 107)); renderer.setSeriesPaint(3, new Color(72, 72, 238)); renderer.setSeriesPaint(4, new Color(184, 32, 157)); renderer.setDrawBarOutline(false); Font small = new Font("Verdana", Font.PLAIN, 12); Font big = new Font("Verdana", Font.BOLD, 14); renderer.setItemLabelPaint(Color.white); plot.getDomainAxis().setTickLabelPaint(Color.white); plot.getDomainAxis().setTickLabelFont(small); plot.getDomainAxis().setLabelPaint(Color.white); plot.getDomainAxis().setLabelFont(big); plot.getDomainAxis().setCategoryMargin(0.2); plot.getRangeAxis().setTickLabelPaint(Color.white); plot.getRangeAxis().setTickLabelFont(small); plot.getRangeAxis().setLabelPaint(Color.white); plot.getRangeAxis().setLabelFont(big); plot.setBackgroundPaint(Color.black); chart.getLegend().setBackgroundPaint(Color.black); chart.getLegend().setItemPaint(Color.white); chart.getLegend().setItemFont(big); return chart; }