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:org.jfree.chart.demo.MultiplePieChartDemo3.java
/** * Creates a sample chart for the given dataset. * /*from w w w .j a va 2s . c o m*/ * @param dataset the dataset. * * @return A sample chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createMultiplePieChart3D("Multiple Pie Chart Demo 3", dataset, TableOrder.BY_COLUMN, true, true, false); chart.setBackgroundPaint(new Color(216, 255, 216)); final MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot(); final PiePlot p = (PiePlot) plot.getPieChart().getPlot(); p.setMaximumLabelWidth(0.35); p.setLabelFont(new Font("SansSerif", Font.PLAIN, 9)); p.setInteriorGap(0.30); return chart; }
From source file:NwFontChooserS.java
private void showSample() { int g = 0;/*from w w w . j a v a 2 s. com*/ try { g = Integer.parseInt(SizeList.getSelectedValue()); } catch (NumberFormatException nfe) { } String st = StyleList.getSelectedValue(); int s = Font.PLAIN; if (st.equalsIgnoreCase("Bold")) s = Font.BOLD; if (st.equalsIgnoreCase("Italic")) s = Font.ITALIC; Sample.setFont(new Font(FontList.getSelectedValue(), s, g)); Sample.setText("The quick brown fox jumped over the lazy dog."); }
From source file:it.eng.spagobi.engines.kpi.bo.charttypes.trendcharts.LineChart.java
public JFreeChart createChart() { logger.debug("IN"); CategoryPlot plot = new CategoryPlot(); IMessageBuilder msgBuilder = MessageBuilderFactory.getMessageBuilder(); String rangeAxisName = msgBuilder.getMessage("sbi.kpi.rangeAxisName"); NumberAxis rangeAxis = new NumberAxis(rangeAxisName); rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 12)); Color colorLabel = Color.decode("#000000"); rangeAxis.setLabelPaint(colorLabel); rangeAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10)); rangeAxis.setTickLabelPaint(colorLabel); plot.setRangeAxis(rangeAxis);/*from w w w. jav a2 s.com*/ CategoryAxis domainAxis = new CategoryAxis(); domainAxis.setLabelFont(new Font("Arial", Font.PLAIN, 10)); domainAxis.setLabelPaint(colorLabel); domainAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10)); domainAxis.setTickLabelPaint(colorLabel); plot.setDomainAxis(domainAxis); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeGridlinesVisible(true); plot.setDomainGridlinesVisible(true); //I create a line renderer MyStandardCategoryItemLabelGenerator generator = null; LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer(); lineRenderer.setShapesFilled(true); lineRenderer.setBaseItemLabelGenerator(generator); lineRenderer.setBaseItemLabelFont(new Font("Arial", Font.PLAIN, 12)); lineRenderer.setBaseItemLabelPaint(colorLabel); lineRenderer.setBaseItemLabelsVisible(true); DefaultCategoryDataset datasetLine = (DefaultCategoryDataset) datasetMap.getDatasets().get("line"); for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) { String serName = (String) iterator.next(); String labelName = ""; int index = -1; index = datasetLine.getRowIndex(serName); Color color = Color.decode("#990200"); lineRenderer.setSeriesPaint(index, color); } plot.setDataset(0, datasetLine); plot.setRenderer(0, lineRenderer); plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); JFreeChart chart = new JFreeChart(plot); logger.debug("Chart created"); TextTitle title = new TextTitle(name, new Font("Arial", Font.BOLD, 16), Color.decode("#990200"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS); chart.setTitle(title); TextTitle subTitle = new TextTitle(subName, new Font("Arial", Font.PLAIN, 12), Color.decode("#000000"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS); chart.addSubtitle(subTitle); TextTitle subTitle2 = new TextTitle(subName, new Font("Arial", Font.PLAIN, 8), Color.decode("#FFFFFF"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS); chart.addSubtitle(subTitle2); chart.removeLegend(); chart.setBackgroundPaint(Color.white); logger.debug("OUT"); return chart; }
From source file:rhinova.gui.dataentry.link.LinkDataEntryPanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license vSpacer5 = new JPanel(null); label2 = new JLabel(); hSpacer1 = new JPanel(null); label1 = new JLabel(); txtName = new JTextField(); vSpacer4 = new JPanel(null); label6 = new JLabel(); txtCap = new JTextField(); vSpacer3 = new JPanel(null); label7 = new JLabel(); txtSur = new JTextField(); hSpacer2 = new JPanel(null); vSpacer2 = new JPanel(null); label8 = new JLabel(); res1 = new JComboBox(); vSpacer1 = new JPanel(null); label9 = new JLabel(); res2 = new JComboBox(); vSpacer6 = new JPanel(null); btnCreate = new JButton(); hSpacer3 = new JPanel(null); //======== this ======== setLayout(new GridBagLayout()); ((GridBagLayout) getLayout()).columnWidths = new int[] { 0, 65, 145, 0, 0 }; ((GridBagLayout) getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ((GridBagLayout) getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; add(vSpacer5, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label2 ---- label2.setText("Link Entry Panel"); label2.setFont(new Font("Tahoma", Font.PLAIN, 16)); add(label2, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(hSpacer1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label1 ---- label1.setText("name"); add(label1, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(txtName, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer4, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label6 ---- label6.setText("capacity"); add(label6, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(txtCap, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer3, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label7 ---- label7.setText("survival rate"); add(label7, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(txtSur, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(hSpacer2, new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); add(vSpacer2, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label8 ---- label8.setText("reserve1"); add(label8, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(res1, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer1, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label9 ---- label9.setText("reserve2"); add(label9, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(res2, new GridBagConstraints(2, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer6, new GridBagConstraints(1, 11, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- btnCreate ---- btnCreate.setText("Create Link"); btnCreate.addActionListener(new ActionListener() { @Override// w w w .j ava 2 s . co m public void actionPerformed(ActionEvent e) { btnCreateActionPerformed(e); } }); add(btnCreate, new GridBagConstraints(2, 12, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(hSpacer3, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:TextInputDemo.java
protected JComponent createAddressDisplay() { JPanel panel = new JPanel(new BorderLayout()); addressDisplay = new JLabel(); addressDisplay.setHorizontalAlignment(JLabel.CENTER); regularFont = addressDisplay.getFont().deriveFont(Font.PLAIN, 16.0f); italicFont = regularFont.deriveFont(Font.ITALIC); updateDisplays();/*from w w w . j a va2s . c o m*/ //Lay out the panel. panel.setBorder(BorderFactory.createEmptyBorder(GAP / 2, //top 0, //left GAP / 2, //bottom 0)); //right panel.add(new JSeparator(JSeparator.VERTICAL), BorderLayout.LINE_START); panel.add(addressDisplay, BorderLayout.CENTER); panel.setPreferredSize(new Dimension(200, 150)); return panel; }
From source file:org.jfree.eastwood.ChartServlet.java
/** * Initialise the servlet./*from w w w . j a v a 2 s. com*/ * * @param config the config. * * @throws ServletException */ public void init(ServletConfig config) throws ServletException { super.init(config); String fontSizeParam = config.getInitParameter("fontSize"); String fontResourceParam = config.getInitParameter("fontResource"); String fontFileParam = config.getInitParameter("fontFile"); String fontParam = config.getInitParameter("font"); float fontSize = 12f; if (fontSizeParam != null) { fontSize = Integer.parseInt(fontSizeParam); } if (fontResourceParam != null) { ServletContext ctx = config.getServletContext(); this.font = readFontResource(ctx, fontResourceParam, fontSize); } else if (fontFileParam != null) { this.font = readFontFile(fontFileParam, fontSize); } else if (fontParam != null) { this.font = new Font(fontParam, Font.PLAIN, (int) fontSize); } else { this.font = new Font("Dialog", Font.PLAIN, (int) fontSize); } }
From source file:icaro.aplicaciones.recursos.recursoEstadistica.jFreeChart.demo.PieChartDemo1.java
/** * Creates a chart./*w ww. ja v a2s .co m*/ * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title dataset, // data false, // no legend true, // tooltips false // no URL generation ); // set a custom background for the chart chart.setBackgroundPaint( new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY)); // customise the title position and font TextTitle t = chart.getTitle(); t.setHorizontalAlignment(HorizontalAlignment.LEFT); t.setPaint(new Color(240, 240, 240)); t.setFont(new Font("Arial", Font.BOLD, 26)); PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPaint(null); plot.setInteriorGap(0.04); // plot.setOutlineVisible(false); // use gradients and white borders for the section colours plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE)); plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED)); plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN)); plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW)); plot.setBaseSectionOutlinePaint(Color.WHITE); plot.setSectionOutlinesVisible(true); plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f)); // customise the section label appearance plot.setLabelFont(new Font("Courier New", Font.BOLD, 20)); plot.setLabelLinkPaint(Color.WHITE); plot.setLabelLinkStroke(new BasicStroke(2.0f)); plot.setLabelOutlineStroke(null); plot.setLabelPaint(Color.WHITE); plot.setLabelBackgroundPaint(null); // add a subtitle giving the data source TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523", new Font("Courier New", Font.PLAIN, 12)); source.setPaint(Color.WHITE); source.setPosition(RectangleEdge.BOTTOM); source.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(source); return chart; }
From source file:OrientedPtTest.java
public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); TransformGroup objScale = new TransformGroup(); Transform3D textMat = new Transform3D(); // Assuming uniform size chars, set scale to fit string in view textMat.setScale(1.2 / sl);/* ww w .jav a 2 s. c om*/ objScale.setTransform(textMat); // Create the transform group node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. Add it to the // root of the subgraph. TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); objRoot.addChild(objTrans); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); Appearance apText = new Appearance(); Material m = new Material(); m.setLightingEnable(true); apText.setMaterial(m); Appearance apEarth = new Appearance(); Material mm = new Material(); mm.setLightingEnable(true); apEarth.setMaterial(mm); Appearance apStone = new Appearance(); apStone.setMaterial(mm); // create 3D text Font3D f3d = new Font3D(new Font(fontName, Font.PLAIN, 2), new FontExtrusion()); Point3f textPt = new Point3f(-sl / 2.0f, 3.0f, 0.0f); Text3D txt = new Text3D(f3d, textString, textPt); OrientedShape3D textShape = new OrientedShape3D(); textShape.setGeometry(txt); textShape.setAppearance(apText); textShape.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT); // text is centered around 0, 3, 0. Make it rotate around 0,5,0 Point3f rotationPt = new Point3f(0.0f, 5.0f, 0.0f); textShape.setRotationPoint(rotationPt); objScale.addChild(textShape); // also add a small Sphere at the rotation point to // show that we are rotating around the right point Sphere sphere = new Sphere(0.2f); TransformGroup sphereGroup = new TransformGroup(); Transform3D sphereXform = new Transform3D(); sphereXform.set(new Vector3f(rotationPt)); sphereGroup.setTransform(sphereXform); sphereGroup.addChild(sphere); objScale.addChild(sphereGroup); // Create a simple shape leaf node, add it to the scene graph. Transform3D cubeMat = new Transform3D(); TransformGroup cubeTrans = new TransformGroup(cubeMat); cubeMat.set(new Vector3d(0.9, 0.0, -1.0)); cubeTrans.setTransform(cubeMat); cubeTrans.addChild(new ColorCube(0.3)); objTrans.addChild(cubeTrans); TextureLoader stoneTex = new TextureLoader(stoneImage, new String("RGB"), this); if (stoneTex != null) apStone.setTexture(stoneTex.getTexture()); TextureAttributes texAttr = new TextureAttributes(); texAttr.setTextureMode(TextureAttributes.REPLACE); apStone.setTextureAttributes(texAttr); Transform3D coneMat = new Transform3D(); TransformGroup coneTrans = new TransformGroup(coneMat); coneMat.set(new Vector3d(0.0, 0.0, 0.0)); coneTrans.setTransform(coneMat); coneTrans.addChild(new Cone(.2f, 0.8f, Cone.GENERATE_NORMALS | Cone.GENERATE_TEXTURE_COORDS, apStone)); objTrans.addChild(coneTrans); TextureLoader earthTex = new TextureLoader(earthImage, new String("RGB"), this); if (earthTex != null) apEarth.setTexture(earthTex.getTexture()); apEarth.setTextureAttributes(texAttr); Transform3D cylinderMat = new Transform3D(); TransformGroup cylinderTrans = new TransformGroup(cylinderMat); cylinderMat.set(new Vector3d(-0.9, 0.5, -1.0)); cylinderTrans.setTransform(cylinderMat); cylinderTrans.addChild( new Cylinder(.35f, 2.0f, Cylinder.GENERATE_NORMALS | Cylinder.GENERATE_TEXTURE_COORDS, apEarth)); objTrans.addChild(cylinderTrans); objTrans.addChild(objScale); // Set up the background Color3f bgColor = new Color3f(0.05f, 0.05f, 0.5f); Background bgNode = new Background(bgColor); bgNode.setApplicationBounds(bounds); objRoot.addChild(bgNode); // Set up the ambient light Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f); AmbientLight ambientLightNode = new AmbientLight(ambientColor); ambientLightNode.setInfluencingBounds(bounds); objRoot.addChild(ambientLightNode); // Set up the directional lights Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f); Vector3f light1Direction = new Vector3f(1.0f, 1.0f, 1.0f); Color3f light2Color = new Color3f(1.0f, 1.0f, 0.9f); Vector3f light2Direction = new Vector3f(-1.0f, -1.0f, -1.0f); DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction); light1.setInfluencingBounds(bounds); objRoot.addChild(light1); DirectionalLight light2 = new DirectionalLight(light2Color, light2Direction); light2.setInfluencingBounds(bounds); objRoot.addChild(light2); apText.setMaterial(mm); // Have Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }
From source file:CalIcon.java
/** Construct the object with a Calendar object */ public CalIcon(Calendar c, boolean showT) { super();// w w w . ja va 2 s . co m showTime = showT; myCal = c; setLayout(null); // we don't need another layout, ... if (showTime) { // System.err.println("Constructing and adding Clock"); clock = new Clock(); add(clock); clock.setBounds(0, 2, SIZE, 10); // clock.setBackground(Color.black); // clock.setForeground(Color.green); RBY = d.height - (RBH + (showTime ? 12 : 0) / 2); } else { RBY = 6; } RBX = 12; // raised box x offset // System.err.println("RBX, RBY = " + RBX + "," + RBY); dayNumbFont = new Font("Serif", Font.BOLD, 20); dayNumbFM = getFontMetrics(dayNumbFont); dayNameFont = new Font("SansSerif", Font.PLAIN, 10); dayNameFM = getFontMetrics(dayNameFont); monNameFont = new Font("SansSerif", Font.ITALIC, 10); monNameFM = getFontMetrics(monNameFont); }
From source file:com.intel.stl.ui.configuration.view.SC2VLNTMTBarChartPanel.java
@Override public void modelChanged(DevicePropertyCategory model) { try {//from ww w . ja va 2 s . c o m double[] values = (double[]) model.getProperty(VLNT).getObject(); int numSCs = (Integer) model.getProperty(SC).getObject(); final XYSeries xyseries = new XYSeries(""); int x = 0; for (double v : values) { xyseries.add(x++, v); } dataset.addSeries(xyseries); chartPanel.getChart().getXYPlot().getDomainAxis().setRange(0, numSCs); } catch (Exception e) { log.warn("Failed to display model", e); propsPanel.remove(chartPanel); propsPanel.add(ComponentFactory.getH4Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN)); } }