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:daylightchart.sunchart.chart.SunChart.java
private void createAzimuthAxis(final XYPlot plot) { final NumberAxis axis = new NumberAxis(); axis.setTickLabelFont(ChartConfiguration.chartFont.deriveFont(Font.PLAIN, 12)); axis.setVerticalTickLabels(true);/*from w w w . j a v a2 s. c o m*/ // plot.setDomainAxis(axis); }
From source file:com.google.code.facebook.graph.sna.applet.AnimatingAddNodeDemo.java
@Override public void init() { //create a graph Graph<Number, Number> ig = Graphs .<Number, Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number, Number>()); ObservableGraph<Number, Number> og = new ObservableGraph<Number, Number>(ig); og.addGraphEventListener(new GraphEventListener<Number, Number>() { public void handleGraphEvent(GraphEvent<Number, Number> evt) { System.err.println("got " + evt); }/*from w ww .j a v a2 s . co m*/ }); this.g = og; //create a graphdraw layout = new FRLayout<Number, Number>(g); layout.setSize(new Dimension(600, 600)); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); Layout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout); vv = new VisualizationViewer<Number, Number>(staticLayout, new Dimension(600, 600)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 12)); vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>()); vv.setForeground(Color.white); vv.addComponentListener(new ComponentAdapter() { /** * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent) */ @Override public void componentResized(ComponentEvent arg0) { super.componentResized(arg0); System.err.println("resized"); layout.setSize(arg0.getComponent().getSize()); } }); getContentPane().add(vv); switchLayout = new JButton("Switch to SpringLayout"); switchLayout.addActionListener(new ActionListener() { @SuppressWarnings("unchecked") public void actionPerformed(ActionEvent ae) { Dimension d = vv.getSize();//new Dimension(600,600); if (switchLayout.getText().indexOf("Spring") > 0) { switchLayout.setText("Switch to FRLayout"); layout = new SpringLayout<Number, Number>(g, new ConstantTransformer(EDGE_LENGTH)); layout.setSize(d); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); StaticLayout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout); LayoutTransition<Number, Number> lt = new LayoutTransition<Number, Number>(vv, vv.getGraphLayout(), staticLayout); Animator animator = new Animator(lt); animator.start(); // vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } else { switchLayout.setText("Switch to SpringLayout"); layout = new FRLayout<Number, Number>(g, d); layout.setSize(d); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); StaticLayout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout); LayoutTransition<Number, Number> lt = new LayoutTransition<Number, Number>(vv, vv.getGraphLayout(), staticLayout); Animator animator = new Animator(lt); animator.start(); // vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } } }); getContentPane().add(switchLayout, BorderLayout.SOUTH); timer = new Timer(); }
From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.BulletGraph.java
public JFreeChart createChart() { logger.debug("IN"); Number value = null;/*ww w. jav a 2s.co m*/ if (dataset == null) { logger.debug("The dataset to be represented is null"); value = new Double(0); } else { value = dataset.getValue(); } DefaultCategoryDataset datasetC = new DefaultCategoryDataset(); datasetC.addValue(value, "", ""); // customize a bar chart JFreeChart chart = ChartFactory.createBarChart(null, null, null, datasetC, PlotOrientation.HORIZONTAL, false, false, false); chart.setBorderVisible(false); CategoryPlot plot = chart.getCategoryPlot(); plot.setOutlineVisible(true); plot.setOutlinePaint(Color.BLACK); plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); plot.setBackgroundPaint(null); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setRangeCrosshairVisible(false); plot.setAnchorValue(value.doubleValue()); // add the target marker if (target != null) { ValueMarker marker = new ValueMarker(target.doubleValue(), Color.BLACK, new BasicStroke(2.0f)); plot.addRangeMarker(marker, Layer.FOREGROUND); } //sets different marks for (Iterator iterator = intervals.iterator(); iterator.hasNext();) { KpiInterval interval = (KpiInterval) iterator.next(); // add the marks IntervalMarker marker = new IntervalMarker(interval.getMin(), interval.getMax(), interval.getColor()); plot.addRangeMarker(marker, Layer.BACKGROUND); logger.debug("Added new interval to the plot"); } // customize axes CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setVisible(false); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setVisible(show_axis); rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 4)); // calculate the upper limit //double upperBound = target * upperFactor; rangeAxis.setRange(new Range(lower, upper)); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // customize renderer BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setMaximumBarWidth(0.18); renderer.setSeriesPaint(0, Color.BLACK); /*BasicStroke d = new BasicStroke(3f,BasicStroke.CAP_ROUND ,BasicStroke.JOIN_ROUND); renderer.setSeriesOutlineStroke(0, d); renderer.setSeriesStroke(0, d); renderer.setStroke(d);*/ return chart; }
From source file:eu.udig.tools.jgrass.profile.ProfileView.java
public void addStopLine(double x) { DecimalFormat formatter = new DecimalFormat("0.0"); // add a category marker ValueMarker marker = new ValueMarker(x, Color.red, new BasicStroke(1.0f)); marker.setAlpha(0.6f);//from w w w . java2 s.c o m marker.setLabel(formatter.format(x)); marker.setLabelFont(new Font("Dialog", Font.PLAIN, 8)); marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); marker.setLabelOffset(new RectangleInsets(2, 5, 2, 5)); plot.addDomainMarker(marker, Layer.BACKGROUND); markers.add(marker); }
From source file:com.quinsoft.zeidon.objectbrowser.EntitySquare.java
EntitySquare(OiDisplay display, BrowserEnvironment environment, EntityDefLayout layout) { super();//from w ww.java2s . c o m this.env = environment; oiDisplay = display; entityDefLayout = layout; size = new Dimension(SMALLEST_WIDTH * env.getPainterScaleFactor(), SMALLEST_HEIGHT * env.getPainterScaleFactor()); paddedSize = new Dimension((SMALLEST_WIDTH + HORIZONTAL_PAD * 2) * env.getPainterScaleFactor(), (SMALLEST_HEIGHT + VERTICAL_PAD * 2) * env.getPainterScaleFactor()); setSize(size); font = new Font(Font.SANS_SERIF, Font.PLAIN, env.getPainterScaleFactor()); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); addMouseListener(this); getInputMap().put(KeyStroke.getKeyStroke("HOME"), "setFirst"); getActionMap().put("setFirst", new SetCursorAction(CursorPosition.FIRST)); getInputMap().put(KeyStroke.getKeyStroke("PAGE_UP"), "setPrev"); getActionMap().put("setPrev", new SetCursorAction(CursorPosition.PREV)); getInputMap().put(KeyStroke.getKeyStroke("PAGE_DOWN"), "setNext"); getActionMap().put("setNext", new SetCursorAction(CursorPosition.NEXT)); getInputMap().put(KeyStroke.getKeyStroke("END"), "setLast"); getActionMap().put("setLast", new SetCursorAction(CursorPosition.LAST)); getInputMap().put(KeyStroke.getKeyStroke("UP"), "moveUp"); getActionMap().put("moveUp", new ChangeSelectedEntityDefAction(1)); getInputMap().put(KeyStroke.getKeyStroke("DOWN"), "moveDown"); getActionMap().put("moveDown", new ChangeSelectedEntityDefAction(2)); getInputMap().put(KeyStroke.getKeyStroke("LEFT"), "moveLeft"); getActionMap().put("moveLeft", new ChangeSelectedEntityDefAction(3)); getInputMap().put(KeyStroke.getKeyStroke("RIGHT"), "moveRight"); getActionMap().put("moveRight", new ChangeSelectedEntityDefAction(4)); getInputMap().put(KeyStroke.getKeyStroke("ctrl DOWN"), "resetParent"); getActionMap().put("resetParent", new ChangeSelectedEntityDefAction(5)); getInputMap().put(KeyStroke.getKeyStroke("ctrl UP"), "setSubobject"); getActionMap().put("setSubobject", new ChangeSelectedEntityDefAction(6)); }
From source file:main.AddNodeDemo.java
@Override public void init() { //create a graph Graph<String, Number> ig = Graphs .<String, Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<String, Number>()); ObservableGraph<String, Number> og = new ObservableGraph<String, Number>(ig); og.addGraphEventListener(new GraphEventListener<String, Number>() { public void handleGraphEvent(GraphEvent<String, Number> evt) { System.err.println("got " + evt); }//from ww w . jav a2 s . c om }); this.g = og; //create a graphdraw // layout = new FRLayout2<String,Number>(g); // layout = new SpringLayout<String,Number>(g); // ((FRLayout)layout).setMaxIterations(200); layout = new KKLayout<String, Number>(g); vv = new VisualizationViewer<String, Number>(layout, new Dimension(600, 600)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 12)); vv.getModel().getRelaxer().setSleepTime(500); vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>()); vv.setForeground(Color.white); FontMetrics fm = vv.getFontMetrics(vv.getFont()); int width = fm.stringWidth(g.toString()); Transformer<String, Shape> vertexSize = new Transformer<String, Shape>() { public Shape transform(String i) { Ellipse2D circle = new Ellipse2D.Double(-20, -20, 40, 40); // in this case, the vertex is twice as large return circle; } }; // vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller() { // @Override // public String transform(Object v) { // // return ((VertexTopology)v).screenName; // }}); vv.getRenderContext().setVertexShapeTransformer(vertexSize); getContentPane().setPreferredSize(new Dimension(1400, 900)); getContentPane().add(vv); switchLayout = new JButton("Switch to SpringLayout"); // switchLayout.addActionListener(new ActionListener() { // // @SuppressWarnings("unchecked") // public void actionPerformed(ActionEvent ae) { // Dimension d = new Dimension(600,600); // if (switchLayout.getText().indexOf("Spring") > 0) { // switchLayout.setText("Switch to FRLayout"); // layout = new SpringLayout<String,Number>(g, // new ConstantTransformer(EDGE_LENGTH)); // layout.setSize(d); // vv.getModel().setGraphLayout(layout, d); // } else { // switchLayout.setText("Switch to SpringLayout"); // layout = new FRLayout<String,Number>(g, d); // vv.getModel().setGraphLayout(layout, d); // } // } // }); getContentPane().add(switchLayout, BorderLayout.SOUTH); timer = new Timer(); }
From source file:CutAndPasteDemo.java
public CutAndPasteDemo() { super("Cut And Paste Demonstration"); clipboard = getToolkit().getSystemClipboard(); GraphicsEnvironment.getLocalGraphicsEnvironment(); Font font = new Font("LucidaSans", Font.PLAIN, 15); textArea1 = new JTextArea(davidMessage + andyMessage, 5, 25); textArea2 = new JTextArea("<Paste text here>", 5, 25); textArea1.setFont(font);// ww w. j a v a2 s. co m textArea2.setFont(font); JPanel jPanel = new JPanel(); JMenuBar jMenuBar = new JMenuBar(); JMenuItem cutItem = new JMenuItem("Cut"); JMenuItem pasteItem = new JMenuItem("Paste"); JMenu jMenu = new JMenu("Edit"); jMenu.add(cutItem); jMenu.add(pasteItem); cutItem.addActionListener(new CutActionListener()); pasteItem.addActionListener(new PasteActionListener()); jMenuBar.add(jMenu); jPanel.add(jMenuBar); jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); jPanel.add(textArea1); jPanel.add(Box.createRigidArea(new Dimension(0, 10))); jPanel.add(textArea2); getContentPane().add(jPanel, BorderLayout.CENTER); }
From source file:dpcs.About.java
public About() { setIconImage(Toolkit.getDefaultToolkit().getImage(About.class.getResource("/graphics/Icon.png"))); setResizable(false);/* www .j a v a2 s . c o m*/ setType(Type.UTILITY); setTitle("About"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 540, 400); contentPane = new JPanel(); contentPane.setBackground(Color.WHITE); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); try { InputStreamReader reader2 = new InputStreamReader( getClass().getResourceAsStream("/others/app-version.txt")); String tmp = IOUtils.toString(reader2); AppVersion = Double.parseDouble(tmp); } catch (IOException e1) { e1.printStackTrace(); } JButton btnGitHub = new JButton("GitHub"); btnGitHub.setToolTipText("Access Droid PC Suite github repository"); btnGitHub.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Desktop.getDesktop().browse(new URL("https://github.com/kvsjxd/Droid-PC-Suite/").toURI()); } catch (Exception e) { e.printStackTrace(); } } }); btnGitHub.setBounds(369, 295, 111, 25); contentPane.add(btnGitHub); JLabel lblMyFriend4 = new JLabel("Gulati-kun"); lblMyFriend4.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend4.setBounds(25, 266, 242, 24); contentPane.add(lblMyFriend4); JLabel lblMyFriend3 = new JLabel("Anil-kun"); lblMyFriend3.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend3.setBounds(25, 242, 242, 24); contentPane.add(lblMyFriend3); JLabel lblMyFriend2 = new JLabel("Suri-kun"); lblMyFriend2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend2.setBounds(25, 217, 242, 24); contentPane.add(lblMyFriend2); JLabel lblApplicationVersion = new JLabel("Version: " + AppVersion); lblApplicationVersion.setFont(new Font("Dialog", Font.BOLD, 14)); lblApplicationVersion.setBounds(382, 16, 132, 18); contentPane.add(lblApplicationVersion); JLabel lblForMyOther = new JLabel("For my other Android stuff visit me on XDA - Developers (@kvsjxd)"); lblForMyOther.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e) { e.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblForMyOther.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblForMyOther.setForeground(Color.BLACK); } }); lblForMyOther.setFont(new Font("Dialog", Font.PLAIN, 15)); lblForMyOther.setBounds(25, 321, 502, 24); contentPane.add(lblForMyOther); JLabel lblMySensei2 = new JLabel("Karun Sensei"); lblMySensei2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei2.setBounds(25, 120, 242, 24); contentPane.add(lblMySensei2); JLabel lblMySensei1 = new JLabel("Prashotam Sensei"); lblMySensei1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei1.setBounds(25, 98, 242, 24); contentPane.add(lblMySensei1); JLabel lblDaretobe = new JLabel("D4r3T0B3"); lblDaretobe.setFont(new Font("Dialog", Font.PLAIN, 15)); lblDaretobe.setBounds(25, 194, 242, 24); contentPane.add(lblDaretobe); JLabel label_9 = new JLabel(""); label_9.setToolTipText("This variation of android robot is created using Androidify"); label_9.setIcon(new ImageIcon(About.class.getResource("/graphics/Droidrobot.png"))); label_9.setBounds(334, 50, 180, 270); contentPane.add(label_9); JLabel lblDeveloper = new JLabel("Developer"); lblDeveloper.setFont(new Font("Dialog", Font.BOLD, 16)); lblDeveloper.setBounds(25, 12, 233, 24); contentPane.add(lblDeveloper); JLabel lblMrAleksandarDespotovski_shi = new JLabel("Aleksandar Despotovski-shi"); lblMrAleksandarDespotovski_shi.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMrAleksandarDespotovski_shi.setBounds(25, 169, 242, 24); contentPane.add(lblMrAleksandarDespotovski_shi); JLabel lblMyname = new JLabel("Karanvir Singh"); lblMyname.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e1) { e1.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblMyname.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblMyname.setForeground(Color.RED); } }); lblMyname.setForeground(Color.RED); lblMyname.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 16)); lblMyname.setBounds(25, 36, 242, 24); contentPane.add(lblMyname); JLabel lblMyFriend1 = new JLabel("My friend - Chetan-kun"); lblMyFriend1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend1.setBounds(25, 145, 242, 24); contentPane.add(lblMyFriend1); JLabel label_6 = new JLabel("Special thanks to"); label_6.setForeground(UIManager.getColor("OptionPane.questionDialog.titlePane.shadow")); label_6.setFont(new Font("Dialog", Font.BOLD, 16)); label_6.setBounds(25, 71, 240, 25); contentPane.add(label_6); JLabel lblGoogle = new JLabel( "Android, android green colored robot are trademarks of Google, Inc. We are not affliated with Google, Inc. in any way."); lblGoogle.setHorizontalAlignment(SwingConstants.LEFT); lblGoogle.setFont(new Font("Dialog", Font.PLAIN, 8)); lblGoogle.setBounds(25, 341, 514, 24); contentPane.add(lblGoogle); }
From source file:com.liferay.server.admin.web.internal.portlet.action.ViewChartMVCResourceCommand.java
protected JFreeChart getJFreeChart(String title, MeterPlot meterPlot) { JFreeChart jFreeChart = new JFreeChart(title, new Font(null, Font.PLAIN, 13), meterPlot, true); jFreeChart.removeLegend();/*from w w w . j a v a2 s .com*/ jFreeChart.setBackgroundPaint(Color.white); return jFreeChart; }
From source file:com.orsonpdf.demo.PDFPieChartDemo1.java
/** * Creates a chart./*from w ww. j a v a 2 s . c o m*/ * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", dataset, false, false, false); 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); plot.setShadowPaint(null); plot.setLabelShadowPaint(null); // 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); BasicStroke bs = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.0f); 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; }