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:mediamatrix.gui.JVMMemoryProfilerPanel.java
public JVMMemoryProfilerPanel() { initComponents();/* w w w . jav a2s . co m*/ profiler = new JVMMemoryProfiler(frequency); profiler.addListener(new JVMMemoryProfilerListener() { @Override public void addScore(long t, long f) { total.add(new Millisecond(), t); free.add(new Millisecond(), f); } }); total = new TimeSeries("Total Memory"); total.setMaximumItemCount(historyCount); free = new TimeSeries("Free Memory"); free.setMaximumItemCount(historyCount); final TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(total); dataset.addSeries(free); final DateAxis domain = new DateAxis("Time"); final NumberAxis range = new NumberAxis("Memory"); domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14)); range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14)); range.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); final XYItemRenderer renderer = new DefaultXYItemRenderer(); renderer.setSeriesPaint(0, Color.red); renderer.setSeriesPaint(1, Color.green); renderer.setBaseStroke(new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); final XYPlot plot = new XYPlot(dataset, domain, range, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); domain.setAutoRange(true); domain.setLowerMargin(0.0); domain.setUpperMargin(0.0); domain.setTickLabelsVisible(true); final JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", Font.BOLD, 24), plot, true); chart.setBackgroundPaint(Color.white); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 12)); add(chartPanel, BorderLayout.CENTER); }
From source file:max.hubbard.Factoring.Graphing.java
public static void makeGraphingInterface() { Interface.mainInterface();//from www. j a v a 2 s .c om panel = new JPanel(new BorderLayout(3, 225)); JPanel pan = new JPanel(); JLabel area = new JLabel("Graphing"); area.setBackground(Color.lightGray); area.setFont(new Font("Times New Roman", Font.BOLD, 20)); pan.add(area, BorderLayout.CENTER); panel.add(pan, BorderLayout.NORTH); final JTextField field = new JTextField(); panel.add(field, BorderLayout.CENTER); field.setFont(new Font("Times New Roman", Font.BOLD, 25)); field.setText("x^4-2x^2-8"); JButton start = new JButton("GO!"); start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panel.updateUI(); Main.label.setText(""); graph(field.getText()); } }); panel.add(start, BorderLayout.SOUTH); Main.getFrame().add(panel, BorderLayout.EAST); Main.getFrame().pack(); }
From source file:org.gdms.usm.view.ProgressFrame.java
public ProgressFrame(Step s, boolean modifyThresholds) { super("Progress"); simulation = s;//from w ww . j a va 2 s . com s.registerStepListener(this); stepSeconds = new LinkedList<Integer>(); s.getManager().setModifyThresholds(modifyThresholds); s.getManager().setAdvisor(this); JPanel statusPanel = new JPanel(new BorderLayout()); JPanel globalPanel = new JPanel(new SpringLayout()); //Time elapsed panel JPanel timePanel = new JPanel(new BorderLayout(5, 5)); final JLabel timeLabel = new JLabel("00:00:00", SwingConstants.CENTER); timeLabel.setFont(new Font("Serif", Font.BOLD, 45)); timePanel.add(timeLabel, BorderLayout.SOUTH); JLabel elapsed = new JLabel("Time Elapsed :", SwingConstants.CENTER); timePanel.add(elapsed, BorderLayout.NORTH); statusPanel.add(timePanel, BorderLayout.NORTH); ActionListener timerListener = new ActionListener() { public void actionPerformed(ActionEvent e) { totalSeconds++; int hours = totalSeconds / 3600; String hourss; if (hours < 10) { hourss = "0" + hours; } else { hourss = "" + hours; } int minutes = (totalSeconds % 3600) / 60; String minutess; if (minutes < 10) { minutess = "0" + minutes; } else { minutess = "" + minutes; } int seconds = totalSeconds % 60; String secondss; if (seconds < 10) { secondss = "0" + seconds; } else { secondss = seconds + ""; } timeLabel.setText(hourss + ":" + minutess + ":" + secondss); } }; timer = new Timer(1000, timerListener); timer.start(); //Turn progress panel JPanel turnPanel = new JPanel(new BorderLayout(5, 5)); JLabel turnLabel = new JLabel("Current Step :", SwingConstants.CENTER); turnPanel.add(turnLabel, BorderLayout.NORTH); currentTurn = new JLabel("Init", SwingConstants.CENTER); currentTurn.setFont(new Font("Serif", Font.BOLD, 30)); turnPanel.add(currentTurn, BorderLayout.SOUTH); globalPanel.add(turnPanel); //Movers panel JPanel moversPanel = new JPanel(new BorderLayout(5, 5)); JLabel moversLabel = new JLabel("Last movers count :", SwingConstants.CENTER); moversPanel.add(moversLabel, BorderLayout.NORTH); lastMoversCount = new JLabel("Init", SwingConstants.CENTER); lastMoversCount.setFont(new Font("Serif", Font.BOLD, 30)); moversPanel.add(lastMoversCount, BorderLayout.SOUTH); globalPanel.add(moversPanel); //Initial population panel JPanel initPopPanel = new JPanel(new BorderLayout(5, 5)); JLabel initialPopulationLabel = new JLabel("Initial population :", SwingConstants.CENTER); initPopPanel.add(initialPopulationLabel, BorderLayout.NORTH); initialPopulationCount = new JLabel("Init", SwingConstants.CENTER); initialPopulationCount.setFont(new Font("Serif", Font.BOLD, 30)); initPopPanel.add(initialPopulationCount, BorderLayout.SOUTH); globalPanel.add(initPopPanel); //Current population panel JPanel curPopPanel = new JPanel(new BorderLayout(5, 5)); JLabel currentPopulationLabel = new JLabel("Current population :", SwingConstants.CENTER); curPopPanel.add(currentPopulationLabel, BorderLayout.NORTH); currentPopulation = new JLabel("Init", SwingConstants.CENTER); currentPopulation.setFont(new Font("Serif", Font.BOLD, 30)); curPopPanel.add(currentPopulation, BorderLayout.SOUTH); globalPanel.add(curPopPanel); //Dead panel JPanel deadPanel = new JPanel(new BorderLayout(5, 5)); JLabel deadLabel = new JLabel("Last death toll :", SwingConstants.CENTER); deadPanel.add(deadLabel, BorderLayout.NORTH); lastDeathToll = new JLabel("Init", SwingConstants.CENTER); lastDeathToll.setFont(new Font("Serif", Font.BOLD, 30)); deadPanel.add(lastDeathToll, BorderLayout.SOUTH); globalPanel.add(deadPanel); //Newborn panel JPanel newbornPanel = new JPanel(new BorderLayout(5, 5)); JLabel newbornLabel = new JLabel("Last newborn count :", SwingConstants.CENTER); newbornPanel.add(newbornLabel, BorderLayout.NORTH); lastNewbornCount = new JLabel("Init", SwingConstants.CENTER); lastNewbornCount.setFont(new Font("Serif", Font.BOLD, 30)); newbornPanel.add(lastNewbornCount, BorderLayout.SOUTH); globalPanel.add(newbornPanel); SpringUtilities.makeCompactGrid(globalPanel, 3, 2, 5, 5, 20, 10); statusPanel.add(globalPanel, BorderLayout.SOUTH); add(statusPanel, BorderLayout.WEST); //Graph tabbed pane JTabbedPane tabbedPane = new JTabbedPane(); timeChart = new XYSeries("Step time", true, false); tabbedPane.addTab("Step time", createChartPanel("Step time", timeChart)); currentPopulationChart = new XYSeries("Population", true, false); tabbedPane.addTab("Population", createChartPanel("Population", currentPopulationChart)); deathTollChart = new XYSeries("Deaths", true, false); tabbedPane.addTab("Deaths", createChartPanel("Deaths", deathTollChart)); newbornCountChart = new XYSeries("Newborn", true, false); tabbedPane.addTab("Newborn", createChartPanel("Newborn", newbornCountChart)); moversCountChart = new XYSeries("Movers", true, false); tabbedPane.addTab("Movers", createChartPanel("Movers", moversCountChart)); add(tabbedPane, BorderLayout.EAST); getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 10)); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); }
From source file:binky.reportrunner.ui.actions.admin.GetAuditChartAction.java
@Override @PreAuthorize("hasRole('ROLE_ADMIN')") public String execute() throws Exception { // do some stuff and get a chart going // DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); TimeSeriesCollection dataSet = new TimeSeriesCollection(); List<RunnerHistoryEvent> events = auditService.getSuccessEvents(module, new Date(fromDate), new Date(toDate)); Map<String, TimeSeries> serieses = new HashMap<String, TimeSeries>(); for (RunnerHistoryEvent e : events) { TimeSeries s = serieses.get(e.getMethod()); if (s == null) { s = new TimeSeries(e.getMethod()); serieses.put(e.getMethod(), s); }/* w ww . java 2 s .c o m*/ s.addOrUpdate(new Millisecond(e.getTimeStamp()), e.getRunTime()); } for (TimeSeries s : serieses.values()) { dataSet.addSeries(s); } chart = ChartFactory.createTimeSeriesChart(module, "", "run time (ms)", dataSet, true, false, false); // .createLineChart("","","Run Time (ms)",dataSet,PlotOrientation.VERTICAL, // true,false,false); XYPlot linePlot = (XYPlot) chart.getPlot(); linePlot.setDomainGridlinesVisible(true); linePlot.setRangeGridlinesVisible(true); linePlot.setRangeGridlinePaint(Color.black); linePlot.setDomainGridlinePaint(Color.black); TextTitle subTitle = new TextTitle("Successful Executions"); subTitle.setFont(new Font("Arial", Font.ITALIC, 10)); chart.addSubtitle(subTitle); chart.getTitle().setFont(new Font("Arial", Font.BOLD, 12)); DateAxis axis = (DateAxis) linePlot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("hh:mm:ss dd-MM-yyyy")); XYItemRenderer r = linePlot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); } chart.setAntiAlias(true); chart.setTextAntiAlias(true); return SUCCESS; }
From source file:com.floreantpos.ui.dialog.PasswordEntryDialog.java
private JPanel createInputPanel() { JPanel inputPanel = new JPanel(new BorderLayout(5, 5)); tfPassword = new JPasswordField(); tfPassword.setFont(tfPassword.getFont().deriveFont(Font.BOLD, PosUIManager.getNumberFieldFontSize())); tfPassword.setFocusable(true);/* www. j a va 2 s . c o m*/ tfPassword.requestFocus(); tfPassword.setBackground(Color.WHITE); tfPassword.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { String secretKey = getPasswordAsString(); if (secretKey != null && secretKey.length() == TerminalConfig.getDefaultPassLen()) { statusLabel.setText(""); //$NON-NLS-1$ if (checkLogin(secretKey)) { setCanceled(false); dispose(); } } } @Override public void keyPressed(KeyEvent e) { } }); inputPanel.add(tfPassword, BorderLayout.NORTH); statusLabel = new JLabel(); statusLabel.setHorizontalAlignment(JLabel.CENTER); inputPanel.add(statusLabel); return inputPanel; }
From source file:net.sf.dynamicreports.test.jasper.chart.XyAreaChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/* w w w . j ava 2 s . c o m*/ JFreeChart chart = getChart("summary.chart1", 0); Axis axis = chart.getXYPlot().getDomainAxis(); XYPlot plot = chart.getXYPlot(); Assert.assertEquals("renderer", XYAreaRenderer.class, plot.getRenderer().getClass()); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart2", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:com.fisher.mainFrame.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - nick xu dialogPane = new JPanel(); contentPanel = new JPanel(); scrollPaneLogArea = new JScrollPane(); logArea = new JTextArea(); buttonBar = new JPanel(); startButton = new JButton(); stopButton = new JButton(); //======== this ======== setTitle("Fish Transform Trading"); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {/*from ww w . j a va 2 s . c o m*/ dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setPreferredSize(new Dimension(758, 900)); // JFormDesigner evaluation mark dialogPane.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), dialogPane.getBorder())); dialogPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { //======== scrollPaneLogArea ======== { scrollPaneLogArea.setViewportView(logArea); } GroupLayout contentPanelLayout = new GroupLayout(contentPanel); contentPanel.setLayout(contentPanelLayout); contentPanelLayout.setHorizontalGroup(contentPanelLayout.createParallelGroup() .addComponent(scrollPaneLogArea, GroupLayout.DEFAULT_SIZE, 734, Short.MAX_VALUE)); contentPanelLayout .setVerticalGroup(contentPanelLayout.createParallelGroup() .addGroup(contentPanelLayout .createSequentialGroup().addComponent(scrollPaneLogArea, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE) .addGap(0, 476, Short.MAX_VALUE))); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonBar.setLayout(new GridBagLayout()); ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] { 0, 85, 80 }; ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] { 1.0, 0.0, 0.0 }; //---- startButton ---- startButton.setText("Start"); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startButtonActionPerformed(e); } }); buttonBar.add(startButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); //---- stopButton ---- stopButton.setText("Stop"); stopButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { stopButtonActionPerformed(e); } }); buttonBar.add(stopButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:daylightchart.daylightchart.chart.DaylightChart.java
/** * {@inheritDoc}//from ww w . j a v a2s .c o m * * @see daylightchart.options.chart.ChartOptionsListener#afterSettingChartOptions(ChartOptions) */ @Override public void afterSettingChartOptions(final ChartOptions chartOptions) { Font titleFont; final TextTitle title = getTitle(); if (title != null) { titleFont = title.getFont(); } else { titleFont = ChartConfiguration.chartFont; } createTitles(chartOptions, titleFont.deriveFont(Font.BOLD, 18)); }
From source file:org.jfree.fx.demo.FXGraphics2DDemo1.java
/** * Creates a chart.//ww w. j a v a2s . co m * * @param dataset a dataset. * * @return A chart. */ private static JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart("International Coffee Organisation : Coffee Prices", // title null, // x-axis label "US cents/lb", // y-axis label dataset); String fontName = "Palatino"; chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18)); chart.addSubtitle(new TextTitle("Source: http://www.ico.org/historical/2010-19/PDF/HIST-PRICES.pdf", new Font(fontName, Font.PLAIN, 14))); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainPannable(true); plot.setRangePannable(false); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14)); chart.getLegend().setFrame(BlockBorder.NONE); chart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(false); renderer.setDrawSeriesLineAsPath(true); // set the default stroke for all series renderer.setAutoPopulateSeriesStroke(false); renderer.setDefaultStroke(new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL), false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, new Color(24, 123, 58)); renderer.setSeriesPaint(2, new Color(149, 201, 136)); renderer.setSeriesPaint(3, new Color(1, 62, 29)); renderer.setSeriesPaint(4, new Color(81, 176, 86)); renderer.setSeriesPaint(5, new Color(0, 55, 122)); renderer.setSeriesPaint(6, new Color(0, 92, 165)); } return chart; }
From source file:com.glaf.chart.util.ChartUtils.java
public static void setChartTheme(Chart chartModel) { // ?/*from w w w . j a v a 2 s . co m*/ StandardChartTheme standardChartTheme = new StandardChartTheme("cn"); // if (chartModel.getChartTitleFont() != null && chartModel.getChartTitleFontSize() != null && chartModel.getChartTitleFontSize() > 0) { standardChartTheme.setExtraLargeFont( new Font(chartModel.getChartTitleFont(), Font.BOLD, chartModel.getChartTitleFontSize())); } else { standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 18)); } if (chartModel.getChartFont() != null && chartModel.getChartFontSize() > 0) { // standardChartTheme .setRegularFont(new Font(chartModel.getChartFont(), Font.PLAIN, chartModel.getChartFontSize())); // ? standardChartTheme .setLargeFont(new Font(chartModel.getChartFont(), Font.PLAIN, chartModel.getChartFontSize())); } else { // standardChartTheme.setRegularFont(new Font("", Font.PLAIN, 14)); // ? standardChartTheme.setLargeFont(new Font("", Font.PLAIN, 14)); } // ? ChartFactory.setChartTheme(standardChartTheme); }