List of usage examples for java.awt Font BOLD
int BOLD
To view the source code for java.awt Font BOLD.
Click Source Link
From source file:c.depthchart.ViewerPanel.java
public ViewerPanel() { setBackground(Color.WHITE);/*from w w w . j a v a2 s . c o m*/ df = new DecimalFormat("0.#"); // 1 dp msgFont = new Font("SansSerif", Font.BOLD, 18); initChart(); configOpenNI(); histogram = new float[MAX_DEPTH_SIZE]; imWidth = depthMD.getFullXRes(); imHeight = depthMD.getFullYRes(); System.out.println("Image dimensions (" + imWidth + ", " + imHeight + ")"); // create empty image object of correct size and type imgbytes = new byte[imWidth * imHeight]; image = new BufferedImage(imWidth, imHeight, BufferedImage.TYPE_BYTE_GRAY); new Thread(this).start(); // start updating the panel's image }
From source file:com.alibaba.webx.tutorial.app1.module.screen.simple.SayHiImage.java
private void writeImage(OutputStream out) throws IOException { BufferedImage img = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = img.createGraphics(); g2d.setPaint(Color.red);/*from w w w . j av a 2 s . c o m*/ g2d.setFont(new Font("Serif", Font.BOLD, 36)); g2d.drawString("Hi there, how are you doing today?", 5, g2d.getFontMetrics().getHeight()); g2d.dispose(); ImageIO.write(img, "jpg", out); }
From source file:CheckBoxTest.java
public CheckBoxFrame() { setTitle("CheckBoxTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // add the sample text label label = new JLabel("The quick brown fox jumps over the lazy dog."); label.setFont(new Font("Serif", Font.PLAIN, FONTSIZE)); add(label, BorderLayout.CENTER); // this listener sets the font attribute of // the label to the check box state ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { int mode = 0; if (bold.isSelected()) mode += Font.BOLD; if (italic.isSelected()) mode += Font.ITALIC; label.setFont(new Font("Serif", mode, FONTSIZE)); }// w w w. j a v a2 s . c om }; // add the check boxes JPanel buttonPanel = new JPanel(); bold = new JCheckBox("Bold"); bold.addActionListener(listener); buttonPanel.add(bold); italic = new JCheckBox("Italic"); italic.addActionListener(listener); buttonPanel.add(italic); add(buttonPanel, BorderLayout.SOUTH); }
From source file:flow.visibility.tapping.OpenDayLightUtils.java
/** Creating the Pane for Flow Entry */ public OpenDayLightUtils() { super("Installed Flow"); FlowtextArea = new JTextArea(50, 10); FlowtextArea.setEditable(false);/*from w w w . jav a 2s.c o m*/ FlowtextArea.setFont(new Font("Courier New", Font.BOLD, 12)); PrintStream FlowprintStream = new PrintStream(new CustomOutputStream(FlowtextArea)); // re-assigns standard output stream and error output stream System.setOut(FlowprintStream); System.setErr(FlowprintStream); // creates the GUI setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.insets = new Insets(10, 10, 10, 10); constraints.anchor = GridBagConstraints.WEST; constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1.0; constraints.weighty = 1.0; /** Adding the Pane into Frame */ scrollPane = new JScrollPane(FlowtextArea); this.add(scrollPane, constraints); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(400, 600); setLocationRelativeTo(null); // centers on screen }
From source file:components.ColorChooserDemo.java
public ColorChooserDemo() { super(new BorderLayout()); //Set up the banner at the top of the window banner = new JLabel("Welcome to the Tutorial Zone!", JLabel.CENTER); banner.setForeground(Color.yellow); banner.setBackground(Color.blue); banner.setOpaque(true);/*from www. j a v a 2 s . c o m*/ banner.setFont(new Font("SansSerif", Font.BOLD, 24)); banner.setPreferredSize(new Dimension(100, 65)); JPanel bannerPanel = new JPanel(new BorderLayout()); bannerPanel.add(banner, BorderLayout.CENTER); bannerPanel.setBorder(BorderFactory.createTitledBorder("Banner")); //Set up color chooser for setting text color tcc = new JColorChooser(banner.getForeground()); tcc.getSelectionModel().addChangeListener(this); tcc.setBorder(BorderFactory.createTitledBorder("Choose Text Color")); add(bannerPanel, BorderLayout.CENTER); add(tcc, BorderLayout.PAGE_END); }
From source file:jmbench.plots.SummaryWhiskerPlot.java
public JFreeChart createChart() { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(title, "Matrix Libraries", "Relative Performance", dataSet, true);//from ww w .ja va 2 s . co m CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(true); plot.setBackgroundPaint(new Color(230, 230, 230)); plot.setDomainGridlinePaint(new Color(50, 50, 50, 50)); plot.setDomainGridlineStroke(new BasicStroke(78f)); chart.getTitle().setFont(new Font("Times New Roman", Font.BOLD, 24)); String foo = "( Higher is Better )"; if (subtitle != null) foo += " ( " + subtitle + " )"; chart.addSubtitle(new TextTitle(foo, new Font("SansSerif", Font.ITALIC, 12))); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:org.fhcrc.cpl.toolbox.gui.chart.PanelWithBoxAndWhiskerChart.java
protected void init() { dataset = new DefaultBoxAndWhiskerCategoryDataset(); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false);/* w w w .java 2 s. c o m*/ renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryAxis xAxis = new CategoryAxis("Type"); final NumberAxis yAxis = new NumberAxis("Value"); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); final JFreeChart chart = new JFreeChart(getName(), new Font("SansSerif", Font.BOLD, 14), plot, true); init(chart.getPlot()); }
From source file:$.SayHiImage.java
private void writeImage(OutputStream out) throws IOException { BufferedImage img = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = img.createGraphics(); g2d.setPaint(Color.red);// ww w . jav a 2s . co m g2d.setFont(new Font("Serif", Font.BOLD, 36)); g2d.drawString("Hi there, how are you doing today?", 5, g2d.getFontMetrics().getHeight()); g2d.dispose(); ImageIO.write(img, "jpg", out); }
From source file:SimpleAttributes.java
public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setBackground(Color.GRAY); g2d.clearRect(0, 0, getWidth(), getHeight()); // String and line with default attributes g2d.drawString("Default Font", 10, 20); g2d.drawLine(10, 22, 80, 22);/*from ww w . ja v a2 s .c o m*/ // Change the font, foreground color, and Stroke g2d.setFont(g.getFont().deriveFont(Font.BOLD | Font.ITALIC, 24f)); g2d.setColor(Color.WHITE); g2d.setStroke(new BasicStroke(10f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)); // String and line with new attributes g2d.drawString("New Font", 10, 50); g2d.drawLine(10, 57, 120, 57); g2d.dispose(); }
From source file:it.alus.GPSreceiver.instruments.Turnometer.java
public Turnometer() { super(null);//w w w . ja va 2s .c om dataset = new DefaultValueDataset(0.0); DialPlot plot = new DialPlot(); plot.setView(0.0, 0.0, 1.0, 1.0); plot.setDataset(0, dataset); StandardDialFrame dialFrame = new StandardDialFrame(); dialFrame.setBackgroundPaint(Color.lightGray); dialFrame.setForegroundPaint(Color.gray); //DialTextAnnotation titleLabel = new DialTextAnnotation("Vertical speed"); //titleLabel.setFont(new Font("Arial",1,18)); //titleLabel.setRadius(0.45D); //titleLabel.setAngle(90); //titleLabel.setPaint(Color.lightGray); //plot.addLayer(titleLabel); DialTextAnnotation L = new DialTextAnnotation("L"); L.setFont(new Font("Arial", Font.BOLD, 30)); L.setRadius(0.4); L.setPaint(Color.white); L.setAngle(200); plot.addLayer(L); DialTextAnnotation R = new DialTextAnnotation("R"); R.setFont(new Font("Arial", Font.BOLD, 30)); R.setRadius(0.4); R.setPaint(Color.white); R.setAngle(-20); plot.addLayer(R); DialValueIndicator valueindicator = new DialValueIndicator(0); plot.addLayer(valueindicator); DialTextAnnotation annotation = new DialTextAnnotation("deg/min"); annotation.setFont(new Font("Arial", 1, 14)); annotation.setRadius(0.4D); annotation.setPaint(Color.lightGray); plot.addLayer(annotation); plot.setDialFrame(dialFrame); StandardDialScale scale = new StandardDialScale(-540, 540, -135, -270, 90, 9); scale.setMajorTickPaint(Color.white); scale.setMinorTickPaint(Color.lightGray); scale.setFirstTickLabelVisible(true); scale.setTickRadius(0.88); scale.setTickLabelOffset(0.15); NumberFormat formatter = new DecimalFormat("#"); scale.setTickLabelFormatter(formatter); scale.setTickLabelFont(new Font("Arial", Font.BOLD, 24)); scale.setTickLabelPaint(Color.white); plot.addScale(0, scale); plot.setBackground(new DialBackground(Color.black)); Pointer needle = new Pointer(0); needle.setFillPaint(Color.white); plot.addLayer(needle); plot.mapDatasetToScale(1, 1); DialCap cap = new DialCap(); cap.setRadius(0.10); cap.setFillPaint(Color.gray); plot.setCap(cap); jChart = new JFreeChart(plot); super.setChart(jChart); super.setPreferredSize(new Dimension(400, 400)); }