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:cn.edu.tsinghua.gui.HistogramDemo.java
/** * Initialize display./*from w w w.ja v a 2 s. com*/ * @author Sun Microsystems * @param filename is the image filename */ public HistogramDemo(String filename) { File f = new File(filename); if (f.exists() && f.canRead()) { source = JAI.create("fileload", filename); } else { return; } canvas = new ImageDisplay(source); canvas.setLayout(new FlowLayout(FlowLayout.RIGHT, 2, 2)); panner = new Panner(canvas, source, 128); panner.setBackground(Color.red); panner.setBorder(new EtchedBorder()); canvas.add(panner); Font font = new Font("SansSerif", Font.BOLD, 12); JLabel title = new JLabel(" Histogram"); title.setFont(font); title.setLocation(0, 32); setOpaque(true); setLayout(new BorderLayout()); setBackground(Color.white); graph = new XYPlot(); graph.setBackground(Color.black); graph.setBorder(new LineBorder(new Color(0, 0, 255), 1)); Colorbar cbar = new Colorbar(); cbar.setBackground(Color.black); cbar.setPreferredSize(new Dimension(256, 25)); cbar.setBorder(new LineBorder(new Color(255, 0, 255), 2)); JPanel hist_panel = new JPanel(); hist_panel.setLayout(new BorderLayout()); hist_panel.setBackground(Color.white); hist_panel.add(graph, BorderLayout.CENTER); hist_panel.add(cbar, BorderLayout.SOUTH); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(2, 1, 5, 5)); panel.setBackground(Color.white); panel.add(canvas); panel.add(hist_panel); JPanel controlPanel = new JPanel(); controlPanel.setLayout(new FlowLayout()); reset = new JButton("Reset"); equal = new JButton("Uniform"); norm = new JButton("Gaussian"); piece = new JButton("Piecewise"); reset.addActionListener(this); equal.addActionListener(this); norm.addActionListener(this); piece.addActionListener(this); controlPanel.add(reset); controlPanel.add(equal); controlPanel.add(norm); controlPanel.add(piece); add(title, BorderLayout.NORTH); add(panel, BorderLayout.CENTER); add(controlPanel, BorderLayout.SOUTH); // original histogram (remains unmodified) // graph.plot( getHistogram(source) ); graph.plot(getMultiHistogram(source)); }
From source file:de.perdian.apps.dashboard.support.chart.ChartCreator.java
public JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart(this.getTitle(), null, null, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(null);//from w ww. j a v a 2 s. c o m chart.setBackgroundImageAlpha(0.0f); if (chart.getTitle() != null) { chart.getTitle().setFont(new Font(this.getFontName(), Font.BOLD, 14)); } XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(null); plot.setBackgroundAlpha(0.0f); plot.setOutlinePaint(this.getColor()); plot.getDomainAxis().setVisible(false); plot.getDomainAxis().setAxisLineVisible(false); plot.getDomainAxis().setMinorTickCount(10); plot.getDomainAxis().setTickMarksVisible(false); if (this.getDomainTickUnits() != null) { plot.getDomainAxis().setStandardTickUnits(this.getDomainTickUnits()); } plot.getRangeAxis().setVisible(true); plot.getRangeAxis().setAxisLineVisible(false); plot.getRangeAxis().setTickLabelFont(new Font(this.getFontName(), Font.PLAIN, 10)); plot.getRangeAxis().setTickLabelPaint(this.getColor()); plot.getRangeAxis().setTickMarksVisible(false); if (this.getRangeTickUnits() != null) { plot.getRangeAxis().setStandardTickUnits(this.getRangeTickUnits()); } plot.getRangeAxis().setAttributedLabel(this.getRangeAxisLabel()); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); for (int i = 0; i < this.getStrokeDefinitions().size(); i++) { ChartStrokeDefinition strokeDefinition = this.getStrokeDefinitions().get(i); strokeDefinition.applyTo(renderer, i); } return chart; }
From source file:analysers.FilterValidatedDialog.java
/** * Create the dialog.//from w ww . jav a 2s. c om */ public FilterValidatedDialog() { setTitle("Validated Lineages: Export Filter"); setBounds(100, 100, 632, 348); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 160, 440, 0 }; gbl_contentPanel.rowHeights = new int[] { 1, 28, 28, 28, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE }; contentPanel.setLayout(gbl_contentPanel); { JLabel lblCriterion = new JLabel("Lineage Criterion"); lblCriterion.setFont(new Font("Lucida Grande", Font.BOLD, 13)); GridBagConstraints gbc_lblCriterion = new GridBagConstraints(); gbc_lblCriterion.insets = new Insets(0, 0, 5, 5); gbc_lblCriterion.gridx = 0; gbc_lblCriterion.gridy = 0; contentPanel.add(lblCriterion, gbc_lblCriterion); } { JLabel lblValue = new JLabel("Value"); lblValue.setFont(new Font("Lucida Grande", Font.BOLD, 13)); GridBagConstraints gbc_lblValue = new GridBagConstraints(); gbc_lblValue.insets = new Insets(0, 0, 5, 0); gbc_lblValue.gridx = 1; gbc_lblValue.gridy = 0; contentPanel.add(lblValue, gbc_lblValue); } { lblMinLineageLength = new JLabel("Min. Length (frames)"); GridBagConstraints gbc_lblMinLineageLength = new GridBagConstraints(); gbc_lblMinLineageLength.fill = GridBagConstraints.BOTH; gbc_lblMinLineageLength.insets = new Insets(0, 0, 5, 5); gbc_lblMinLineageLength.gridx = 0; gbc_lblMinLineageLength.gridy = 1; contentPanel.add(lblMinLineageLength, gbc_lblMinLineageLength); } { minLinLen = new JTextField(); GridBagConstraints gbc_minLinLen = new GridBagConstraints(); gbc_minLinLen.anchor = GridBagConstraints.NORTH; gbc_minLinLen.fill = GridBagConstraints.HORIZONTAL; gbc_minLinLen.insets = new Insets(0, 0, 5, 0); gbc_minLinLen.gridx = 1; gbc_minLinLen.gridy = 1; contentPanel.add(minLinLen, gbc_minLinLen); minLinLen.setText("1"); minLinLen.setColumns(3); } { lblStartFrameOf = new JLabel("Max. Start Frame"); GridBagConstraints gbc_lblStartFrameOf = new GridBagConstraints(); gbc_lblStartFrameOf.fill = GridBagConstraints.HORIZONTAL; gbc_lblStartFrameOf.insets = new Insets(0, 0, 5, 5); gbc_lblStartFrameOf.gridx = 0; gbc_lblStartFrameOf.gridy = 2; contentPanel.add(lblStartFrameOf, gbc_lblStartFrameOf); } { startLin = new JTextField(); GridBagConstraints gbc_startLin = new GridBagConstraints(); gbc_startLin.insets = new Insets(0, 0, 5, 0); gbc_startLin.fill = GridBagConstraints.HORIZONTAL; gbc_startLin.gridx = 1; gbc_startLin.gridy = 2; contentPanel.add(startLin, gbc_startLin); startLin.setText("-1"); startLin.setColumns(3); } { JButton btnPreview = new JButton("Preview"); btnPreview.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { preview.setText(makePreview()); } }); GridBagConstraints gbc_btnPreview = new GridBagConstraints(); gbc_btnPreview.insets = new Insets(0, 0, 5, 5); gbc_btnPreview.gridx = 0; gbc_btnPreview.gridy = 3; contentPanel.add(btnPreview, gbc_btnPreview); } { JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.insets = new Insets(0, 0, 5, 0); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 3; contentPanel.add(scrollPane, gbc_scrollPane); { preview = new JTextArea(); scrollPane.setViewportView(preview); preview.setEditable(false); preview.setColumns(10); preview.setTabSize(4); } } { JLabel lblOptions = new JLabel("Options"); GridBagConstraints gbc_lblOptions = new GridBagConstraints(); gbc_lblOptions.insets = new Insets(0, 0, 0, 5); gbc_lblOptions.gridx = 0; gbc_lblOptions.gridy = 4; contentPanel.add(lblOptions, gbc_lblOptions); } { JPanel panel = new JPanel(); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.anchor = GridBagConstraints.NORTH; gbc_panel.fill = GridBagConstraints.HORIZONTAL; gbc_panel.gridx = 1; gbc_panel.gridy = 4; contentPanel.add(panel, gbc_panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 69, 169, 162, 0 }; gbl_panel.rowHeights = new int[] { 23, 23, 0 }; gbl_panel.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); { rdbtnExportMeanIntensity = new JRadioButton("Export Mean Intensity"); rdbtnExportMeanIntensity.setSelected(true); buttonGroup.add(rdbtnExportMeanIntensity); GridBagConstraints gbc_rdbtnExportMeanIntensity = new GridBagConstraints(); gbc_rdbtnExportMeanIntensity.anchor = GridBagConstraints.NORTHWEST; gbc_rdbtnExportMeanIntensity.insets = new Insets(0, 0, 5, 5); gbc_rdbtnExportMeanIntensity.gridx = 1; gbc_rdbtnExportMeanIntensity.gridy = 0; panel.add(rdbtnExportMeanIntensity, gbc_rdbtnExportMeanIntensity); } { rdbtnExportMaxIntensity = new JRadioButton("Export Max Intensity"); buttonGroup.add(rdbtnExportMaxIntensity); GridBagConstraints gbc_rdbtnExportMaxIntensity = new GridBagConstraints(); gbc_rdbtnExportMaxIntensity.anchor = GridBagConstraints.NORTHWEST; gbc_rdbtnExportMaxIntensity.insets = new Insets(0, 0, 5, 0); gbc_rdbtnExportMaxIntensity.gridx = 2; gbc_rdbtnExportMaxIntensity.gridy = 0; panel.add(rdbtnExportMaxIntensity, gbc_rdbtnExportMaxIntensity); } { chckbxExportPositions = new JCheckBox("Export Cell Positions and Areas in CSV"); GridBagConstraints gbc_chckbxExportPositions = new GridBagConstraints(); gbc_chckbxExportPositions.anchor = GridBagConstraints.NORTH; gbc_chckbxExportPositions.gridwidth = 2; gbc_chckbxExportPositions.gridx = 1; gbc_chckbxExportPositions.gridy = 1; panel.add(chckbxExportPositions, gbc_chckbxExportPositions); } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (validateFields()) { Prefs.set("TrackApp.FilterValidatedDialog.startLin", valStartLin); Prefs.set("TrackApp.FilterValidatedDialog.minLinLen", valMinLinLen); Prefs.set("TrackApp.FilterValidatedDialog.exportMean", doExportMean); Prefs.set("TrackApp.FilterValidatedDialog.exportPositions", doExportPositions); Prefs.savePreferences(); dispose(); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
From source file:sernet.gs.ui.rcp.main.bsi.views.chart.RealisierungLineChart.java
private JFreeChart createProgressChart(Object dataset) { final double plotGap = 10.0; final int axisUpperBoundPadding = 50; final int labelFontSize = 10; XYDataset data1 = (XYDataset) dataset; XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis(Messages.RealisierungLineChart_1); XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis(Messages.RealisierungLineChart_2)); plot.setGap(plotGap);// w ww .j a va 2 s . c o m plot.add(subplot1, 1); plot.setOrientation(PlotOrientation.VERTICAL); CountMassnahmen command = new CountMassnahmen(); try { command = ServiceFactory.lookupCommandService().executeCommand(command); } catch (CommandException e) { ExceptionUtil.log(e, Messages.RealisierungLineChart_3); } int totalNum = command.getTotalCount(); NumberAxis axis = (NumberAxis) subplot1.getRangeAxis(); axis.setUpperBound(totalNum + axisUpperBoundPadding); ValueMarker bst = new ValueMarker(totalNum); bst.setPaint(Color.GREEN); bst.setLabel(Messages.RealisierungLineChart_4); bst.setLabelAnchor(RectangleAnchor.LEFT); bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, labelFontSize)); //$NON-NLS-1$ bst.setLabelTextAnchor(TextAnchor.CENTER_LEFT); subplot1.addRangeMarker(bst, Layer.BACKGROUND); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart(Messages.RealisierungLineChart_6, JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); return chart; }
From source file:net.sf.jabref.gui.search.SearchBar.java
/** * Initializes the search bar.//from w ww . j a va2s. c om * * @param basePanel the base panel */ public SearchBar(BasePanel basePanel) { super(); this.basePanel = Objects.requireNonNull(basePanel); this.searchQueryHighlightObservable = new SearchQueryHighlightObservable(); currentResults.setFont(currentResults.getFont().deriveFont(Font.BOLD)); caseSensitive = new JToggleButton(IconTheme.JabRefIcon.CASE_SENSITIVE.getSmallIcon(), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_CASE_SENSITIVE)); caseSensitive.setToolTipText(Localization.lang("Case sensitive")); caseSensitive.addActionListener(e -> { performSearch(); updatePreferences(); }); regularExp = new JToggleButton(IconTheme.JabRefIcon.REG_EX.getSmallIcon(), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REG_EXP)); regularExp.setToolTipText(Localization.lang("regular expression")); regularExp.addActionListener(e -> { performSearch(); updatePreferences(); }); openCurrentResultsInDialog = new JButton(IconTheme.JabRefIcon.OPEN_IN_NEW_WINDOW.getSmallIcon()); openCurrentResultsInDialog.setToolTipText(Localization.lang("Show search results in a window")); openCurrentResultsInDialog.addActionListener(ae -> { SearchResultsDialog searchDialog = new SearchResultsDialog(basePanel.frame(), Localization.lang("Search results in database %0 for %1", basePanel.getBibDatabaseContext().getDatabaseFile().getName(), this.getSearchQuery().localize())); List<BibEntry> entries = basePanel.getDatabase().getEntries().stream().filter(BibEntry::isSearchHit) .collect(Collectors.toList()); searchDialog.addEntries(entries, basePanel); searchDialog.selectFirstEntry(); searchDialog.setVisible(true); }); openCurrentResultsInDialog.setEnabled(false); // Init controls setLayout(new WrapLayout(FlowLayout.LEFT)); searchIcon = new JLabel(IconTheme.JabRefIcon.SEARCH.getSmallIcon()); this.add(searchIcon); initSearchField(); if (OS.OS_X) { searchField.putClientProperty("JTextField.variant", "search"); } this.add(searchField); JButton clearSearchButton = new JButton(IconTheme.JabRefIcon.CLOSE.getSmallIcon()); clearSearchButton.setToolTipText(Localization.lang("Clear")); clearSearchButton.addActionListener(l -> endSearch()); this.add(clearSearchButton); searchModeButton = new JButton(); updateSearchModeButtonText(); searchModeButton.addActionListener(l -> toggleSearchModeAndSearch()); JToolBar toolBar = new OSXCompatibleToolbar(); toolBar.setFloatable(false); toolBar.add(clearSearchButton); toolBar.addSeparator(); toolBar.add(regularExp); toolBar.add(caseSensitive); toolBar.addSeparator(); toolBar.add(searchModeButton); toolBar.addSeparator(); toolBar.add(openCurrentResultsInDialog); globalSearch = new JButton(Localization.lang("Search globally")); globalSearch.setToolTipText(Localization.lang("Search in all open databases")); globalSearch.addActionListener(l -> { AbstractWorker worker = new GlobalSearchWorker(basePanel.frame(), getSearchQuery()); worker.run(); worker.update(); }); globalSearch.setEnabled(false); toolBar.add(globalSearch); toolBar.addSeparator(); toolBar.add(new HelpAction(HelpFile.SEARCH)); this.add(toolBar); this.add(currentResults); paintBackgroundWhite(this); }
From source file:net.pms.newgui.NetworkTab.java
public JComponent build() { FormLayout layout = new FormLayout("left:pref, 2dlu, p, 2dlu , p, 2dlu, p, 2dlu, pref:grow", "p, 0dlu, p, 0dlu, p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 15dlu, p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p,3dlu, p, 3dlu, p, 15dlu, p,3dlu, p, 3dlu, p, 15dlu, p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(Borders.DLU4_BORDER); builder.setOpaque(true);//from ww w . j av a2 s . com CellConstraints cc = new CellConstraints(); smcheckBox = new JCheckBox(Messages.getString("NetworkTab.3")); smcheckBox.setContentAreaFilled(false); smcheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { PMS.getConfiguration().setMinimized((e.getStateChange() == ItemEvent.SELECTED)); } }); if (PMS.getConfiguration().isMinimized()) { smcheckBox.setSelected(true); } JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), cc.xyw(1, 1, 9)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); builder.addLabel(Messages.getString("NetworkTab.0"), cc.xy(1, 7)); final KeyedComboBoxModel kcbm = new KeyedComboBoxModel( new Object[] { "bg", "ca", "zhs", "zht", "cz", "da", "nl", "en", "fi", "fr", "de", "el", "is", "it", "ja", "no", "pl", "pt", "br", "ro", "ru", "sl", "es", "sv" }, new Object[] { "Bulgarian", "Catalan", "Chinese (Simplified)", "Chinese (Traditional)", "Czech", "Danish", "Dutch", "English", "Finnish", "French", "German", "Greek", "Icelandic", "Italian", "Japanese", "Norwegian", "Polish", "Portuguese", "Portuguese (Brazilian)", "Romanian", "Russian", "Slovenian", "Spanish", "Swedish" }); langs = new JComboBox(kcbm); langs.setEditable(false); //langs.setSelectedIndex(0); 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, cc.xyw(3, 7, 7)); builder.add(smcheckBox, cc.xyw(1, 9, 9)); 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"), "Information", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog( (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())), Messages.getString("NetworkTab.14"), "Error", JOptionPane.ERROR_MESSAGE); } } }); builder.add(service, cc.xy(1, 11)); if (System.getProperty(LooksFrame.START_SERVICE) != null || !Platform.isWindows()) { service.setEnabled(false); } host = new JTextField(PMS.getConfiguration().getServerHostname()); host.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { configuration.setHostname(host.getText()); PMS.get().getFrame().setReloadable(true); } }); // host.setEnabled( StringUtils.isBlank(configuration.getNetworkInterface())) ; port = new JTextField(configuration.getServerPort() != 5001 ? "" + configuration.getServerPort() : ""); port.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } @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); PMS.get().getFrame().setReloadable(true); } catch (NumberFormatException nfe) { } } }); cmp = builder.addSeparator(Messages.getString("NetworkTab.22"), cc.xyw(1, 21, 9)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); ArrayList<String> names = new ArrayList<String>(); names.add(""); ArrayList<String> interfaces = new ArrayList<String>(); interfaces.add(""); Enumeration<NetworkInterface> enm; try { enm = NetworkInterface.getNetworkInterfaces(); while (enm.hasMoreElements()) { NetworkInterface ni = enm.nextElement(); // check for interface has at least one ip address. if (ni.getInetAddresses().hasMoreElements()) { names.add(ni.getName()); String displayName = ni.getDisplayName(); if (displayName == null) { displayName = ni.getName(); } interfaces.add(displayName.trim()); } } } catch (SocketException e1) { logger.error(null, e1); } final KeyedComboBoxModel networkInterfaces = new KeyedComboBoxModel(names.toArray(), interfaces.toArray()); 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()); //host.setEnabled( StringUtils.isBlank(configuration.getNetworkInterface())) ; PMS.get().getFrame().setReloadable(true); } } }); ip_filter = new JTextField(PMS.getConfiguration().getIpFilter()); ip_filter.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { configuration.setIpFilter(ip_filter.getText()); PMS.get().getFrame().setReloadable(true); } }); builder.addLabel(Messages.getString("NetworkTab.20"), cc.xy(1, 23)); builder.add(networkinterfacesCBX, cc.xyw(3, 23, 7)); builder.addLabel(Messages.getString("NetworkTab.23"), cc.xy(1, 25)); builder.add(host, cc.xyw(3, 25, 7)); builder.addLabel(Messages.getString("NetworkTab.24"), cc.xy(1, 27)); builder.add(port, cc.xyw(3, 27, 7)); builder.addLabel(Messages.getString("NetworkTab.30"), cc.xy(1, 29)); builder.add(ip_filter, cc.xyw(3, 29, 7)); cmp = builder.addSeparator(Messages.getString("NetworkTab.31"), cc.xyw(1, 31, 9)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); newHTTPEngine = new JCheckBox(Messages.getString("NetworkTab.32")); newHTTPEngine.setSelected(PMS.getConfiguration().isHTTPEngineV2()); newHTTPEngine.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { PMS.getConfiguration().setHTTPEngineV2((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(newHTTPEngine, cc.xyw(1, 33, 9)); preventSleep = new JCheckBox(Messages.getString("NetworkTab.33")); preventSleep.setSelected(PMS.getConfiguration().isPreventsSleep()); preventSleep.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { PMS.getConfiguration().setPreventsSleep((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(preventSleep, cc.xyw(1, 35, 9)); cmp = builder.addSeparator(Messages.getString("NetworkTab.34"), cc.xyw(1, 37, 9)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); JPanel panel = builder.getPanel(); JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); return scrollPane; }
From source file:net.sf.dynamicreports.test.jasper.chart.AreaChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*from w w w. ja v a2s. c o m*/ JFreeChart chart = getChart("summary.chart1", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", AreaRenderer.class, categoryPlot.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()); 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.chart2", 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:it.alus.GPSreceiver.instruments.Compass.java
public Compass(boolean trueTrack) { super(null);/* w ww . jav a 2s . c o m*/ isTrueTrack = trueTrack; dataset = new DefaultValueDataset(0.0); DialPlot plot = new DialPlot(); //Image background=Toolkit.getDefaultToolkit().getImage(getClass().getResource("heading.png")); //plot.setBackgroundImage(background); 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); N = new DialTextAnnotation("N"); N.setFont(new Font("Arial", 1, 32)); N.setPaint(Color.white); N.setAnchor(TextAnchor.CENTER); plot.addLayer(N); S = new DialTextAnnotation("S"); S.setFont(new Font("Arial", 1, 32)); S.setPaint(Color.white); S.setAnchor(TextAnchor.CENTER); plot.addLayer(S); W = new DialTextAnnotation("W"); W.setFont(new Font("Arial", 1, 32)); W.setPaint(Color.white); W.setAnchor(TextAnchor.CENTER); plot.addLayer(W); E = new DialTextAnnotation("E"); E.setFont(new Font("Arial", 1, 32)); E.setPaint(Color.white); E.setAnchor(TextAnchor.CENTER); plot.addLayer(E); repositionDirectionsLabels(90); DialValueIndicator valueindicator = new DialValueIndicator(0); plot.addLayer(valueindicator); plot.setDialFrame(dialFrame); realScale = new StandardDialScale(0, 360, 90, -360, 30, 6); realScale.setVisible(false); realScale.setFirstTickLabelVisible(false); plot.addScale(0, realScale); dispScale = new StandardDialScale(0, 36, 90, -360, 3, 15); dispScale.setFirstTickLabelVisible(false); dispScale.setMajorTickPaint(Color.white); dispScale.setMinorTickPaint(Color.lightGray); dispScale.setFirstTickLabelVisible(true); dispScale.setTickRadius(0.88); dispScale.setTickLabelOffset(0.15); NumberFormat formatter = new DecimalFormat("#"); dispScale.setTickLabelFormatter(formatter); dispScale.setTickLabelFont(new Font("Arial", Font.BOLD, 22)); dispScale.setTickLabelPaint(Color.white); plot.addScale(1, dispScale); plot.setBackground(new DialBackground(Color.black)); Pointer needle = new Pointer(0); needle.setFillPaint(Color.red); needle.setRadius(0.8); plot.addLayer(needle); plot.mapDatasetToScale(1, 1); DialCap cap = new DialCap(); cap.setRadius(0.05); cap.setFillPaint(Color.gray); plot.setCap(cap); jChart = new JFreeChart(plot); //jChart.setBackgroundImage(background); super.setChart(jChart); super.setPreferredSize(new Dimension(400, 400)); }
From source file:com.ikon.servlet.admin.StatsGraphServlet.java
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String action = WebUtils.getString(request, "action", "graph"); String type = WebUtils.getString(request, "t"); JFreeChart chart = null;//from www .ja v a 2s. c om updateSessionManager(request); try { if ("refresh".equals(action)) { new RepositoryInfo().runAs(null); ServletContext sc = getServletContext(); sc.getRequestDispatcher("/admin/stats.jsp").forward(request, response); } else { response.setContentType("image/png"); OutputStream out = response.getOutputStream(); if (DOCUMENTS.equals(type) || DOCUMENTS_SIZE.equals(type) || FOLDERS.equals(type)) { chart = repoStats(type); } else if (DISK.equals(type)) { chart = diskStats(); } else if (JVM_MEMORY.equals(type)) { chart = jvmMemStats(); } else if (OS_MEMORY.equals(type)) { chart = osMemStats(); } if (chart != null) { // Customize title font chart.getTitle().setFont(new Font("Tahoma", Font.BOLD, 16)); // Match body { background-color:#F6F6EE; } chart.setBackgroundPaint(new Color(246, 246, 238)); // Customize no data PiePlot plot = (PiePlot) chart.getPlot(); plot.setNoDataMessage("No data to display"); // Customize labels plot.setLabelGenerator(null); // Customize legend LegendTitle legend = new LegendTitle(plot, new ColumnArrangement(), new ColumnArrangement()); legend.setPosition(RectangleEdge.BOTTOM); legend.setFrame(BlockBorder.NONE); legend.setItemFont(new Font("Tahoma", Font.PLAIN, 12)); chart.removeLegend(); chart.addLegend(legend); if (DISK.equals(type) || JVM_MEMORY.equals(type) || OS_MEMORY.equals(type)) { ChartUtilities.writeChartAsPNG(out, chart, 225, 225); } else { ChartUtilities.writeChartAsPNG(out, chart, 250, 250); } } out.flush(); out.close(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:edu.ucla.stat.SOCR.analyses.gui.Friedman.java
/**Initialize the Analysis*/ public void init() { mapDep = false;//from w w w . j a va2s . co m showGraph = false; showSelect = false; showVisualize = false; showInput = false; super.init(); analysisType = AnalysisType.TWO_INDEPENDENT_FRIEDMAN; useInputExample = false; useLocalExample = true; useRandomExample = false; useServerExample = true; useStaticExample = TwoIndependentFriedmanExamples.availableExamples; onlineDescription = "http://en.wikipedia.org/wiki/Friedman_test"; depMax = 1; // max number of dependent var indMax = 9; // max number of independent var resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize)); frame = getFrame(this); setName("Regression & Correlation Analysis"); // 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(); //depLabel.setText("Variable 1"); indLabel.setText("SELECT AT LEAST TWO GROUPS:"); validate(); }