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.GroupedStackedBarChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//w ww. j a va 2 s .c om JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", GroupedStackedBarRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible()); Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickLabelsVisible()); Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickMarksVisible()); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); 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()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().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:edu.ucla.stat.SOCR.analyses.gui.AnovaTwoWay.java
/**Initialize the Analysis*/ public void init() { showInput = false;//from w w w. jav a2 s. c om showSelect = false; showVisualize = false; super.init(); analysisType = AnalysisType.ANOVA_TWO_WAY; useInputExample = false; useLocalExample = false; useRandomExample = false; //useServerExample = false; useStaticExample = AnovaTwoWayExamples.availableExamples; onlineDescription = "http://wiki.stat.ucla.edu/socr/index.php/SOCR_EduMaterials_AnalysisActivities_ANOVA_2"; depMax = 1; // max number of dependent var indMax = 2; // max number of independent var resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize)); frame = getFrame(this); setName("Two Way ANOVA"); // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); this.getContentPane().add(toolBar, BorderLayout.NORTH); // use the new JFreeChar function. annie che 20060312 chartFactory = new Chart(); resetGraph(); validate(); }
From source file:main.java.gui.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - BOHDAN Korinnyi test = new JFrame(); label1 = new JLabel(); textField1 = new JTextField(); label2 = new JLabel(); textField2 = new JTextField(); label3 = new JLabel(); label4 = new JLabel(); textField3 = new JTextField(); textField4 = new JTextField(); button1 = new JButton(); button2 = new JButton(); label5 = new JLabel(); label6 = new JLabel(); //======== test ======== {/*from ww w. j a v a 2s . c o m*/ test.setTitle("Pay mobile account"); Container testContentPane = test.getContentPane(); testContentPane.setLayout(null); //---- label1 ---- label1.setText("\u0421\u0443\u043c\u0430"); label1.setFont(label1.getFont().deriveFont(label1.getFont().getSize() + 4f)); testContentPane.add(label1); label1.setBounds(new Rectangle(new Point(35, 30), label1.getPreferredSize())); //---- textField1 ---- textField1.setColumns(10); testContentPane.add(textField1); textField1.setBounds(150, 30, 105, textField1.getPreferredSize().height); //---- label2 ---- label2.setText("\u041d\u043e\u043c\u0435\u0440"); label2.setFont(label2.getFont().deriveFont(label2.getFont().getSize() + 4f)); testContentPane.add(label2); label2.setBounds(new Rectangle(new Point(35, 60), label2.getPreferredSize())); //---- textField2 ---- textField2.setText("0674060606"); textField2.setFont(textField2.getFont().deriveFont(textField2.getFont().getSize() + 2f)); testContentPane.add(textField2); textField2.setBounds(150, 60, 105, textField2.getPreferredSize().height); //---- label3 ---- label3.setText("\u041b\u043e\u0433\u0456\u043d"); label3.setFont(label3.getFont().deriveFont(label3.getFont().getSize() + 4f)); testContentPane.add(label3); label3.setBounds(new Rectangle(new Point(35, 95), label3.getPreferredSize())); //---- label4 ---- label4.setText("\u041f\u0430\u0440\u043e\u043b\u044c"); label4.setFont(label4.getFont().deriveFont(label4.getFont().getSize() + 4f)); testContentPane.add(label4); label4.setBounds(new Rectangle(new Point(35, 125), label4.getPreferredSize())); testContentPane.add(textField3); textField3.setBounds(150, 95, 105, textField3.getPreferredSize().height); testContentPane.add(textField4); textField4.setBounds(150, 125, 105, 20); //---- button1 ---- button1.setText("\u041e\u043f\u043b\u0430\u0442\u0438\u0442\u0438"); button1.setFont(button1.getFont().deriveFont(button1.getFont().getStyle() | Font.BOLD, button1.getFont().getSize() + 2f)); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String strTemp = textField1.getText(); int cash = Integer.parseInt(strTemp); if (cash < 1) { JOptionPane.showMessageDialog(null, " '", "", JOptionPane.OK_OPTION); textField1.setText("0"); } else if (textField3.getText().equals("test4") && textField4.getText().equals("12345")) { check c = new check(); pay p = new pay(); getstatus g = new getstatus(); try { c.connection(c.PaymentCollectionRequest("38" + getNumber(), getMoney())); g.connection(c.PaymentStatusRequest()); p.connection(c.PaymentCollectionRequest("38" + getNumber(), getMoney())); g.connection(c.PaymentStatusRequest()); information i = new information(); daoImplements h = new daoImplements(); long curTime = System.currentTimeMillis(); String curStringDate = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(curTime); i.setIdTransaction(getTransaction.setGetTransaction()); i.setData(curStringDate); i.setNumber(Integer.parseInt(getNumber())); i.setSuma(Integer.parseInt(getMoney())); i.setStatus(parserStatus.getStatusParsing()); h.addInfo(i); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ParseException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } } else { JOptionPane.showMessageDialog(null, " ", "", JOptionPane.OK_OPTION); System.exit(0); } } }); testContentPane.add(button1); button1.setBounds(150, 155, 115, 25); //---- button2 ---- button2.setText("\u0406\u0441\u0442\u043e\u0440\u0456\u044f"); button2.setFont(button2.getFont().deriveFont(button2.getFont().getStyle() | Font.BOLD, button2.getFont().getSize() + 2f)); button2.setActionCommand("\u0406\u0441\u0442\u043e\u0440\u0456\u044f"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tableData t = new tableData(); } }); testContentPane.add(button2); button2.setBounds(15, 155, 115, 25); //---- label5 ---- label5.setText( "\u0422\u0435\u0441\u0442\u043e\u0432\u0438\u0439 \u0441\u0435\u0440\u0432\u0456\u0441 \u043f\u043e\u043f\u043e\u0432\u043d\u0435\u043d\u043d\u044f \u043c\u043e\u0431\u0456\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0445\u0443\u043d\u043a\u0443"); label5.setFont(label5.getFont().deriveFont(label5.getFont().getStyle() & ~Font.ITALIC)); testContentPane.add(label5); label5.setBounds(15, 0, 255, 20); //---- label6 ---- label6.setText("38"); label6.setFont(label6.getFont().deriveFont(label6.getFont().getSize() + 4f)); testContentPane.add(label6); label6.setBounds(new Rectangle(new Point(130, 60), label6.getPreferredSize())); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < testContentPane.getComponentCount(); i++) { Rectangle bounds = testContentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = testContentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; testContentPane.setMinimumSize(preferredSize); testContentPane.setPreferredSize(preferredSize); } test.pack(); test.setLocationRelativeTo(test.getOwner()); } // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:net.sf.dynamicreports.test.jasper.chart.LayeredBarChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*w w w.j a va2s . com*/ JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", LayeredBarRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible()); Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible()); Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible()); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); 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()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().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:net.pms.newgui.GeneralTab.java
public JComponent build() { // Apply the orientation for the locale Locale locale = new Locale(configuration.getLanguage()); ComponentOrientation orientation = ComponentOrientation.getOrientation(locale); String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation); FormLayout layout = new FormLayout(colSpec, ROW_SPEC); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(Borders.DLU4_BORDER); builder.setOpaque(true);//from w w w.j a va 2 s. c o m CellConstraints cc = new CellConstraints(); smcheckBox = new JCheckBox(Messages.getString("NetworkTab.3")); smcheckBox.setContentAreaFilled(false); smcheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setMinimized((e.getStateChange() == ItemEvent.SELECTED)); } }); if (configuration.isMinimized()) { smcheckBox.setSelected(true); } JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), FormLayoutUtil.flip(cc.xyw(1, 1, 9), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); builder.addLabel(Messages.getString("NetworkTab.0"), FormLayoutUtil.flip(cc.xy(1, 7), colSpec, orientation)); final KeyedComboBoxModel kcbm = new KeyedComboBoxModel( new Object[] { "ar", "bg", "ca", "zhs", "zht", "cz", "da", "nl", "en", "fi", "fr", "de", "el", "iw", "is", "it", "ja", "ko", "no", "pl", "pt", "br", "ro", "ru", "sl", "es", "sv", "tr" }, new Object[] { "Arabic", "Bulgarian", "Catalan", "Chinese (Simplified)", "Chinese (Traditional)", "Czech", "Danish", "Dutch", "English", "Finnish", "French", "German", "Greek", "Hebrew", "Icelandic", "Italian", "Japanese", "Korean", "Norwegian", "Polish", "Portuguese", "Portuguese (Brazilian)", "Romanian", "Russian", "Slovenian", "Spanish", "Swedish", "Turkish" }); langs = new JComboBox(kcbm); langs.setEditable(false); String defaultLang = null; if (configuration.getLanguage() != null && configuration.getLanguage().length() > 0) { defaultLang = configuration.getLanguage(); } else { defaultLang = Locale.getDefault().getLanguage(); } if (defaultLang == null) { defaultLang = "en"; } kcbm.setSelectedKey(defaultLang); if (langs.getSelectedIndex() == -1) { langs.setSelectedIndex(0); } langs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { configuration.setLanguage((String) kcbm.getSelectedKey()); } } }); builder.add(langs, FormLayoutUtil.flip(cc.xyw(3, 7, 7), colSpec, orientation)); builder.add(smcheckBox, FormLayoutUtil.flip(cc.xyw(1, 9, 9), colSpec, orientation)); JButton service = new JButton(Messages.getString("NetworkTab.4")); service.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (PMS.get().installWin32Service()) { JOptionPane.showMessageDialog( (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())), Messages.getString("NetworkTab.11") + Messages.getString("NetworkTab.12"), Messages.getString("Dialog.Information"), JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog( (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())), Messages.getString("NetworkTab.14"), Messages.getString("Dialog.Error"), JOptionPane.ERROR_MESSAGE); } } }); builder.add(service, FormLayoutUtil.flip(cc.xy(1, 11), colSpec, orientation)); if (System.getProperty(LooksFrame.START_SERVICE) != null || !Platform.isWindows()) { service.setEnabled(false); } JButton checkForUpdates = new JButton(Messages.getString("NetworkTab.8")); checkForUpdates.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { LooksFrame frame = (LooksFrame) PMS.get().getFrame(); frame.checkForUpdates(); } }); builder.add(checkForUpdates, FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation)); autoUpdateCheckBox = new JCheckBox(Messages.getString("NetworkTab.9")); autoUpdateCheckBox.setContentAreaFilled(false); autoUpdateCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setAutoUpdate((e.getStateChange() == ItemEvent.SELECTED)); } }); if (configuration.isAutoUpdate()) { autoUpdateCheckBox.setSelected(true); } builder.add(autoUpdateCheckBox, FormLayoutUtil.flip(cc.xyw(7, 13, 3), colSpec, orientation)); if (!Build.isUpdatable()) { checkForUpdates.setEnabled(false); autoUpdateCheckBox.setEnabled(false); } host = new JTextField(configuration.getServerHostname()); host.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setHostname(host.getText()); } }); port = new JTextField(configuration.getServerPort() != 5001 ? "" + configuration.getServerPort() : ""); port.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { try { String p = port.getText(); if (StringUtils.isEmpty(p)) { p = "5001"; } int ab = Integer.parseInt(p); configuration.setServerPort(ab); } catch (NumberFormatException nfe) { logger.debug("Could not parse port from \"" + port.getText() + "\""); } } }); cmp = builder.addSeparator(Messages.getString("NetworkTab.22"), FormLayoutUtil.flip(cc.xyw(1, 21, 9), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); final KeyedComboBoxModel networkInterfaces = createNetworkInterfacesModel(); networkinterfacesCBX = new JComboBox(networkInterfaces); networkInterfaces.setSelectedKey(configuration.getNetworkInterface()); networkinterfacesCBX.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { configuration.setNetworkInterface((String) networkInterfaces.getSelectedKey()); } } }); ip_filter = new JTextField(configuration.getIpFilter()); ip_filter.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setIpFilter(ip_filter.getText()); } }); maxbitrate = new JTextField(configuration.getMaximumBitrate()); maxbitrate.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { PMS.getConfiguration().setMaximumBitrate(maxbitrate.getText()); } }); builder.addLabel(Messages.getString("NetworkTab.20"), FormLayoutUtil.flip(cc.xy(1, 23), colSpec, orientation)); builder.add(networkinterfacesCBX, FormLayoutUtil.flip(cc.xyw(3, 23, 7), colSpec, orientation)); builder.addLabel(Messages.getString("NetworkTab.23"), FormLayoutUtil.flip(cc.xy(1, 25), colSpec, orientation)); builder.add(host, FormLayoutUtil.flip(cc.xyw(3, 25, 7), colSpec, orientation)); builder.addLabel(Messages.getString("NetworkTab.24"), FormLayoutUtil.flip(cc.xy(1, 27), colSpec, orientation)); builder.add(port, FormLayoutUtil.flip(cc.xyw(3, 27, 7), colSpec, orientation)); builder.addLabel(Messages.getString("NetworkTab.30"), FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation)); builder.add(ip_filter, FormLayoutUtil.flip(cc.xyw(3, 29, 7), colSpec, orientation)); builder.addLabel(Messages.getString("NetworkTab.35"), FormLayoutUtil.flip(cc.xy(1, 31), colSpec, orientation)); builder.add(maxbitrate, FormLayoutUtil.flip(cc.xyw(3, 31, 7), colSpec, orientation)); cmp = builder.addSeparator(Messages.getString("NetworkTab.31"), FormLayoutUtil.flip(cc.xyw(1, 33, 9), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); newHTTPEngine = new JCheckBox(Messages.getString("NetworkTab.32")); newHTTPEngine.setSelected(configuration.isHTTPEngineV2()); newHTTPEngine.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setHTTPEngineV2((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(newHTTPEngine, FormLayoutUtil.flip(cc.xyw(1, 35, 9), colSpec, orientation)); preventSleep = new JCheckBox(Messages.getString("NetworkTab.33")); preventSleep.setSelected(configuration.isPreventsSleep()); preventSleep.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setPreventsSleep((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(preventSleep, FormLayoutUtil.flip(cc.xyw(1, 37, 9), colSpec, orientation)); JCheckBox fdCheckBox = new JCheckBox(Messages.getString("NetworkTab.38")); fdCheckBox.setContentAreaFilled(false); fdCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setRendererForceDefault((e.getStateChange() == ItemEvent.SELECTED)); } }); if (configuration.isRendererForceDefault()) { fdCheckBox.setSelected(true); } builder.addLabel(Messages.getString("NetworkTab.36"), FormLayoutUtil.flip(cc.xy(1, 39), colSpec, orientation)); ArrayList<RendererConfiguration> allConfs = RendererConfiguration.getAllRendererConfigurations(); ArrayList<Object> keyValues = new ArrayList<Object>(); ArrayList<Object> nameValues = new ArrayList<Object>(); keyValues.add(""); nameValues.add(Messages.getString("NetworkTab.37")); if (allConfs != null) { for (RendererConfiguration renderer : allConfs) { if (renderer != null) { keyValues.add(renderer.getRendererName()); nameValues.add(renderer.getRendererName()); } } } final KeyedComboBoxModel renderersKcbm = new KeyedComboBoxModel( (Object[]) keyValues.toArray(new Object[keyValues.size()]), (Object[]) nameValues.toArray(new Object[nameValues.size()])); renderers = new JComboBox(renderersKcbm); renderers.setEditable(false); String defaultRenderer = configuration.getRendererDefault(); renderersKcbm.setSelectedKey(defaultRenderer); if (renderers.getSelectedIndex() == -1) { renderers.setSelectedIndex(0); } builder.add(renderers, FormLayoutUtil.flip(cc.xyw(3, 39, 7), colSpec, orientation)); builder.add(fdCheckBox, FormLayoutUtil.flip(cc.xyw(1, 41, 9), colSpec, orientation)); cmp = builder.addSeparator(Messages.getString("NetworkTab.34"), FormLayoutUtil.flip(cc.xyw(1, 43, 9), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); pPlugins = new JPanel(new GridLayout()); builder.add(pPlugins, FormLayoutUtil.flip(cc.xyw(1, 45, 9), colSpec, orientation)); JPanel panel = builder.getPanel(); // Apply the orientation to the panel and all components in it panel.applyComponentOrientation(orientation); JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); return scrollPane; }
From source file:unalcol.termites.boxplots.InformationCollected1.java
/** * Creates a new demo./*from w w w. java2 s. c o m*/ * * @param title the frame title. * @param pf */ public InformationCollected1(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); final NumberAxis yAxis = new NumberAxis(""); //final NumberAxis yAxis = new NumberAxis("Information Collected"); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 14); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Information Collected " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("informationcollected1" + mazeMode + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 450, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(InformationCollected1.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(InformationCollected1.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:tdunnick.jphineas.console.queue.Charts.java
/** * Creates the bar chart. Set the X-axis font small enough to accommodate * dates and tidy up the bars./* w w w .j a va2 s. c o m*/ * @param title for the chart * @param dataset for the chart * @return the chart */ private JFreeChart createBarChart(String title, CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createBarChart(title, null, // domain axis label "Messages", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); CategoryPlot plot = chart.getCategoryPlot(); plot.getDomainAxis().setTickLabelFont(new Font("Arial", Font.BOLD, 9)); BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); renderer.setItemMargin(0.01); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); return chart; }
From source file:net.sf.dynamicreports.test.jasper.chart.GanttChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*from w ww . j a v a2 s .com*/ JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", GanttRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible()); Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible()); Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible()); ganttChartDataTest(chart, "label", new String[] { "task1", "task2", "task3" }, new Object[][] { { toDate(2011, 1, 1), toDate(2011, 1, 8), 1d }, { toDate(2011, 1, 10), toDate(2011, 1, 15), 0.5d }, { toDate(2011, 1, 15), toDate(2011, 1, 25), 0.8d } }); ganttChartDataTest(chart, "serie1", new String[] { "task1", "task2", "task3" }, new Object[][] { { toDate(2011, 1, 2), toDate(2011, 1, 9), null }, { toDate(2011, 1, 8), toDate(2011, 1, 14), null }, { toDate(2011, 1, 16), toDate(2011, 1, 20), null } }); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); Assert.assertEquals("task label", "task", axis.getLabel()); Assert.assertEquals("task label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("task 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()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("time label", "time", axis.getLabel()); Assert.assertEquals("time label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("time 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()); }
From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartUIHelper.java
/*********************************************************************************************** * Create the default Toolbar for a Chart. * * @param obsinstrument//from ww w . jav a 2 s. com * @param chart * @param title * @param fontdata * @param colourforeground * @param colourbackground * @param debug * * @return JToolBar */ public static JToolBar createDefaultToolbar(final ObservatoryInstrumentInterface obsinstrument, final ChartUIComponentPlugin chart, final String title, final FontInterface fontdata, final ColourInterface colourforeground, final ColourInterface colourbackground, final boolean debug) { final JToolBar toolbar; if ((obsinstrument != null) && (chart != null)) { final List<Component> listComponentsToAdd; final JLabel labelName; listComponentsToAdd = new ArrayList<Component>(10); //------------------------------------------------------------------------------------- // Initialise the Label labelName = new JLabel(title, RegistryModelUtilities.getAtomIcon(obsinstrument.getHostAtom(), ObservatoryInterface.FILENAME_ICON_CHART_VIEWER), SwingConstants.LEFT) { static final long serialVersionUID = 7580736117336162922L; // Enable Antialiasing in Java 1.5 protected void paintComponent(final Graphics graphics) { final Graphics2D graphics2D = (Graphics2D) graphics; // For antialiasing text graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); super.paintComponent(graphics2D); } }; labelName.setFont( fontdata.getFont().deriveFont(ReportTableHelper.SIZE_HEADER_FONT).deriveFont(Font.BOLD)); labelName.setForeground(colourforeground.getColor()); labelName.setIconTextGap(UIComponentPlugin.TOOLBAR_ICON_TEXT_GAP); listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR_BUTTON)); listComponentsToAdd.add(labelName); listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR)); listComponentsToAdd.add(Box.createHorizontalGlue()); UIComponentHelper.addToolbarPrintButtons(listComponentsToAdd, chart, chart.getChartPanel(), title, fontdata, colourforeground, colourbackground, debug); // Build the Toolbar using the Components, if any toolbar = UIComponentHelper.buildToolbar(listComponentsToAdd); } else { toolbar = new JToolBar(); } toolbar.setFloatable(false); toolbar.setMinimumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE); toolbar.setPreferredSize(UIComponentPlugin.DIM_TOOLBAR_SIZE); toolbar.setMaximumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE); toolbar.setBackground(colourbackground.getColor()); NavigationUtilities.updateComponentTreeUI(toolbar); return (toolbar); }
From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.table.JTableInfoForSMFile.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);/*from w w w .j a v a 2 s.co m*/ if (value != null) { if (table.getColumnName(column).equals("Version") || table.getColumnName(column).equals("Pending Hits") || table.getColumnName(column).equals("Status") || table.getColumnName(column).equals("Identified Hits") || table.getColumnName(column).equals("Files")) { setHorizontalAlignment(SwingConstants.CENTER); } else { setHorizontalAlignment(SwingConstants.LEFT); } comp.setToolTipText(String.valueOf(value)); if (table.getValueAt(row, TableModelForSMFile.COL_STATUS) != null && table.getValueAt(row, TableModelForSMFile.COL_STATUS).toString().equals("Identified")) { comp.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12)); comp.setForeground(new Color(20, 20, 20)); } else if (table.getValueAt(row, TableModelForSMFile.COL_STATUS).toString().equals("Declared")) { comp.setForeground(new Color(150, 150, 150)); } else { comp.setForeground(new Color(20, 20, 20)); } } else { comp.setToolTipText(null); } return comp; }