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:net.sf.dynamicreports.test.jasper.chart.ChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from w w w . j ava 2s . com chartCountTest("summary.chart1", 1); JFreeChart chart = getChart("summary.chart1", 0); TextTitle title = chart.getTitle(); Assert.assertEquals("title", "title", title.getText()); Assert.assertEquals("title color", Color.BLUE, title.getPaint()); Assert.assertEquals("title font", new Font("Arial", Font.BOLD, 10), title.getFont()); Assert.assertEquals("title position", RectangleEdge.RIGHT, title.getPosition()); TextTitle subtitle = (TextTitle) chart.getSubtitle(1); Assert.assertEquals("subtitle", "subtitle", subtitle.getText()); Assert.assertEquals("subtitle color", Color.CYAN, subtitle.getPaint()); Assert.assertEquals("subtitle font", new Font("Arial", Font.PLAIN, 10), subtitle.getFont()); LegendTitle legend = (LegendTitle) chart.getSubtitle(0); Assert.assertEquals("legend color", Color.BLUE, legend.getItemPaint()); Assert.assertEquals("legend backgroundcolor", Color.LIGHT_GRAY, legend.getBackgroundPaint()); Assert.assertEquals("legend font", new Font("Courier New", Font.PLAIN, 10), legend.getItemFont()); Assert.assertEquals("legend position", RectangleEdge.LEFT, legend.getPosition()); chartCountTest("summary.chart2", 1); chart = getChart("summary.chart2", 0); Assert.assertNull("legend", chart.getLegend()); Assert.assertEquals("plot orientation", PlotOrientation.HORIZONTAL, chart.getCategoryPlot().getOrientation()); Assert.assertEquals("plot series colors", Color.BLUE, chart.getPlot().getDrawingSupplier().getNextPaint()); Assert.assertEquals("plot series colors", Color.GREEN, chart.getPlot().getDrawingSupplier().getNextPaint()); Assert.assertEquals("plot series colors", Color.RED, chart.getPlot().getDrawingSupplier().getNextPaint()); }
From source file:org.jfree.chart.demo.BoxAndWhiskerDemo.java
/** * Creates a new demo./* ww w . j a v a2 s . c o m*/ * * @param title the frame title. */ public BoxAndWhiskerDemo(final String title) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(); final CategoryAxis xAxis = new CategoryAxis("Type"); final NumberAxis yAxis = new NumberAxis("Value"); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); final JFreeChart chart = new JFreeChart("Box-and-Whisker Demo", new Font("SansSerif", Font.BOLD, 14), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(450, 270)); setContentPane(chartPanel); }
From source file:org.jfree.experimental.chart.plot.dial.DialTextAnnotation.java
/** * Creates a new instance of <code>DialTextAnnotation</code>. * /*from w ww. ja v a2 s . c o m*/ * @param label the label (<code>null</code> not permitted). */ public DialTextAnnotation(String label) { if (label == null) { throw new IllegalArgumentException("Null 'label' argument."); } this.angle = -90.0; this.radius = 0.3; this.font = new Font("Dialog", Font.BOLD, 14); this.paint = Color.black; this.label = label; this.anchor = TextAnchor.TOP_CENTER; }
From source file:com.game.ui.views.PlayerEditor.java
public void doGui() { // setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setLayout(new GridBagLayout()); GridBagConstraints c1 = new GridBagConstraints(); c1.fill = GridBagConstraints.NONE; c1.anchor = GridBagConstraints.WEST; c1.insets = new Insets(10, 5, 10, 5); c1.weightx = 0;/*from w w w . j a v a2s . co m*/ c1.weighty = 0; JLabel noteLbl = new JLabel("Pls select a value to choose a Player or you can create a new " + "Player entity below. Once selected a Player character, its' details will be available below"); add(noteLbl, c1); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (GameCharacter character : GameBean.playerDetails) { model.addElement(((Player) character).getType()); } c1.gridy = 1; comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(comboBox, c1); JPanel wrapperPanel = new JPanel(new GridLayout(1, 2, 10, 10)); wrapperPanel.setBorder(LineBorder.createGrayLineBorder()); leftPanel = new JPanel(); leftPanel.setAlignmentX(0); leftPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel enemyDtlLbl = new JLabel("Enemy Character Details : "); enemyDtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); leftPanel.add(enemyDtlLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); leftPanel.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); leftPanel.add(name, c); c.gridx = 0; c.gridy = 2; JLabel imageLbl = new JLabel("Image Path : "); leftPanel.add(imageLbl, c); c.gridx = 1; JTextField image = new JTextField(""); image.setColumns(20); leftPanel.add(image, c); c.gridx = 0; c.gridy = 3; JLabel healthLbl = new JLabel("Health Pts : "); leftPanel.add(healthLbl, c); c.gridx = 1; JTextField health = new JTextField(""); health.setColumns(20); leftPanel.add(health, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); leftPanel.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); leftPanel.add(attackPts, c); c.gridx = 0; c.gridy = 5; JLabel armoursPtsLbl = new JLabel("Armour Points : "); leftPanel.add(armoursPtsLbl, c); c.gridx = 1; JTextField armourPts = new JTextField(""); armourPts.setColumns(20); leftPanel.add(armourPts, c); c.gridx = 0; c.gridy = 6; JLabel attackRngeLbl = new JLabel("Attack Range : "); leftPanel.add(attackRngeLbl, c); c.gridx = 1; JTextField attackRnge = new JTextField(""); attackRnge.setColumns(20); leftPanel.add(attackRnge, c); c.gridx = 0; c.gridy = 7; JLabel movementLbl = new JLabel("Movement : "); leftPanel.add(movementLbl, c); c.gridx = 1; JTextField movement = new JTextField(""); movement.setColumns(20); leftPanel.add(movement, c); c.gridx = 0; c.gridy = 8; JLabel typeLbl = new JLabel("Type : "); leftPanel.add(typeLbl, c); c.gridx = 1; JTextField typeTxt = new JTextField(""); typeTxt.setColumns(20); leftPanel.add(typeTxt, c); c.gridx = 0; c.gridy = 9; JLabel weaponLbl = new JLabel("Equipped Weapon : "); leftPanel.add(weaponLbl, c); c.gridx = 1; DefaultComboBoxModel weapon = new DefaultComboBoxModel(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { weapon.addElement(((Weapon) item).getName()); } } JComboBox weaponDrpDown = new JComboBox(weapon); weaponDrpDown.setSelectedIndex(-1); weaponDrpDown.setMaximumSize(new Dimension(100, 30)); leftPanel.add(weaponDrpDown, c); c.gridx = 0; c.gridy = 10; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); leftPanel.add(submit, c); wrapperPanel.add(leftPanel); lvlPanel = new LevelPanel(true, null); wrapperPanel.add(lvlPanel); c1.gridy = 2; c1.fill = GridBagConstraints.BOTH; add(wrapperPanel, c1); c1.fill = GridBagConstraints.NONE; validationMess = new JLabel("Pls enter all the fields or pls choose a character from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); c1.gridy = 3; add(validationMess, c1); c1.weightx = 1; c1.fill = GridBagConstraints.BOTH; c1.weighty = 1; c1.gridy = 4; add(new JPanel(), c1); }
From source file:icaro.aplicaciones.recursos.recursoEstadistica.jFreeChart.demo.PieChartDemo1.java
/** * Creates a chart./*from w w w . j a va 2 s .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:com.hp.alm.ali.idea.content.settings.SettingsPanel.java
public SettingsPanel(final Project prj, Color bgColor) { this.prj = prj; this.projectConf = prj.getComponent(AliProjectConfiguration.class); previewAndConnection = new JPanel(new GridBagLayout()); previewAndConnection.setOpaque(false); GridBagConstraints c2 = new GridBagConstraints(); c2.gridx = 0;/*from ww w. j ava 2 s . c o m*/ c2.gridy = 1; c2.gridwidth = 2; c2.weighty = 1; c2.fill = GridBagConstraints.VERTICAL; JPanel filler = new JPanel(); filler.setOpaque(false); previewAndConnection.add(filler, c2); passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); passwordPanel.setBackground(bgColor); JLabel label = new JLabel("Password"); label.setFont(label.getFont().deriveFont(Font.BOLD)); passwordPanel.add(label); final JPasswordField password = new JPasswordField(24); passwordPanel.add(password); JButton connect = new JButton("Login"); passwordPanel.add(connect); final JLabel message = new JLabel(); passwordPanel.add(message); ActionListener connectionAction = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { checkConnection(projectConf.getLocation(), projectConf.getDomain(), projectConf.getProject(), projectConf.getUsername(), password.getText()); } catch (AuthenticationFailed e) { message.setText(e.getMessage()); return; } projectConf.ALM_PASSWORD = password.getText(); projectConf.fireChanged(); } }; password.addActionListener(connectionAction); connect.addActionListener(connectionAction); restService = prj.getComponent(RestService.class); restService.addServerTypeListener(this); location = createTextPane(bgColor); domain = createTextPane(bgColor); project = createTextPane(bgColor); username = createTextPane(bgColor); final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(bgColor); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); final JTextPane textPane = new JTextPane(); textPane.setEditorKit(new HTMLEditorKit()); textPane.setText( "<html><body>HP ALM integration can be configured on <a href=\"ide\">IDE</a> and overridden on <a href=\"project\">project</a> level.</body></html>"); textPane.setEditable(false); textPane.addHyperlinkListener(this); textPane.setBackground(bgColor); textPane.setCaret(new NonAdjustingCaret()); panel.add(textPane, BorderLayout.CENTER); JPanel content = new JPanel(new BorderLayout()); content.setBackground(bgColor); content.add(panel, BorderLayout.NORTH); content.add(previewAndConnection, BorderLayout.WEST); preview = new JPanel(new GridBagLayout()) { public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); // make enough room for the connection status message dim.width = Math.max(dim.width, 300); return dim; } public Dimension getMinimumSize() { return getPreferredSize(); } }; connectedTo(restService.getServerTypeIfAvailable()); preview.setBackground(bgColor); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; preview.add(location, c); c.gridwidth = 1; c.gridy++; preview.add(domain, c); c.gridy++; preview.add(project, c); c.gridy++; preview.add(username, c); c.gridx++; c.gridy--; c.gridheight = 2; c.weightx = 0; c.anchor = GridBagConstraints.SOUTHEAST; final LinkLabel reload = new LinkLabel("Reload", IconLoader.getIcon("/actions/sync.png")); reload.setListener(new LinkListener() { public void linkSelected(LinkLabel linkLabel, Object o) { projectConf.fireChanged(); } }, null); preview.add(reload, c); JPanel previewNorth = new JPanel(new BorderLayout()); previewNorth.setBackground(bgColor); previewNorth.add(preview, BorderLayout.NORTH); addToGridBagPanel(0, 0, previewAndConnection, previewNorth); setBackground(bgColor); setLayout(new BorderLayout()); add(content, BorderLayout.CENTER); onChanged(); ApplicationManager.getApplication().getComponent(AliConfiguration.class).addListener(this); projectConf.addListener(this); }
From source file:FontDemo.java
/** * Draws the font names in its font. Called by AWT when painting is needed * Does lazy evaluation of Font creation, caching the results (without this, * scrolling performance suffers even on a P3-750). *//*from w w w .j a va 2s.c om*/ public void paint(Graphics g) { for (int i = 0; i < fontNames.length; i += 1) { if (fonts[i] == null) { fonts[i] = new Font(fontNames[i], Font.BOLD, 14); } g.setFont(fonts[i]); int x = 20; int y = 20 + (YINCR * i); g.drawString(fontNames[i], x, y); } }
From source file:misc.TablePrintDemo1.java
/** * Constructs an instance of the demo.//w w w .ja v a2 s . c o m */ public TablePrintDemo1() { super("Table Printing Demo 1"); gradesLabel = new JLabel("Final Grades - CSC 101"); gradesLabel.setFont(new Font("Dialog", Font.BOLD, 16)); gradesTable = createTable(new GradesModel()); gradesTable.setFillsViewportHeight(true); gradesTable.setRowHeight(24); /* Set a custom renderer on the "Passed" column */ gradesTable.getColumn("Passed").setCellRenderer(createPassedColumnRenderer()); scroll = new JScrollPane(gradesTable); String tooltipText; tooltipText = "Include a page header"; headerBox = new JCheckBox("Header:", true); headerBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { headerField.setEnabled(headerBox.isSelected()); } }); headerBox.setToolTipText(tooltipText); tooltipText = "Page Header (Use {0} to include page number)"; headerField = new JTextField("Final Grades - CSC 101"); headerField.setToolTipText(tooltipText); tooltipText = "Include a page footer"; footerBox = new JCheckBox("Footer:", true); footerBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { footerField.setEnabled(footerBox.isSelected()); } }); footerBox.setToolTipText(tooltipText); tooltipText = "Page Footer (Use {0} to Include Page Number)"; footerField = new JTextField("Page {0}"); footerField.setToolTipText(tooltipText); tooltipText = "Show the Print Dialog Before Printing"; showPrintDialogBox = new JCheckBox("Show print dialog", true); showPrintDialogBox.setToolTipText(tooltipText); showPrintDialogBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!showPrintDialogBox.isSelected()) { JOptionPane.showMessageDialog(TablePrintDemo1.this, "If the Print Dialog is not shown," + " the default printer is used.", "Printing Message", JOptionPane.INFORMATION_MESSAGE); } } }); tooltipText = "Keep the GUI Responsive and Show a Status Dialog During Printing"; interactiveBox = new JCheckBox("Interactive (Show status dialog)", true); interactiveBox.setToolTipText(tooltipText); interactiveBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!interactiveBox.isSelected()) { JOptionPane.showMessageDialog(TablePrintDemo1.this, "If non-interactive, the GUI is fully blocked" + " during printing.", "Printing Message", JOptionPane.INFORMATION_MESSAGE); } } }); tooltipText = "Shrink the Table to Fit the Entire Width on a Page"; fitWidthBox = new JCheckBox("Fit width to printed page", true); fitWidthBox.setToolTipText(tooltipText); tooltipText = "Print the Table"; printButton = new JButton("Print"); printButton.setToolTipText(tooltipText); printButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { printGradesTable(); } }); contentPane = new JPanel(); addComponentsToContentPane(); setContentPane(contentPane); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(700, 600); setLocationRelativeTo(null); }
From source file:com.ibm.watson.WatsonVRTraining.util.images.PhotoCaptureFrame.java
PhotoCaptureFrame() { jp = new JPanel(); jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); JScrollPane scrollPane = new JScrollPane(jp); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); scrollPane.setPreferredSize(new Dimension(dim.width / 2 - 40, dim.height - 117)); JButton btn = new JButton("Upload Image"); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(System.getenv("user.home")); fc.setFileFilter(new JPEGImageFileFilter()); int res = fc.showOpenDialog(null); // We have an image! try { if (res == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); //SharedResources.sharedCache.getCapturedImageList().add(file); File tmpf_name = File.createTempFile("tmp", "." + FilenameUtils.getExtension(file.getName())); System.out.println("cp " + file.getPath() + " " + AppConstants.vr_process_img_dir_path + File.separator + tmpf_name.getName()); new CommandsUtils().executeCommand("bash", "-c", "cp " + file.getPath() + " " + AppConstants.vr_process_img_dir_path + File.separator + tmpf_name.getName()); }/* w ww . j av a2s. c o m*/ } catch (Exception iOException) { } } }); ImageRemainingProcessingLabel = new JLabel("REMAINIG IMAGES:0"); ImageRemainingProcessingLabel.setHorizontalAlignment(SwingConstants.LEFT); ImageRemainingProcessingLabel.setFont(new Font("Arial", Font.BOLD, 13)); ImagebeingProcessedLabel = new JLabel(" PROCESSING IMAGES:0"); ImagebeingProcessedLabel.setHorizontalAlignment(SwingConstants.LEFT); ImagebeingProcessedLabel.setFont(new Font("Arial", Font.BOLD, 13)); appIDLabel = new JLabel("APP-ID:" + AppConstants.unique_app_id); appIDLabel.setHorizontalAlignment(SwingConstants.LEFT); appIDLabel.setFont(new Font("Arial", Font.BOLD, 13)); headerPanel = new JPanel(new FlowLayout()); headerPanel.add(ImageRemainingProcessingLabel); headerPanel.add(ImagebeingProcessedLabel); headerPanel.add(btn); headerPanel.add(appIDLabel); headerPanel.setSize(new Dimension(getWidth(), 10)); JPanel contentPane = new JPanel(); contentPane.add(headerPanel); contentPane.add(scrollPane); f = new JFrame("IBM Watson Visual Prediction Window"); f.setContentPane(contentPane); f.setSize(dim.width / 2 - 30, dim.height - 40); f.setLocation(dim.width / 2, 0); f.setResizable(false); f.setPreferredSize(new Dimension(dim.width / 2 - 30, dim.height - 60)); f.setVisible(true); }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.InitializrProjectPanelVisual2.java
/** * Fixes the boot version of the dependencies. * <p>/*from w w w .ja v a 2 s. c o m*/ * Does nothing if the panel has not been initialized. * * @param bootVersion */ public void fixBootVersion(String bootVersion) { Objects.requireNonNull(bootVersion); if (initialized) { // substitute combo with label javax.swing.GroupLayout layout = (javax.swing.GroupLayout) this.getLayout(); final JLabel label = new JLabel(bootVersion); label.setFont(label.getFont().deriveFont(Font.BOLD)); layout.replace(cbBootVersion, label); // adapt dependencies panel pBootDependencies.adaptToBootVersion(bootVersion); } }