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:ConfigFiles.java
public ConfigFiles(Dimension screensize) { // initializeFileBrowser(); paths = new JPanel(); paths.setBackground(Color.WHITE); //paths.setBorder(BorderFactory.createTitledBorder("Paths")); paths.setLayout(null);//from w w w. j a v a 2s.c o m paths.setPreferredSize(new Dimension(930, 1144)); paths.setSize(new Dimension(930, 1144)); paths.setMinimumSize(new Dimension(930, 1144)); paths.setMaximumSize(new Dimension(930, 1144)); //paths.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); setLayout(null); ttcpath = new JTextField(); addPanel("TestCase Source Path", "Master directory with the test cases that can" + " be run by the framework", ttcpath, RunnerRepository.TESTSUITEPATH, 10, true, null); tMasterXML = new JTextField(); tUsers = new JTextField(); addPanel("Projects Path", "Location of projects XML files", tUsers, RunnerRepository.REMOTEUSERSDIRECTORY, 83, true, null); tSuites = new JTextField(); addPanel("Predefined Suites Path", "Location of predefined suites", tSuites, RunnerRepository.PREDEFINEDSUITES, 156, true, null); testconfigpath = new JTextField(); addPanel("Test Configuration Path", "Test Configuration path", testconfigpath, RunnerRepository.TESTCONFIGPATH, 303, true, null); tepid = new JTextField(); addPanel("EP name File", "Location of the file that contains" + " the Ep name list", tepid, RunnerRepository.REMOTEEPIDDIR, 595, true, null); tlog = new JTextField(); addPanel("Logs Path", "Location of the directory that stores the most recent log files." + " The files are re-used each Run.", tlog, RunnerRepository.LOGSPATH, 667, true, null); tsecondarylog = new JTextField(); JPanel p = addPanel("Secondary Logs Path", "Location of the directory that archives copies of the most recent log files, with" + " original file names appended with <.epoch time>", tsecondarylog, RunnerRepository.SECONDARYLOGSPATH, 930, true, null); logsenabled.setSelected(Boolean.parseBoolean(RunnerRepository.PATHENABLED)); logsenabled.setBackground(Color.WHITE); p.add(logsenabled); JPanel p7 = new JPanel(); p7.setBackground(Color.WHITE); TitledBorder border7 = BorderFactory.createTitledBorder("Log Files"); border7.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border7.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p7.setBorder(border7); p7.setLayout(new BoxLayout(p7, BoxLayout.Y_AXIS)); p7.setBounds(80, 740, 800, 190); paths.add(p7); JTextArea log2 = new JTextArea("All the log files that will be monitored"); log2.setWrapStyleWord(true); log2.setLineWrap(true); log2.setEditable(false); log2.setCursor(null); log2.setOpaque(false); log2.setFocusable(false); log2.setBorder(null); log2.setFont(new Font("Arial", Font.PLAIN, 12)); log2.setBackground(getBackground()); log2.setMaximumSize(new Dimension(170, 25)); log2.setPreferredSize(new Dimension(170, 25)); JPanel p71 = new JPanel(); p71.setBackground(Color.WHITE); p71.setLayout(new GridLayout()); p71.setMaximumSize(new Dimension(700, 13)); p71.setPreferredSize(new Dimension(700, 13)); p71.add(log2); JPanel p72 = new JPanel(); p72.setBackground(Color.WHITE); p72.setLayout(new BoxLayout(p72, BoxLayout.Y_AXIS)); trunning = new JTextField(); p72.add(addField(trunning, "Running: ", 0)); tdebug = new JTextField(); p72.add(addField(tdebug, "Debug: ", 1)); tsummary = new JTextField(); p72.add(addField(tsummary, "Summary: ", 2)); tinfo = new JTextField(); p72.add(addField(tinfo, "Info: ", 3)); tcli = new JTextField(); p72.add(addField(tcli, "Cli: ", 4)); p7.add(p71); p7.add(p72); libpath = new JTextField(); addPanel("Library path", "Secondary user library path", libpath, RunnerRepository.REMOTELIBRARY, 229, true, null); JPanel p8 = new JPanel(); p8.setBackground(Color.WHITE); TitledBorder border8 = BorderFactory.createTitledBorder("File"); border8.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border8.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p8.setBorder(border8); p8.setLayout(null); p8.setBounds(80, 1076, 800, 50); if (PermissionValidator.canChangeFWM()) { paths.add(p8); } JButton save = new JButton("Save"); save.setToolTipText("Save and automatically load config"); save.setBounds(490, 20, 70, 20); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { saveXML(false, "fwmconfig"); loadConfig("fwmconfig.xml"); } }); p8.add(save); // if(!PermissionValidator.canChangeFWM()){ // save.setEnabled(false); // } JButton saveas = new JButton("Save as"); saveas.setBounds(570, 20, 90, 20); saveas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String filename = CustomDialog.showInputDialog(JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "File Name", "Please enter file name"); if (!filename.equals("NULL")) { saveXML(false, filename); } } }); p8.add(saveas); final JButton loadXML = new JButton("Load Config"); loadXML.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { String[] configs = RunnerRepository .getRemoteFolderContent(RunnerRepository.USERHOME + "/twister/config/"); JComboBox combo = new JComboBox(configs); int resp = (Integer) CustomDialog.showDialog(combo, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "Config", null); final String config; if (resp == JOptionPane.OK_OPTION) config = combo.getSelectedItem().toString(); else config = null; if (config != null) { new Thread() { public void run() { setEnabledTabs(false); JFrame progress = new JFrame(); progress.setAlwaysOnTop(true); progress.setLocation((int) loadXML.getLocationOnScreen().getX(), (int) loadXML.getLocationOnScreen().getY()); progress.setUndecorated(true); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); progress.add(bar); progress.pack(); progress.setVisible(true); loadConfig(config); progress.dispose(); setEnabledTabs(true); } }.start(); } } catch (Exception e) { e.printStackTrace(); } } }); loadXML.setBounds(670, 20, 120, 20); p8.add(loadXML); // if(!PermissionValidator.canChangeFWM()){ // loadXML.setEnabled(false); // } tdbfile = new JTextField(); addPanel("Database XML path", "File location for database configuration", tdbfile, RunnerRepository.REMOTEDATABASECONFIGPATH + RunnerRepository.REMOTEDATABASECONFIGFILE, 375, true, null); temailfile = new JTextField(); // emailpanel = (JPanel) addPanel("Email XML path", "File location for email configuration", temailfile, RunnerRepository.REMOTEEMAILCONFIGPATH + RunnerRepository.REMOTEEMAILCONFIGFILE, 448, true, null) .getParent(); //paths.remove(emailpanel); // emailpanel.setBounds(360,440,350,100); // RunnerRepository.window.mainpanel.p4.getEmails().add(emailpanel); tglobalsfile = new JTextField(); addPanel("Globals XML file", "File location for globals parameters", tglobalsfile, RunnerRepository.GLOBALSREMOTEFILE, 521, true, null); tceport = new JTextField(); addPanel("Central Engine Port", "Central Engine port", tceport, RunnerRepository.getCentralEnginePort(), 1003, false, null); // traPort = new JTextField(); // addPanel("Resource Allocator Port","Resource Allocator Port", // traPort,RunnerRepository.getResourceAllocatorPort(),808,false,null); // thttpPort = new JTextField(); // addPanel("HTTP Server Port","HTTP Server Port",thttpPort, // RunnerRepository.getHTTPServerPort(),740,false,null); //paths.add(loadXML); if (!PermissionValidator.canChangeFWM()) { ttcpath.setEnabled(false); tMasterXML.setEnabled(false); tUsers.setEnabled(false); tepid.setEnabled(false); tSuites.setEnabled(false); tlog.setEnabled(false); trunning.setEnabled(false); tdebug.setEnabled(false); tsummary.setEnabled(false); tinfo.setEnabled(false); tcli.setEnabled(false); tdbfile.setEnabled(false); temailfile.setEnabled(false); tceport.setEnabled(false); libpath.setEnabled(false); tsecondarylog.setEnabled(false); testconfigpath.setEnabled(false); tglobalsfile.setEnabled(false); logsenabled.setEnabled(false); } }
From source file:org.jfree.chart.demo.ImageMapDemo5.java
/** * Creates a chart.//from w ww.ja va 2 s . c om * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createAreaChart("Area Chart", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setAnchor(StandardLegend.SOUTH); chart.setBackgroundPaint(Color.white); final TextTitle subtitle = new TextTitle("An area chart demonstration. We use this subtitle " + " as an example of what happens when you get a really long title or subtitle."); subtitle.setFont(new Font("SansSerif", Font.PLAIN, 12)); subtitle.setPosition(RectangleEdge.TOP); // subtitle.setSpacer(new Spacer(Spacer.RELATIVE, 0.05, 0.05, 0.05, 0.05)); subtitle.setVerticalAlignment(VerticalAlignment.BOTTOM); chart.addSubtitle(subtitle); final CategoryPlot plot = chart.getCategoryPlot(); plot.setForegroundAlpha(0.5f); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLabelAngle(0 * Math.PI / 2.0); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:playground.dgrether.analysis.categoryhistogram.CategoryHistogramWriter.java
public JFreeChart getGraphic(final CategoryHistogram histo, final String modeName) { this.checkIndex(histo); final XYSeriesCollection xyData = new XYSeriesCollection(); final XYSeries departuresSerie = new XYSeries(this.departuresName, false, true); final XYSeries arrivalsSerie = new XYSeries(this.arrivalsName, false, true); final XYSeries onRouteSerie = new XYSeries(this.enRouteName, false, true); Integer enRoute = 0;/*from w w w.ja v a 2 s . c o m*/ for (int i = histo.getFirstIndex() - 2; i <= histo.getLastIndex() + 2; i++) { int departures = histo.getDepartures(modeName, i); int arrivals = histo.getArrivals(modeName, i); int stuck = histo.getAbort(modeName, i); enRoute = enRoute + departures - arrivals - stuck; double hour = i * histo.getBinSizeSeconds() / 60.0 / 60.0; departuresSerie.add(hour, departures); arrivalsSerie.add(hour, arrivals); onRouteSerie.add(hour, enRoute); } xyData.addSeries(departuresSerie); xyData.addSeries(arrivalsSerie); xyData.addSeries(onRouteSerie); final JFreeChart chart = ChartFactory.createXYStepChart( this.title + ", " + modeName + ", " + "it." + histo.getIteration(), "time [h]", yTitle, xyData, PlotOrientation.VERTICAL, true, // legend false, // tooltips false // urls ); XYPlot plot = chart.getXYPlot(); final CategoryAxis axis1 = new CategoryAxis("hour"); axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7)); plot.setDomainAxis(new NumberAxis("time")); plot.getRenderer().setSeriesStroke(0, new BasicStroke(1.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(1.0f)); plot.getRenderer().setSeriesStroke(2, new BasicStroke(1.0f)); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.gray); plot.setDomainGridlinePaint(Color.gray); return chart; }
From source file:com.robertolosanno.cdt_maven.Cdt.java
public Cdt() { //Ontologia/*from w w w .ja v a 2 s . com*/ OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); loadModel(m); ExtendedIterator<OntClass> iter = m.listHierarchyRootClasses(); // create a simple graph graph = new DelegateTree<String, String>(); createTree(iter); //Vincoli System.out.println("--- CONSTRAINTS ---"); ExtendedIterator<ObjectProperty> iterProp = m.listObjectProperties(); while (iterProp.hasNext()) { ObjectProperty objProp = iterProp.next(); plotConstraint(objProp); } treeLayout = new TreeLayout<String, String>(graph); vv = new VisualizationViewer<String, String>(treeLayout, new Dimension(1200, 600)); vv.setBackground(Color.white); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); //***************** MODIFICA COLORE VERTICE ************************ Transformer<String, Paint> vertexColor = new Transformer<String, Paint>() { public Paint transform(String s) { String[] ss = s.split("#"); String type = ss[1]; if (type.equals("root")) return Color.lightGray; if (type.equals("dim")) return Color.BLACK; if (type.equals("val")) return Color.WHITE; if (type.equals("par_val")) return Color.WHITE; if (type.equals("par_dim")) return Color.WHITE; return Color.GREEN; } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexColor); //**************** MODIFICA FORMA VERTICE *************************** //Dati per creare un triangolo (lo creaiamo attraverso la classe Polygon) final int[] xShape = new int[4]; final int[] yShape = new int[4]; final int nShape; // count of points // Make a shape xShape[0] = -10; xShape[1] = 0; xShape[2] = 10; yShape[0] = 0; yShape[1] = 20; yShape[2] = 0; nShape = 3; Transformer<String, Shape> vertexShape = new Transformer<String, Shape>() { private final Shape[] styles = { new Rectangle(-10, -10, 20, 20), new Ellipse2D.Double(-10, -10, 20, 20), new Polygon(xShape, yShape, nShape) //Triangolo }; @Override public Shape transform(String i) { String[] type = i.split("#"); if (type[1].equals("par_val")) { return styles[0]; } else if (type[1].equals("par_dim")) { return styles[2]; } else { return styles[1]; } } }; vv.getRenderContext().setVertexShapeTransformer(vertexShape); // vv.getRenderer().setVertexRenderer(new MyRenderer()); //**************** MODIFICA FONT LABEL *************************** vv.getRenderContext().setVertexFontTransformer(new Transformer<String, Font>() { @Override public Font transform(String arg0) { Font font = new Font("Arial Unicode MS", Font.PLAIN, 11); return font; } }); // ********************** POSIZIONA LA LABEL SOTTO IL VERTICE **************************** vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S); //******************** RIMUOVE DAL TESTO DELLA LABEL DEL VERTICE IL TIPO DI VERTICE ************************ Transformer<String, String> transformer = new Transformer<String, String>() { @Override public String transform(String arg0) { String[] node = arg0.split("#"); return node[0]; } }; vv.getRenderContext().setVertexLabelTransformer(transformer); Container content = getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv.setGraphMouse(graphMouse); JComboBox modeBox = graphMouse.getModeComboBox(); modeBox.addItemListener(graphMouse.getModeListener()); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel scaleGrid = new JPanel(new GridLayout(1, 0)); scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel controls = new JPanel(); scaleGrid.add(plus); scaleGrid.add(minus); controls.add(scaleGrid); controls.add(modeBox); content.add(controls, BorderLayout.SOUTH); }
From source file:com.intel.stl.ui.main.view.StaDetailsPanel.java
/** * Description://w ww .j ava2 s .com * * @param sourceName */ protected void initComponent() { setLayout(new BorderLayout(0, 10)); setOpaque(false); setBorder(BorderFactory.createTitledBorder((Border) null)); JPanel titlePanel = new JPanel(new BorderLayout(5, 1)); titlePanel.setOpaque(false); numberLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN); numberLabel.setHorizontalAlignment(JLabel.RIGHT); titlePanel.add(numberLabel, BorderLayout.CENTER); nameLabel = ComponentFactory.getH3Label("", Font.PLAIN); nameLabel.setHorizontalAlignment(JLabel.LEFT); nameLabel.setVerticalAlignment(JLabel.BOTTOM); titlePanel.add(nameLabel, BorderLayout.EAST); add(titlePanel, BorderLayout.NORTH); JPanel mainPanel = new JPanel(); mainPanel.setOpaque(false); mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); mainPanel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(2, 2, 2, 2); gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; gc.gridwidth = 1; gc.weighty = 0; failedChartPanel = new ChartPanel(null); failedChartPanel.setPreferredSize(new Dimension(60, 20)); mainPanel.add(failedChartPanel, gc); gc.fill = GridBagConstraints.BOTH; gc.weightx = 0; failedNumberLabel = ComponentFactory.getH2Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.BOLD); failedNumberLabel.setForeground(UIConstants.INTEL_DARK_RED); failedNumberLabel.setHorizontalAlignment(JLabel.CENTER); mainPanel.add(failedNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; failedNameLabel = ComponentFactory.getH5Label(STLConstants.K0020_FAILED.getValue(), Font.PLAIN); failedNameLabel.setVerticalAlignment(JLabel.BOTTOM); mainPanel.add(failedNameLabel, gc); gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; gc.gridwidth = 1; skippedChartPanel = new ChartPanel(null); skippedChartPanel.setPreferredSize(new Dimension(60, 20)); mainPanel.add(skippedChartPanel, gc); gc.fill = GridBagConstraints.BOTH; gc.weightx = 0; skippedNumberLabel = ComponentFactory.getH2Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.BOLD); skippedNumberLabel.setForeground(UIConstants.INTEL_DARK_ORANGE); skippedNumberLabel.setHorizontalAlignment(JLabel.CENTER); mainPanel.add(skippedNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; skippedNameLabel = ComponentFactory.getH5Label(STLConstants.K0021_SKIPPED.getValue(), Font.PLAIN); skippedNameLabel.setVerticalAlignment(JLabel.BOTTOM); mainPanel.add(skippedNameLabel, gc); gc.weighty = 0; gc.fill = GridBagConstraints.NONE; gc.insets = new Insets(8, 2, 2, 2); gc.weightx = 1; gc.gridwidth = 1; gc.gridheight = types.length; typeChartPanel = new ChartPanel(null); typeChartPanel.setPreferredSize(new Dimension(80, 60)); mainPanel.add(typeChartPanel, gc); typeNumberLabels = new JLabel[types.length]; typeNameLabels = new JLabel[types.length]; gc.fill = GridBagConstraints.BOTH; gc.gridheight = 1; gc.insets = new Insets(12, 2, 2, 2); for (int i = 0; i < types.length; i++) { if (i == 1) { gc.insets = new Insets(2, 2, 2, 2); } gc.weightx = 0; gc.gridwidth = 1; typeNumberLabels[i] = createNumberLabel(); mainPanel.add(typeNumberLabels[i], gc); gc.gridwidth = GridBagConstraints.REMAINDER; typeNameLabels[i] = createNameLabel(types[i].getName()); mainPanel.add(typeNameLabels[i], gc); } gc.fill = GridBagConstraints.BOTH; mainPanel.add(Box.createGlue(), gc); add(mainPanel, BorderLayout.CENTER); }
From source file:net.sf.jasperreports.engine.fonts.FontUtil.java
/** * Returns font information containing the font family, font face and font style. * /*from www.j a v a 2 s. c o m*/ * @param name the font family or font face name * @param ignoreCase the flag to specify if family names or face names are searched by ignoring case or not * @param locale the locale * @return a font info object */ public FontInfo getFontInfo(String name, boolean ignoreCase, Locale locale) { FontInfo awtFamilyMatchFontInfo = null; //FIXMEFONT do some cache List<FontFamily> families = jasperReportsContext.getExtensions(FontFamily.class); for (Iterator<FontFamily> itf = families.iterator(); itf.hasNext();) { FontFamily family = itf.next(); if (locale == null || family.supportsLocale(locale)) { if (equals(name, family.getName(), ignoreCase)) { return new FontInfo(family, null, Font.PLAIN); } FontFace face = family.getNormalFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.PLAIN); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.PLAIN); } } face = family.getBoldFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.BOLD); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.BOLD); } } face = family.getItalicFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.ITALIC); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.ITALIC); } } face = family.getBoldItalicFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.BOLD | Font.ITALIC); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.BOLD | Font.ITALIC); } } } } return awtFamilyMatchFontInfo; }
From source file:kcse_2013_results.Pie_Chart_KCSE_School_Performance.java
/** * Creates a chart./*from ww w .ja v a 2s . c o m*/ * * @param dataset the dataset. * * @return A chart. */ public JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart3D("KCSE 2013 Results Summary ", // chart title dataset, // data true, // include legend true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setForegroundAlpha(0.95f); plot.setCircular(true); plot.setLabelGap(0.02); return chart; }
From source file:Sampler.java
private void createUI() { setFont(new Font("Serif", Font.PLAIN, 12)); setLayout(new BorderLayout()); // Set our location to the left of the image frame. setSize(200, 350);// ww w .j a v a 2 s. c o m Point pt = mImageFrame.getLocation(); setLocation(pt.x - getSize().width, pt.y); final Checkbox accumulateCheckbox = new Checkbox("Accumulate", false); final Label statusLabel = new Label(""); // Make a sorted list of the operators. Enumeration e = mOps.keys(); Vector names = new Vector(); while (e.hasMoreElements()) names.addElement(e.nextElement()); Collections.sort(names); final java.awt.List list = new java.awt.List(); for (int i = 0; i < names.size(); i++) list.add((String) names.elementAt(i)); add(list, BorderLayout.CENTER); // When an item is selected, do the corresponding transformation. list.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() != ItemEvent.SELECTED) return; String key = list.getSelectedItem(); BufferedImageOp op = (BufferedImageOp) mOps.get(key); BufferedImage source = mSplitImageComponent.getSecondImage(); boolean accumulate = accumulateCheckbox.getState(); if (source == null || accumulate == false) source = mSplitImageComponent.getImage(); String previous = mImageFrame.getTitle() + " + "; if (accumulate == false) previous = ""; mImageFrame.setTitle(previous + key); statusLabel.setText("Performing " + key + "..."); list.setEnabled(false); accumulateCheckbox.setEnabled(false); BufferedImage destination = op.filter(source, null); mSplitImageComponent.setSecondImage(destination); mSplitImageComponent.setSize(mSplitImageComponent.getPreferredSize()); mImageFrame.setSize(mImageFrame.getPreferredSize()); list.setEnabled(true); accumulateCheckbox.setEnabled(true); statusLabel.setText("Performing " + key + "...done."); } }); Button loadButton = new Button("Load..."); loadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { FileDialog fd = new FileDialog(Sampler.this); fd.show(); if (fd.getFile() == null) return; String path = fd.getDirectory() + fd.getFile(); mSplitImageComponent.setImage(path); mSplitImageComponent.setSecondImage(null); // Utilities.sizeContainerToComponent(mImageFrame, // mSplitImageComponent); mImageFrame.validate(); mImageFrame.repaint(); } }); Panel bottom = new Panel(new GridLayout(2, 1)); Panel topBottom = new Panel(); topBottom.add(accumulateCheckbox); topBottom.add(loadButton); bottom.add(topBottom); bottom.add(statusLabel); add(bottom, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { mImageFrame.dispose(); dispose(); System.exit(0); } }); }
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);//from w w w. ja va 2s . c om 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; }