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:Main.java
/** Set the font of the given components to the logical {@code "DialogInput"} font of the given size. */ public static void setDialogInputFont(int size, Component... components) { setFont(new Font("DialogInput", Font.PLAIN, size), components); }
From source file:ParagraphLayout.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "Java components and products Directory for Java components " + "and applications.Hundreds of Java components and applications " + "are organized by topic. You can find what you need easily. " + "You may also compare your product with others. If your component " + "is not listed, just send your url to java2s@java2s.com. " + "http://www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); AttributedString as = new AttributedString(s); as.addAttribute(TextAttribute.FONT, font); AttributedCharacterIterator aci = as.getIterator(); FontRenderContext frc = g2.getFontRenderContext(); LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc); Insets insets = getInsets();/*w w w . ja v a2 s .co m*/ float wrappingWidth = getSize().width - insets.left - insets.right; float x = insets.left; float y = insets.top; while (lbm.getPosition() < aci.getEndIndex()) { TextLayout textLayout = lbm.nextLayout(wrappingWidth); y += textLayout.getAscent(); textLayout.draw(g2, x, y); y += textLayout.getDescent() + textLayout.getLeading(); x = insets.left; } }
From source file:com.ouc.cpss.view.EmpSaleChartBuilder.java
private static JFreeChart createJFreeChart(CategoryDataset dataset) { /**// w w w. j a va 2 s . c o m * JFreeChart */ //? StandardChartTheme standardChartTheme = new StandardChartTheme("CN"); // standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 20)); // standardChartTheme.setRegularFont(new Font("", Font.PLAIN, 15)); //? standardChartTheme.setLargeFont(new Font("", Font.PLAIN, 15)); //? ChartFactory.setChartTheme(standardChartTheme); //? JFreeChart jfreeChart = ChartFactory.createBarChart3D("", "", "?", dataset, PlotOrientation.VERTICAL, true, false, false); /** * JFreeChart */ jfreeChart.setTitle(new TextTitle("", new Font("", Font.BOLD + Font.ITALIC, 20))); CategoryPlot plot = (CategoryPlot) jfreeChart.getPlot(); CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setLabelFont(new Font("", Font.ROMAN_BASELINE, 12)); return jfreeChart; }
From source file:MainClass.java
public int print(Graphics g, PageFormat pf, int pageIndex) { if (pageIndex != 0) return NO_SUCH_PAGE; Graphics2D g2 = (Graphics2D) g; g2.setFont(new Font("Serif", Font.PLAIN, 36)); g2.setPaint(Color.black);/*from w w w .j av a2 s .c om*/ g2.drawString("www.java2s.com", 100, 100); Rectangle2D outline = new Rectangle2D.Double(pf.getImageableX(), pf.getImageableY(), pf.getImageableWidth(), pf.getImageableHeight()); g2.draw(outline); return PAGE_EXISTS; }
From source file:thesisdata.PieChartDemo1.java
/** * Creates a chart.//from w w w. java 2 s .c om * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Death Causes Detection", // chart title dataset, // data true, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }
From source file:mergedoc.Application.java
/** * ? Look & Feel ???/*from ww w.j a v a2s . co m*/ * @throws ClassNotFoundException LookAndFeel ???????? * @throws InstantiationException ???????????? * @throws IllegalAccessException ???????????? * @throws UnsupportedLookAndFeelException lnf.isSupportedLookAndFeel() ? false ?? */ private static void initSystemLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); Toolkit.getDefaultToolkit().setDynamicLayout(true); // Windows ??? String osName = System.getProperty("os.name", ""); if (osName.indexOf("Windows") != -1) { Object propoFont = new FontUIResource("MS UI Gothic", Font.PLAIN, 12); Object fixedFont = new FontUIResource("MS Gothic", Font.PLAIN, 12); // ?????????? // ????? instanceof FontUIResource ? // ???UIDefaults ? Lazy Value ?????? for (Object keyObj : UIManager.getLookAndFeelDefaults().keySet()) { String key = keyObj.toString(); if (key.endsWith("font") || key.endsWith("Font")) { UIManager.put(key, propoFont); } } // ????? UIManager.put("OptionPane.messageFont", fixedFont); UIManager.put("TextPane.font", fixedFont); UIManager.put("TextArea.font", fixedFont); } }
From source file:MenuDemo.java
public MenuDemo() { super("Basic text editor"); setSize(450, 350);//from ww w .j av a 2 s . c o m fontArray = new Font[FontNames.length]; for (int i = 0; i < FontNames.length; i++) fontArray[i] = new Font(FontNames[i], Font.PLAIN, 12); JMenuBar menuBar = createMenuBar(); setJMenuBar(menuBar); fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new File(".")); WindowListener exitEvent = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(exitEvent); updateMonitor(); setVisible(true); }
From source file:Main.java
public void render(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.WHITE);// ww w. j av a 2 s .com Font font = new Font("Verdana", Font.PLAIN, 20); g2d.setFont(font); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FontMetrics fm = g2d.getFontMetrics(); String option = "This is a test"; int x = (getWidth() - fm.stringWidth(option)) / 2; int y = ((getHeight() - fm.getHeight()) / 2); g2d.drawString(option, x, y + fm.getAscent()); g2d.drawRect((int) x - 20, (int) y - 10, (int) fm.stringWidth(option) + 40, (int) fm.getHeight() + 20); }
From source file:TextLayoutPanel.java
public TextLayoutPanel() { setBackground(Color.white);//w w w.ja v a2s .c om setForeground(Color.black); setSize(400, 200); addMouseListener(new MouseHandler()); addMouseMotionListener(new MouseMotionHandler()); w = getWidth(); h = getHeight(); String text = "Java Source and Support"; font = new Font("Arial", Font.PLAIN, 36); frc = new FontRenderContext(null, false, false); layout = new TextLayout(text, font, frc); rx = (float) (w / 2 - layout.getBounds().getWidth() / 2); ry = (float) 3 * h / 4; rw = (float) (layout.getBounds().getWidth()); rh = (float) (layout.getBounds().getHeight()); rect = new Rectangle2D.Float(rx, ry, rw, rh); caretColor = getForeground(); }
From source file:projectvendingmachine.AmountPieChart.java
/** * Creates a chart.//from w ww . j av a 2 s .c o m * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Statistics", // chart title dataset, // data true, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }