List of usage examples for java.awt Font Font
private Font(String name, int style, float sizePts)
From source file:com.romraider.logger.ecu.ui.handler.dash.SmallDialGaugeStyle.java
protected JFreeChart buildChart() { DialPlot plot = new DialPlot(); plot.setView(0.0, 0.0, 1.0, 1.0);// www . j a v a 2 s.c o m plot.setDataset(0, current); plot.setDataset(1, max); plot.setDataset(2, min); DialFrame dialFrame = new StandardDialFrame(); plot.setDialFrame(dialFrame); GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(170, 170, 220)); DialBackground db = new DialBackground(gp); db.setGradientPaintTransformer(new StandardGradientPaintTransformer(VERTICAL)); plot.setBackground(db); unitsLabel.setFont(new Font(Font.DIALOG, BOLD, 14)); unitsLabel.setRadius(0.7); unitsLabel.setLabel(loggerData.getSelectedConvertor().getUnits()); plot.addLayer(unitsLabel); DecimalFormat format = new DecimalFormat(loggerData.getSelectedConvertor().getFormat()); DialValueIndicator dvi = new DialValueIndicator(0); dvi.setNumberFormat(format); plot.addLayer(dvi); EcuDataConvertor convertor = loggerData.getSelectedConvertor(); GaugeMinMax minMax = convertor.getGaugeMinMax(); StandardDialScale scale = new StandardDialScale(minMax.min, minMax.max, 225.0, -270.0, minMax.step, 5); scale.setTickRadius(0.88); scale.setTickLabelOffset(0.15); scale.setTickLabelFont(new Font(Font.DIALOG, PLAIN, 12)); scale.setTickLabelFormatter(format); plot.addScale(0, scale); plot.addScale(1, scale); plot.addScale(2, scale); StandardDialRange range = new StandardDialRange(rangeLimit(minMax, 0.75), minMax.max, RED); range.setInnerRadius(0.52); range.setOuterRadius(0.55); plot.addLayer(range); StandardDialRange range2 = new StandardDialRange(rangeLimit(minMax, 0.5), rangeLimit(minMax, 0.75), ORANGE); range2.setInnerRadius(0.52); range2.setOuterRadius(0.55); plot.addLayer(range2); StandardDialRange range3 = new StandardDialRange(minMax.min, rangeLimit(minMax, 0.5), GREEN); range3.setInnerRadius(0.52); range3.setOuterRadius(0.55); plot.addLayer(range3); DialPointer needleCurrent = new DialPointer.Pointer(0); plot.addLayer(needleCurrent); DialPointer needleMax = new DialPointer.Pin(1); needleMax.setRadius(0.84); ((DialPointer.Pin) needleMax).setPaint(RED); ((DialPointer.Pin) needleMax).setStroke(new BasicStroke(1.5F)); plot.addLayer(needleMax); DialPointer needleMin = new DialPointer.Pin(2); needleMin.setRadius(0.84); ((DialPointer.Pin) needleMin).setPaint(BLUE); ((DialPointer.Pin) needleMin).setStroke(new BasicStroke(1.5F)); plot.addLayer(needleMin); DialCap cap = new DialCap(); cap.setRadius(0.10); plot.setCap(cap); JFreeChart chart = new JFreeChart(plot); chart.setTitle(loggerData.getName()); return chart; }
From source file:unalcol.termites.boxplots.RoundNumberGlobal.java
/** * Creates a new demo.// w w w. jav a 2s . c o m * * @param title the frame title. * @param pf */ public RoundNumberGlobal(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); //final NumberAxis yAxis = new NumberAxis("Round number"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 16); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Round Number" + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("roundGlobalNumber" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:org.cyberoam.iview.charts.Thermometer.java
/** * This method generates JFreeChart instance for Thermometer chart with iView customization. * @param reportID//from w w w. j a va2 s . com * @param rsw * @param request * @return */ public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; ReportColumnBean reportColumnBean = null; GraphBean graphBean = null; try { DefaultValueDataset dataset = null; graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId()); reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBean.getDbColumnName(); rsw.first(); double used = Double.parseDouble(rsw.getString(yColumnDBname)); rsw.next(); double free = Double.parseDouble(rsw.getString(yColumnDBname)); dataset = new DefaultValueDataset((100 * used) / (used + free)); ThermometerPlot plot = new ThermometerPlot(dataset); chart = new JFreeChart("", // chart title JFreeChart.DEFAULT_TITLE_FONT, plot, // plot false); // include legend chart.setBackgroundPaint(Color.white); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setThermometerPaint(Color.DARK_GRAY); plot.setBulbRadius(30); plot.setColumnRadius(15); plot.setUnits(ThermometerPlot.UNITS_NONE); plot.setMercuryPaint(Color.WHITE); plot.setValueFont(new Font("Vandara", Font.CENTER_BASELINE, 12)); plot.setBackgroundPaint(Color.white); plot.setBackgroundAlpha(0.0f); plot.setOutlineVisible(false); plot.setSubrangeInfo(0, 0, 50); plot.setSubrangeInfo(1, 50, 85); plot.setSubrangeInfo(2, 85, 100); plot.setSubrangePaint(0, new Color(75, 200, 85)); plot.setSubrangePaint(1, new Color(254, 211, 41)); plot.setSubrangePaint(2, new Color(255, 85, 85)); } catch (Exception e) { CyberoamLogger.appLog.debug("Thermometer=>getChart.exception : " + e, e); } return chart; }
From source file:de.hs.mannheim.modUro.controller.diagram.BoxAndWhiskerPlotController.java
/** * Plots Data for Chart//from ww w .j av a2 s . c om */ private void boxWhiskerPlot() { BoxAndWhiskerCategoryDataset dataset = createDataset(); CategoryAxis xAxis = new CategoryAxis("Model"); NumberAxis yAxis = new NumberAxis("Fitness"); yAxis.setRange(0.0, 1.0); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setMaximumBarWidth(0.2); renderer.setItemMargin(0.5); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.HORIZONTAL); final JFreeChart chart = new JFreeChart("Model comparison", new Font("Palatino", Font.BOLD, 14), plot, true); chart.removeLegend(); ChartViewer viewer = new ChartViewer(chart, this); boxWhiskerPane.setCenter(viewer); }
From source file:BenchmarkApplet.java
public void init() { tgroup = Thread.currentThread().getThreadGroup(); Font font = new Font("Courier", Font.PLAIN, 10); FontMetrics fm = getFontMetrics(font); int lines = Math.max(10, size().height / fm.getHeight() - 4); out = new TextArea(lines, spaces.length() + Benchmark.resolutionName.length()); out.setFont(font);//from w w w . j a v a2 s . c o m out.setEditable(false); add(out); boolean toobig; do { testList = new List(--lines, true); add(testList, 0); validate(); if (toobig = testList.size().height - out.size().height > 2) remove(testList); } while (toobig); for (int ii = 0; ii < tests.length; ii++) testList.addItem(tests[ii].getName()); testList.select(0); // Calibration benchmark testList.select(1); // Mixed benchmark timeEstimate = new Label(getTimeEstimate()); add(timeEstimate); add(doit = new Button("Run Benchmark")); add(abort = new Button("Stop")); add(clear = new Button("Clear")); abort.disable(); clear.disable(); add(console = new Checkbox("Console")); validate(); }
From source file:unalcol.termites.boxplots.MessagesSent1.java
/** * Creates a new demo./*from w w w .j a v a 2 s.c om*/ * * @param title the frame title. * @param pf */ public MessagesSent1(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); //final NumberAxis yAxis = new NumberAxis("Messages Sent"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 16); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Messages Sent " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("messagesnumber1" + pf + mazeMode + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:bestdeal.gui.Statistique.java
/** * Creates new form Statistique//from w w w . j a v a 2 s .co m */ @SuppressWarnings("empty-statement") public Statistique() { initComponents(); btn_retour.setIcon((Icon) new ImageIcon("C:\\Users\\Jedidi\\Desktop\\icone\\retour.png")); panel = new ImagePanel(new ImageIcon("C:\\Users\\Jedidi\\Desktop\\111.jpg").getImage()); Panel.add(panel); lbl_log.setIcon((Icon) new ImageIcon("C:\\Users\\Jedidi\\Desktop\\Logo_.png")); SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy"); lbl_date1.setText(sdf1.format(new java.util.Date())); SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss"); lbl_heure.setText(sdf2.format(new java.util.Date())); final DefaultPieDataset objDataset = new DefaultPieDataset(); VoucherDAO v2 = new VoucherDAO(); String[][] stat = v2.StatDeal(); objDataset.setValue(stat[0][0], Integer.parseInt(stat[9][0])); objDataset.setValue(stat[0][1], Integer.parseInt(stat[9][1])); objDataset.setValue(stat[0][2], Integer.parseInt(stat[9][2])); objDataset.setValue(stat[0][3], Integer.parseInt(stat[9][3])); objDataset.setValue(stat[0][4], Integer.parseInt(stat[9][4])); JFreeChart objChart = ChartFactory.createPieChart3D("Best 5 deals", objDataset, true, true, true); //String textTitle = "Best 5 deals"; TextTitle textTitle = objChart.getTitle(); textTitle.setFont(new Font("Arial", Font.BOLD, 15)); panel_deals.setLayout(new java.awt.BorderLayout()); panel_clients.setLayout(new java.awt.BorderLayout()); panel_vendeurs.setLayout(new java.awt.BorderLayout()); final ChartPanel CP = new ChartPanel(objChart); CP.setPreferredSize(new java.awt.Dimension(600, 500)); panel_deals.add(CP, BorderLayout.WEST); panel_deals.validate(); TabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (TabbedPane.getSelectedIndex() == 0) { objDataset.clear(); VoucherDAO v2 = new VoucherDAO(); String[][] stat = v2.StatDeal(); objDataset.setValue(stat[0][0], Integer.parseInt(stat[9][0])); objDataset.setValue(stat[0][1], Integer.parseInt(stat[9][1])); objDataset.setValue(stat[0][2], Integer.parseInt(stat[9][2])); objDataset.setValue(stat[0][3], Integer.parseInt(stat[9][3])); objDataset.setValue(stat[0][4], Integer.parseInt(stat[9][4])); panel_deals.add(CP, BorderLayout.WEST); panel_deals.validate(); } else if (TabbedPane.getSelectedIndex() == 1) { objDataset.clear(); VoucherDAO v2 = new VoucherDAO(); String[][] stat = v2.StatVendeur(); objDataset.setValue(stat[1][0], Integer.parseInt(stat[7][0])); objDataset.setValue(stat[1][1], Integer.parseInt(stat[7][1])); objDataset.setValue(stat[1][2], Integer.parseInt(stat[7][2])); objDataset.setValue(stat[1][3], Integer.parseInt(stat[7][3])); objDataset.setValue(stat[1][4], Integer.parseInt(stat[7][4])); panel_vendeurs.add(CP, BorderLayout.WEST); panel_vendeurs.validate(); } else if (TabbedPane.getSelectedIndex() == 2) { objDataset.clear(); VoucherDAO v2 = new VoucherDAO(); String[][] stat = v2.StatClient(); objDataset.setValue(stat[1][0], Integer.parseInt(stat[4][0])); objDataset.setValue(stat[1][1], Integer.parseInt(stat[4][1])); objDataset.setValue(stat[1][2], Integer.parseInt(stat[4][2])); objDataset.setValue(stat[1][3], Integer.parseInt(stat[4][3])); objDataset.setValue(stat[1][4], Integer.parseInt(stat[4][4])); panel_clients.add(CP, BorderLayout.WEST); panel_clients.validate(); } else if (TabbedPane.getSelectedIndex() == 3) { } } }); }
From source file:FormularioGuardarEstudio.java
@SuppressWarnings({ "unchecked", "rawtypes" }) private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - verdura henrion label1 = new JLabel(); pacientesCombo = new JComboBox(obtenerPacientes().toArray()); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(); nombreEstudio = new JTextField(); scrollPane1 = new JScrollPane(); descripcion = new JTextArea(); descripcion.setLineWrap(true);/*from w ww .ja v a2s . co m*/ descripcion.setWrapStyleWord(true); notas = new JTextArea(); notas.setLineWrap(true); notas.setWrapStyleWord(true); button1 = new JButton(); mensajeRespuesta = new JLabel(); //======== this ======== setTitle("Guardar Estudio"); Container contentPane = getContentPane(); //---- label1 ---- label1.setText("Paciente:"); label1.setFont(new Font("Calibri", Font.BOLD, 14)); //---- label2 ---- label2.setText("Datos del Estudio"); label2.setFont(new Font("Calibri", Font.BOLD, 14)); //---- label3 ---- label3.setText("Nombre Del Estudio:"); //---- label4 ---- label4.setText("Descripci\u00f3n:"); //---- label5 ---- label5.setText("Notas:"); //======== scrollPane1 ======== { scrollPane1.setViewportView(descripcion); } //---- button1 ---- button1.setText("Guardar Estudio"); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clickGuardarEstudio(e); } }); //---- mensajeRespuesta ---- mensajeRespuesta.setText("_"); mensajeRespuesta.setHorizontalAlignment(SwingConstants.CENTER); GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup() .addGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout.createSequentialGroup() .addContainerGap().addGroup(contentPaneLayout.createParallelGroup().addComponent(label4) .addComponent(label1, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE) .addComponent( pacientesCombo, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE) .addComponent(label2) .addGroup(contentPaneLayout.createSequentialGroup().addComponent(label3) .addGap(18, 18, 18).addComponent(nombreEstudio, GroupLayout.PREFERRED_SIZE, 140, GroupLayout.PREFERRED_SIZE)) .addGroup(contentPaneLayout.createSequentialGroup().addComponent(label5) .addGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup().addGap(83, 83, 83) .addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) .addComponent(notas, GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))) .addGroup(contentPaneLayout.createSequentialGroup() .addGap(48, 48, 48).addComponent(mensajeRespuesta, GroupLayout.PREFERRED_SIZE, 215, GroupLayout.PREFERRED_SIZE)))))) .addGroup(contentPaneLayout.createSequentialGroup().addGap(142, 142, 142) .addComponent(button1))) .addContainerGap(18, Short.MAX_VALUE))); contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(label1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(pacientesCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(label2).addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label3).addComponent(nombreEstudio, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup().addComponent(label4).addComponent( scrollPane1, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11) .addGroup(contentPaneLayout.createParallelGroup().addComponent(label5).addComponent(notas, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(mensajeRespuesta, GroupLayout.DEFAULT_SIZE, 17, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button1) .addContainerGap())); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:Interface.FoodCollectionSupervisor.FoodCollectionWorkArea.java
public FoodCollectionWorkArea(JPanel userProcessContainer, UserAccount account) { initComponents();/*from ww w . ja v a 2 s . co m*/ this.userProcessContainer = userProcessContainer; this.account = account; community = account.getEmployee().getCommunityAssociated(); empSupervisor = (FoodCollectionSupervisorEmployee) account.getEmployee(); organization = (FoodCollectionOrganization) community.getFoodCollectionOrg(); populateNewRequestTable(); populateAssignedRequestTable(); populateCompletedRequestTable(); populateCombobox(); populateDriverUseraccount(); lbErrlEmpName.setVisible(false); lblErrAddress.setVisible(false); lblPassword.setVisible(false); lblUsername.setVisible(false); jScrollPane6.setVisible(false); tblNewRequest.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18)); tblAssignedRequests.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18)); tblCompletedRequests.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18)); tblDriverUserAccount.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18)); }
From source file:edu.ucla.stat.SOCR.chart.demo.PieChartDemo3.java
/** * Creates a demo chart./*from ww w .j av a2 s . c o m*/ * * @param dataset the dataset. * * @return A chart. */ protected JFreeChart createChart(PieDataset dataset) { dataset = null; JFreeChart chart = ChartFactory.createPieChart(chartTitle, // chart title dataset, // data !legendPanelOn, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setNoDataMessage("No data available so we go into this really " + "long spiel about what that means and it runs off the end of the " + "line but what can you do about that!"); plot.setNoDataMessageFont(new Font("Serif", Font.ITALIC, 10)); plot.setNoDataMessagePaint(Color.red); for (int i = 0; i < pulloutFlag.length; i++) { //System.out.println("\""+pulloutFlag[i]+"\""); if (isPullout(i)) { Comparable key = dataset.getKey(i); plot.setExplodePercent(key, 0.30); } } if (rotateOn) { Rotator rotator = new Rotator(plot); rotator.start(); } setCategorySummary(dataset); return chart; }