List of usage examples for java.awt Font ITALIC
int ITALIC
To view the source code for java.awt Font ITALIC.
Click Source Link
From source file:org.jfree.chart.demo.DifferenceChartDemo2.java
/** * Creates a chart.// w ww . j a v a2s .c om * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Daylight Hours - London, UK", "Date", "Time", dataset, true, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); final XYDifferenceRenderer renderer = new XYDifferenceRenderer(Color.blue, Color.blue, false); renderer.setStroke(new BasicStroke(2.0f)); renderer.setSeriesPaint(0, Color.yellow); renderer.setSeriesPaint(1, Color.red); final XYPlot plot = chart.getXYPlot(); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); final DateAxis domainAxis = new DateAxis("Time"); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot.setDomainAxis(domainAxis); plot.setForegroundAlpha(0.5f); final Color c = new Color(255, 60, 24, 63); final Marker bst = new IntervalMarker(new Day(28, 3, 2004).getFirstMillisecond(), new Day(30, 10, 2004).getFirstMillisecond(), c, new BasicStroke(2.0f), null, null, 1.0f); bst.setLabel("British Summer Time"); bst.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT); bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, 10)); bst.setLabelTextAnchor(TextAnchor.BASELINE_RIGHT); plot.addDomainMarker(bst, Layer.BACKGROUND); final DateAxis rangeAxis = new DateAxis("Time"); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); plot.setRangeAxis(rangeAxis); return chart; }
From source file:JVMSimulator.java
MemoryView(int methodAreaMemSectionSize) { int[] hComponentCellWidths = new int[4]; hComponentCellWidths[0] = 2;/*from w w w . ja v a 2 s. com*/ hComponentCellWidths[1] = 2; hComponentCellWidths[2] = 2; hComponentCellWidths[3] = 3; setLayout(new GridSnapLayout(memoryLocationsVisibleCount, 9, hComponentCellWidths)); setBackground(Color.lightGray); Font plainFont = new Font("TimesRoman", Font.PLAIN, 11); setFont(plainFont); Font italicFont = new Font("TimesRoman", Font.ITALIC, 11); for (int i = 0; i < memoryLocationsVisibleCount; ++i) { pointer[i] = new Label("", Label.RIGHT); pointer[i].setFont(italicFont); add(pointer[i]); address[i] = new Label("", Label.CENTER); add(address[i]); byteValue[i] = new Label("", Label.CENTER); add(byteValue[i]); logicalValue[i] = new Label("", Label.LEFT); add(logicalValue[i]); } }
From source file:CircleOfSquares.java
StackMemoryViewTitlePanel() { // setLayout(new GridLayout(1, 4)); int[] hComponentCellWidths = new int[4]; hComponentCellWidths[0] = 2;/*from ww w. java2 s . c o m*/ hComponentCellWidths[1] = 2; hComponentCellWidths[2] = 2; hComponentCellWidths[3] = 3; setLayout(new GridSnapLayout(1, 9, hComponentCellWidths)); setFont(new Font("Helvetica", Font.ITALIC, 11)); add(new Label("", Label.CENTER)); add(new Label(StringTable.address, Label.CENTER)); add(new Label(StringTable.hexValue, Label.CENTER)); add(new Label(StringTable.value, Label.CENTER)); }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
protected Element createText(String text) { // #232718 to support bidi boolean bRtl = false; if (text.length() > 0) { int iEnd = text.length(); if (chPDF == text.charAt(text.length() - 1)) { iEnd--;/* w w w.j a v a 2 s. com*/ } if (chRLE == text.charAt(0)) { bRtl = true; text = text.substring(1, iEnd); } } Element elem = dom.createElement("text"); //$NON-NLS-1$ elem.appendChild(dom.createTextNode(text)); switch (getFont().getStyle()) { case Font.BOLD: elem.setAttribute("font-weight", "bold"); //$NON-NLS-1$ //$NON-NLS-2$ break; case Font.ITALIC: elem.setAttribute("font-style", "italic"); //$NON-NLS-1$ //$NON-NLS-2$ break; case (Font.BOLD + Font.ITALIC): elem.setAttribute("font-style", "italic"); //$NON-NLS-1$ //$NON-NLS-2$ elem.setAttribute("font-weight", "bold"); //$NON-NLS-1$ //$NON-NLS-2$ break; } String textDecorator = null; Map<TextAttribute, ?> attributes = getFont().getAttributes(); if (attributes.get(TextAttribute.UNDERLINE) == TextAttribute.UNDERLINE_ON) { textDecorator = "underline"; //$NON-NLS-1$ } if (attributes.get(TextAttribute.STRIKETHROUGH) == TextAttribute.STRIKETHROUGH_ON) { if (textDecorator == null) textDecorator = "line-through"; //$NON-NLS-1$ else textDecorator += ",line-through"; //$NON-NLS-1$ } if (textDecorator != null) elem.setAttribute("text-decoration", textDecorator); //$NON-NLS-1$ // for now just preserve space for text elements Bug 182159 elem.setAttribute("xml:space", "preserve"); //$NON-NLS-1$ //$NON-NLS-2$ elem.setAttribute("stroke", "none"); //$NON-NLS-1$ //$NON-NLS-2$ // Here we still use Font.getName() as font-family for SVG instead of // Font.getFaimly(), since if current code is running on linux and there // isn't a valid font family to fit the font setting in chart model, // the call of Font.getFamily() will get a default 'Dialog' font family, // it will caused that the svg in client system can't correct display // mulitple-characters text(Chinese, Jpanese and so on). // We just need to set the original font family setting of chart model // into svg document, if the font family is valid in client system // and can support current text character, it will correct display. elem.setAttribute("font-family", getFont().getName()); //$NON-NLS-1$ elem.setAttribute("font-size", Integer.toString(getFont().getSize())); //$NON-NLS-1$ String style = getRenderingStyle(RenderingHints.KEY_TEXT_ANTIALIASING); if (color != null) { String alpha = alphaToString(color); if (alpha != null) style += "fill-opacity:" + alpha + ";"; //$NON-NLS-1$ //$NON-NLS-2$ style += "fill:" + serializeToString(color) + ";"; //$NON-NLS-1$ //$NON-NLS-2$ } if (bRtl) { style += sStyleBidi; } elem.setAttribute("style", style); //$NON-NLS-1$ if (transforms.getType() != AffineTransform.TYPE_IDENTITY) { double[] matrix = new double[6]; transforms.getMatrix(matrix); elem.setAttribute("transform", "matrix(" + toString(matrix, ',') + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return elem; }
From source file:JVMSimulator.java
MemoryViewTitlePanel() { int[] hComponentCellWidths = new int[4]; hComponentCellWidths[0] = 2;//from ww w . ja v a 2s. co m hComponentCellWidths[1] = 2; hComponentCellWidths[2] = 2; hComponentCellWidths[3] = 3; setLayout(new GridSnapLayout(1, 9, hComponentCellWidths)); setFont(new Font("Helvetica", Font.ITALIC, 11)); add(new Label("", Label.CENTER)); add(new Label(StringTable.address, Label.CENTER)); add(new Label(StringTable.bytecodes, Label.CENTER)); add(new Label(StringTable.mnemonics, Label.LEFT)); }
From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java
public Font getFont(String fontName, boolean fontBold, boolean fontItalic, int fontSize) { int fontStyle = Font.PLAIN; if (fontBold) fontStyle += Font.BOLD;// w w w . ja v a2s . c o m if (fontItalic) fontStyle += Font.ITALIC; return new Font(getFontName(fontName), fontStyle, fontSize); }
From source file:skoa.helpers.Graficos.java
/********************************************************************************************************* * FUNCIONES PARA CREAR LOS GRFICOS DE LA CONSULTA C! MANIPULANDO LOS DATOS OBTENIDOS DE LAS CONSULTAS.* *********************************************************************************************************/ private void maxMinMed() { //En este tipo de consultas, sacamos la DG del fichero original de datos, para ponerla en la graf. String dg = nombresFicheros.get(0); //dg=dg.substring(dg.indexOf("-")+7,dg.indexOf(".txt")); //Saca la DG del nombre del fich. if (dg.indexOf("D") > 0 && dg.indexOf(" ") < 0) { //Si es el resultado final de una consulta D. dg = dg.substring(dg.indexOf(".txt") - 13, dg.indexOf(".txt")); //Saca la DG del nombre del fich. } else { //Si son resultados de una consulta D. //As, buscando a partir de .txt da igual el tipo de consulta que sea, que se saca igual. dg = dg.substring(dg.indexOf(" ") - 6, dg.indexOf(".txt")); //Saca la DG del nombre del fich. }/*from w w w. j a v a 2 s . com*/ //--------------------------------------------- crearEstadisticas(); //Crea el fichero estadisticas.txt donde se encuentra el FECHA MAX MIN y MED en este orden Vector<String> vectorOrdenUnidades = new Vector<String>(); vectorOrdenUnidades.add(unidad); nombresDGs.add("Max"); //Reusamos esta variable. Nos referimos al nombre de cada una de las barras que se ven. nombresDGs.add("Min"); nombresDGs.add("Med"); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset = obtenerSerieBarras2(vectorOrdenUnidades); String unidad = ""; for (int i = 0; i < vectorOrdenUnidades.size(); i++) unidad = unidad + vectorOrdenUnidades.elementAt(i) + ", "; unidad = unidad.substring(0, unidad.length() - 2); //Quita el ultimo espacio y la ultima coma. if (unidad.indexOf("C") >= 0) unidad = "C"; dg = dg.replaceAll("-", "/"); JFreeChart grafica = ChartFactory.createBarChart("Valores medidos de las direcciones de grupo", "Fechas", //titulo eje x "Mediciones (" + unidad + ") de " + dg, dataset, PlotOrientation.VERTICAL, true, //leyenda true, false); if (fechaInicial.equals("") & fechaFinal.equals("")) { //Si estn vacas es porque no hay resultados para ese intervalo. fechaInicial = " ? "; fechaFinal = " ? "; } TextTitle t = new TextTitle("desde " + fechaInicial + " hasta " + fechaFinal, new Font("SanSerif", Font.ITALIC, 12)); grafica.addSubtitle(t); CategoryPlot plot = grafica.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); domainAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 9)); //Letra de las fechas ms pequea //Esconder las sombras de las barras del barchart. CategoryPlot categoryPlot = (CategoryPlot) grafica.getPlot(); BarRenderer renderer = new BarRenderer(); renderer.setShadowVisible(false); categoryPlot.setRenderer(renderer); //------------------------------------------------- try { ChartUtilities.saveChartAsJPEG(new File(ruta + "MaxMinMedSmall.jpg"), grafica, 400, 300); ChartUtilities.saveChartAsJPEG(new File(ruta + "MaxMinMedBig.jpg"), grafica, 900, 600); } catch (IOException e) { System.err.println("Problem occurred creating chart." + e); } }
From source file:org.scify.talkandplay.gui.users.UserFormPanel.java
private void setUI() { ButtonGroup scanButtons = new ButtonGroup(); scanButtons.add(autoScanRadioButton); scanButtons.add(manualScanRadioButton); //set the titles of the form nameLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); imageLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); sensorLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); rotationSpeedLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); defaultGridSizeLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); tilesLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); nameTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.GRAY)); nameTextField.setFont(new Font(UIConstants.mainFont, Font.ITALIC, 14)); nameTextField.setHorizontalAlignment(JTextField.CENTER); uploadImageLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); rowsTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.GRAY)); rowsTextField.setHorizontalAlignment(JTextField.CENTER); columnsTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.GRAY)); columnsTextField.setHorizontalAlignment(JTextField.CENTER); disableTextField(selectionSensorTextField2); disableTextField(navigationSensorTextField); enableTextField(selectionSensorTextField1); //set the text color selectionSensorTextField1.setForeground(Color.decode(UIConstants.green)); selectionSensorTextField2.setForeground(Color.decode(UIConstants.green)); navigationSensorTextField.setForeground(Color.decode(UIConstants.green)); selectionSensorTextField1.setHorizontalAlignment(JTextField.CENTER); selectionSensorTextField2.setHorizontalAlignment(JTextField.CENTER); navigationSensorTextField.setHorizontalAlignment(JTextField.CENTER); step6ExplTextArea.setEditable(false); step6ExplTextArea.setLineWrap(true); step6ExplTextArea.setWrapStyleWord(true); step6ExplTextArea.setBorder(javax.swing.BorderFactory.createEmptyBorder()); jScrollPane1.setBorder(null);/* w ww. j a va 2 s . c o m*/ imageCheckBox.setSelected(true); imageCheckBox.setVisible(false); }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.graphics.internal.LogicalPageDrawable.java
protected void configureGraphics(final StyleSheet layoutContext, final Graphics2D g2) { final boolean bold = layoutContext.getBooleanStyleProperty(TextStyleKeys.BOLD); final boolean italics = layoutContext.getBooleanStyleProperty(TextStyleKeys.ITALIC); int style = Font.PLAIN; if (bold) {/*from w ww.ja v a 2 s . c om*/ style |= Font.BOLD; } if (italics) { style |= Font.ITALIC; } final Color cssColor = (Color) layoutContext.getStyleProperty(ElementStyleKeys.PAINT); g2.setColor(cssColor); final int fontSize = layoutContext.getIntStyleProperty(TextStyleKeys.FONTSIZE, (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEFAULT_FONT_SIZE)); final String fontName = metaData .getNormalizedFontFamilyName((String) layoutContext.getStyleProperty(TextStyleKeys.FONT)); g2.setFont(new Font(fontName, style, fontSize)); }
From source file:com.planetmayo.debrief.satc_rcp.views.MaintainContributionsView.java
protected void redoOwnshipStates() { if (legPlot == null) return;// w w w. ja va 2 s . com boolean showCourses = true; if (showOSCourse != null) showCourses = showOSCourse.getSelection(); java.awt.Color courseCol = java.awt.Color.blue.darker().darker(); java.awt.Color speedCol = java.awt.Color.blue.brighter().brighter(); // ok, now loop through and set them long startTime = Long.MAX_VALUE; long endTime = Long.MIN_VALUE; // clear any datasets legPlot.setDataset(0, null); legPlot.setDataset(1, null); // hmm, actually we have to remove any target leg markers @SuppressWarnings("unchecked") Collection<IntervalMarker> markers = legPlot.getDomainMarkers(Layer.BACKGROUND); if (markers != null) { ArrayList<IntervalMarker> markersToDelete = new ArrayList<IntervalMarker>(markers); Iterator<IntervalMarker> mIter = markersToDelete.iterator(); while (mIter.hasNext()) { IntervalMarker im = mIter.next(); legPlot.removeDomainMarker(im); } } // hey, does it have any ownship legs? TimeSeriesCollection tscC = new TimeSeriesCollection(); TimeSeriesCollection tscS = new TimeSeriesCollection(); TimeSeriesCollection tscCLegs = new TimeSeriesCollection(); TimeSeriesCollection tscSLegs = new TimeSeriesCollection(); TimeSeries courses = new TimeSeries("Course"); TimeSeries bearings = new TimeSeries("Bearings"); TimeSeries speeds = new TimeSeries("Speed"); TimeSeries courseLegs = new TimeSeries("Course (leg)"); TimeSeries speedLegs = new TimeSeries("Speed (leg)"); Iterator<BaseContribution> conts = activeSolver.getContributions().iterator(); while (conts.hasNext()) { BaseContribution baseC = conts.next(); if (baseC.isActive()) if (baseC instanceof BearingMeasurementContribution) { BearingMeasurementContribution bmc = (BearingMeasurementContribution) baseC; Iterator<LegOfData> lIter = null; LegOfData thisLeg = null; if (bmc.getOwnshipLegs() != null) { lIter = bmc.getOwnshipLegs().iterator(); thisLeg = lIter.next(); } List<HostState> hostStates = bmc.getHostState(); if (hostStates != null) { Iterator<HostState> stateIter = hostStates.iterator(); while (stateIter.hasNext()) { BearingMeasurementContribution.HostState hostState = stateIter.next(); long thisTime = hostState.time; double thisCourse = hostState.courseDegs; if (showCourses) courses.add(new FixedMillisecond(thisTime), thisCourse); double thisSpeed = hostState.speedKts; speeds.add(new FixedMillisecond(thisTime), thisSpeed); startTime = Math.min(thisTime, startTime); endTime = Math.max(thisTime, endTime); // sort out if this is in a leg or not if (thisLeg != null) { if (thisTime > thisLeg.getEnd() && lIter.hasNext()) { thisLeg = lIter.next(); } else { if (thisTime >= thisLeg.getStart()) { speedLegs.add(new FixedMillisecond(thisTime), thisSpeed); if (showCourses) courseLegs.add(new FixedMillisecond(thisTime), thisCourse); } } } } } // also, we wish to show the bearings from the BMC Iterator<BMeasurement> cuts = bmc.getMeasurements().iterator(); while (cuts.hasNext()) { BearingMeasurementContribution.BMeasurement measurement = cuts.next(); if (measurement.isActive()) { long thisT = measurement.getDate().getTime(); bearings.add(new FixedMillisecond(thisT), Math.toDegrees(Math.abs(measurement.getBearingRads()))); } } } } // HEY, also shade the ownship legs conts = activeSolver.getContributions().iterator(); while (conts.hasNext()) { BaseContribution baseC = conts.next(); if (baseC.isActive()) { if (baseC instanceof BearingMeasurementContribution) { BearingMeasurementContribution bmc = (BearingMeasurementContribution) baseC; Iterator<LegOfData> lIter = null; if (bmc.getOwnshipLegs() != null) { int ctr = 1; lIter = bmc.getOwnshipLegs().iterator(); while (lIter.hasNext()) { LegOfData thisL = lIter.next(); long thisStart = thisL.getStart(); long thisFinish = thisL.getEnd(); java.awt.Color transCol = new java.awt.Color(0, 0, 255, 12); final Marker bst = new IntervalMarker(thisStart, thisFinish, transCol, new BasicStroke(2.0f), null, null, 1.0f); bst.setLabel("O/S-" + ctr++); bst.setLabelAnchor(RectangleAnchor.TOP_LEFT); bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, 10)); bst.setLabelTextAnchor(TextAnchor.TOP_LEFT); legPlot.addDomainMarker(bst, Layer.BACKGROUND); } } } } } tscS.addSeries(speeds); tscSLegs.addSeries(speedLegs); tscC.addSeries(bearings); if (showCourses) { tscC.addSeries(courses); tscCLegs.addSeries(courseLegs); } legPlot.setDataset(0, null); legPlot.setDataset(1, null); legPlot.setDataset(2, null); legPlot.setDataset(3, null); legPlot.setDataset(0, tscC); legPlot.setDataset(1, tscS); legPlot.setDataset(2, tscCLegs); legPlot.setDataset(3, tscSLegs); final NumberAxis axis2 = new NumberAxis("Speed (Kts)"); legPlot.setRangeAxis(1, axis2); legPlot.mapDatasetToRangeAxis(1, 1); legPlot.mapDatasetToRangeAxis(3, 1); legPlot.getRangeAxis(0).setLabel("Crse/Brg (Degs)"); legPlot.mapDatasetToRangeAxis(0, 0); legPlot.mapDatasetToRangeAxis(2, 0); final XYLineAndShapeRenderer lineRenderer1 = new XYLineAndShapeRenderer(true, true); lineRenderer1.setSeriesPaint(1, courseCol); lineRenderer1.setSeriesShape(1, ShapeUtilities.createDiamond(0.1f)); lineRenderer1.setSeriesPaint(0, java.awt.Color.RED); lineRenderer1.setSeriesShape(0, ShapeUtilities.createDiamond(2f)); final XYLineAndShapeRenderer lineRenderer2 = new XYLineAndShapeRenderer(true, false); lineRenderer2.setSeriesPaint(0, speedCol); final XYLineAndShapeRenderer lineRenderer3 = new XYLineAndShapeRenderer(false, true); lineRenderer3.setSeriesPaint(0, courseCol); lineRenderer3.setSeriesShape(0, ShapeUtilities.createUpTriangle(2f)); final XYLineAndShapeRenderer lineRenderer4 = new XYLineAndShapeRenderer(false, true); lineRenderer4.setSeriesPaint(0, speedCol); lineRenderer4.setSeriesShape(0, ShapeUtilities.createDownTriangle(2f)); // ok, and store them legPlot.setRenderer(0, lineRenderer1); legPlot.setRenderer(1, lineRenderer2); legPlot.setRenderer(2, lineRenderer3); legPlot.setRenderer(3, lineRenderer4); if (startTime != Long.MAX_VALUE) legPlot.getDomainAxis().setRange(startTime, endTime); // ok - get the straight legs to sort themselves out // redoStraightLegs(); }