List of usage examples for java.awt Color LIGHT_GRAY
Color LIGHT_GRAY
To view the source code for java.awt Color LIGHT_GRAY.
Click Source Link
From source file:com.icesoft.faces.component.outputchart.AbstractChart.java
public ColorMap() { this.put("black", Color.BLACK); this.put("blue", Color.BLUE); this.put("cyan", Color.CYAN); this.put("darkGray", Color.DARK_GRAY); this.put("gray", Color.GRAY); this.put("green", Color.GREEN); this.put("lightGray", Color.LIGHT_GRAY); this.put("magenta", Color.MAGENTA); this.put("orange", Color.ORANGE); this.put("pink", Color.PINK); this.put("red", Color.RED); this.put("white", Color.WHITE); this.put("yellow", Color.YELLOW); }
From source file:edu.fullerton.timeseriesapp.TimeSeriesApp.java
public ArrayList<Integer> makePlot(ArrayList<ChanDataBuffer> dbufs, boolean compact) throws WebUtilException { int imageId;// w ww. j av a 2 s. c om try { PluginSupport psupport = new PluginSupport(); String gtitle = psupport.getTitle(dbufs, compact); String xAxisLabel = ""; XYSeriesCollection xyds = new XYSeriesCollection(); TimeSeriesCollection mtds = new TimeSeriesCollection(); compact = dbufs.size() > 2 ? false : compact; for (ChanDataBuffer dbuf : dbufs) { int npts = dbuf.getDataLength(); int sum = 1; if (npts > 2000) { sum = npts / 2000; } String legend = psupport.getLegend(dbuf, compact); if (timeAxis.equalsIgnoreCase("utc")) { TimeSeries ts = psupport.getTimeSeries(dbuf, legend, sum); xAxisLabel = "Time (UTC)"; mtds.addSeries(ts); } else { boolean isDt = timeAxis.equalsIgnoreCase("dt"); XYSeries xys = psupport.addXySeries(dbuf, legend, isDt, sum); xAxisLabel = psupport.getxAxisLabel(); xyds.addSeries(xys); } } Double minx, miny, maxx, maxy; Double[] rng = new Double[4]; if (timeAxis.equalsIgnoreCase("utc")) { PluginSupport.getRangeLimits(mtds, rng); } else { int skip = 0; PluginSupport.getRangeLimits(xyds, rng, skip); } minx = rng[0]; miny = rng[1]; maxx = rng[2]; maxy = rng[3]; int exp; if (timeAxis.equalsIgnoreCase("utc")) { exp = PluginSupport.scaleRange(mtds, miny, maxy); } else { exp = PluginSupport.scaleRange(xyds, miny, maxy); } ChartPanel cpnl; DefaultXYDataset ds = new DefaultXYDataset(); JFreeChart chart; if (timeAxis.equalsIgnoreCase("utc")) { chart = ChartFactory.createTimeSeriesChart(gtitle, "Time (UTC)", "Counts", ds, true, true, false); } else { chart = ChartFactory.createXYLineChart(gtitle, xAxisLabel, "Counts", ds, PlotOrientation.VERTICAL, true, false, false); } chart.setBackgroundPaint(Color.WHITE); chart.setAntiAlias(true); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); NumberAxis rangeAxis = new NumberAxis("Counts"); ScaledAxisNumberFormat sanf = new ScaledAxisNumberFormat(); sanf.setExp(exp); NumberTickUnit tickUnit; double plotRange; if (maxy != 0 && Math.abs(maxy - miny) < Math.abs(maxy) * 1e-30) { // this garbage is to get jFreeChart to always put labels on the Y axis double dt = Math.abs(miny) / 10; double scaledMin = (miny - dt) * Math.pow(10., exp); double scaledMax = (maxy + dt) * Math.pow(10., exp); rangeAxis.setRange(scaledMin, scaledMax); plotRange = scaledMax - scaledMin; rangeAxis.setAutoRange(false); } else { sanf.setMinMax(miny, maxy); plotRange = maxy - miny; rangeAxis.setAutoRange(true); } tickUnit = rangeAxis.getTickUnit(); double tickSize = tickUnit.getSize(); int nticks = (int) ((plotRange) / tickSize); if (nticks > yTicks) { double newTickSize = plotRange / yTicks; rangeAxis.setTickUnit(new NumberTickUnit(newTickSize)); } rangeAxis.setNumberFormatOverride(sanf); rangeAxis.setAutoRangeIncludesZero(false); plot.setRangeAxis(rangeAxis); if (timeAxis.equalsIgnoreCase("utc")) { plot.setDataset(0, mtds); } else { plot.setDataset(0, xyds); } // Set the line thickness XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer(); BasicStroke str = new BasicStroke(lineThickness); int n = plot.getSeriesCount(); for (int i = 0; i < n; i++) { r.setSeriesStroke(i, str); } if (compact) { chart.removeLegend(); } cpnl = new ChartPanel(chart); if (outFilename.isEmpty()) { imageId = psupport.saveImageAsPNG(cpnl); } else { imageId = 0; psupport.saveImageAsPdfFile(chart, outFilename); } } catch (SQLException | NoSuchAlgorithmException | IOException ex) { throw new WebUtilException(ex); } ArrayList<Integer> ret = new ArrayList<>(); ret.add(imageId); return ret; }
From source file:keel.Algorithms.UnsupervisedLearning.AssociationRules.Visualization.keelassotiationrulesbarchart.ResultsProccessor.java
public void writeToFile(String outName) throws FileNotFoundException, UnsupportedEncodingException, IOException { calcMeans();//from w w w . ja v a2 s. c o m calcAvgRulesBySeed(); // Create JFreeChart Dataset DefaultCategoryDataset dataset = new DefaultCategoryDataset(); HashMap<String, Double> measuresFirst = algorithmMeasures.entrySet().iterator().next().getValue(); for (Map.Entry<String, Double> measure : measuresFirst.entrySet()) { String measureName = measure.getKey(); //Double measureValue = measure.getValue(); dataset.clear(); for (Map.Entry<String, HashMap<String, Double>> entry : algorithmMeasures.entrySet()) { String alg = entry.getKey(); Double measureValue = entry.getValue().get(measureName); // Parse algorithm name to show it correctly String aName = alg.substring(0, alg.length() - 1); int startAlgName = aName.lastIndexOf("/"); aName = aName.substring(startAlgName + 1); dataset.addValue(measureValue, aName, measureName); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart barChart = ChartFactory.createBarChart("Assotiation Rules Measures", measureName, measureName, dataset, PlotOrientation.VERTICAL, true, true, false); StandardChartTheme.createLegacyTheme().apply(barChart); CategoryItemRenderer renderer = barChart.getCategoryPlot().getRenderer(); // Black and White int numItems = algorithmMeasures.size(); for (int i = 0; i < numItems; i++) { Color color = Color.DARK_GRAY; if (i % 2 == 1) { color = Color.LIGHT_GRAY; } renderer.setSeriesPaint(i, color); renderer.setSeriesOutlinePaint(i, Color.BLACK); } int width = 640 * 2; /* Width of the image */ int height = 480 * 2; /* Height of the image */ // JPEG File BarChart = new File(outName + "_" + measureName + "_barchart.jpg"); ChartUtilities.saveChartAsJPEG(BarChart, barChart, width, height); // SVG SVGGraphics2D g2 = new SVGGraphics2D(width, height); Rectangle r = new Rectangle(0, 0, width, height); barChart.draw(g2, r); File BarChartSVG = new File(outName + "_" + measureName + "_barchart.svg"); SVGUtils.writeToSVG(BarChartSVG, g2.getSVGElement()); } } /* for (Map.Entry<String, HashMap<String, Double>> entry : algorithmMeasures.entrySet()) { String alg = entry.getKey(); HashMap<String, Double> measures = entry.getValue(); for (Map.Entry<String, Double> entry1 : measures.entrySet()) { String measureName = entry1.getKey(); Double measureValue = entry1.getValue(); dataset.addValue(measureValue, alg, measureName); } } */ }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * Updates the chat message panel in the Swing event thread *//*from w w w . ja va 2 s. co m*/ public void updateChatMessagePanel() { // Ensure that we operate in the Swing event thread if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { updateChatMessagePanel(); } }); return; } // Set the title header titleHeader.setText(chatData != null ? NameUtils.getName(chatData.getId(), NameFormat.MEDIUM) : " "); titleHeader.setVisible(chatData != null); // Only enable send-function when there is chat data, and hence a target sendBtn.setEnabled(chatData != null); messageText.setEditable(chatData != null); // Remove all components from the messages panel messagesPanel.removeAll(); Insets insets = new Insets(0, 2, 2, 2); Insets insets2 = new Insets(6, 2, 0, 2); if (chatData != null && chatData.getMessageCount() > 0) { // First, add a filler component int y = 0; messagesPanel.add(new JLabel(""), new GridBagConstraints(0, y++, 1, 1, 0.0, 1.0, NORTH, VERTICAL, insets, 0, 0)); // Add the messages long lastMessageTime = 0; for (EPDChatMessage message : chatData.getMessages()) { // Check if we need to add a time label if (message.getSendDate().getTime() - lastMessageTime > PRINT_DATE_INTERVAL) { JLabel dateLabel = new JLabel( String.format(message.isOwnMessage() ? "Sent to %s" : "Received %s", Formatter.formatShortDateTimeNoTz(new Date(message.getSendDate().getTime())))); dateLabel.setFont(dateLabel.getFont().deriveFont(9.0f).deriveFont(Font.PLAIN)); dateLabel.setHorizontalAlignment(SwingConstants.CENTER); dateLabel.setForeground(Color.LIGHT_GRAY); messagesPanel.add(dateLabel, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, NORTH, HORIZONTAL, insets2, 0, 0)); } // Add a chat message field JPanel msg = new JPanel(); msg.setBorder(new ChatMessageBorder(message)); JLabel msgLabel = new ChatMessageLabel(message.getMsg(), message.isOwnMessage()); msg.add(msgLabel); messagesPanel.add(msg, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, NORTH, HORIZONTAL, insets, 0, 0)); lastMessageTime = message.getSendDate().getTime(); } // Scroll to the bottom validate(); scrollPane.getVerticalScrollBar().setValue(scrollPane.getVerticalScrollBar().getMaximum()); messagesPanel.repaint(); } else if (chatData == null && noDataComponent != null) { // The noDataComponent may e.g. be a message messagesPanel.add(noDataComponent, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } }
From source file:dbseer.gui.user.DBSeerDataSet.java
public DBSeerDataSet(boolean isLive) { live = new Boolean(isLive); Boolean[] trueFalse = { Boolean.TRUE, Boolean.FALSE }; JComboBox trueFalseBox = new JComboBox(trueFalse); final DefaultCellEditor dce = new DefaultCellEditor(trueFalseBox); uniqueVariableName = "dataset_" + UUID.randomUUID().toString().replace('-', '_'); uniqueModelVariableName = "mv_" + UUID.randomUUID().toString().replace('-', '_'); if (isLive) { name = "Live Data"; }//from www. ja v a 2 s . c o m tableModel = new DBSeerDataSetTableModel(null, new String[] { "Name", "Value" }, !isLive); tableModel.addTableModelListener(this); table = new JTable(tableModel) { @Override public TableCellEditor getCellEditor(int row, int col) { if ((row == DBSeerDataSet.TYPE_USE_ENTIRE_DATASET || row > TYPE_NUM_TRANSACTION_TYPE + numTransactionTypes) && col == 1) return dce; return super.getCellEditor(row, col); } }; DefaultTableCellRenderer customRenderder = new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b2, int row, int col) { Component cell = super.getTableCellRendererComponent(jTable, o, b, b2, row, col); if (row == DBSeerDataSet.TYPE_START_INDEX || row == DBSeerDataSet.TYPE_END_INDEX) { if (((Boolean) table.getValueAt(DBSeerDataSet.TYPE_USE_ENTIRE_DATASET, 1)) .booleanValue() == true) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } } // else if (row == DBSeerDataSet.TYPE_AVERAGE_LATENCY || // row == DBSeerDataSet.TYPE_HEADER || // row == DBSeerDataSet.TYPE_MONITORING_DATA || // row == DBSeerDataSet.TYPE_PERCENTILE_LATENCY || // row == DBSeerDataSet.TYPE_TRANSACTION_COUNT || // row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE || // row == DBSeerDataSet.TYPE_STATEMENT_FILE || // row == DBSeerDataSet.TYPE_QUERY_FILE || // row == DBSeerDataSet.TYPE_TRANSACTION_FILE) else if (row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } return cell; } }; table.getColumnModel().getColumn(0).setCellRenderer(customRenderder); table.getColumnModel().getColumn(1).setCellRenderer(customRenderder); table.setFillsViewportHeight(true); table.getColumnModel().getColumn(0).setMaxWidth(400); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.setRowHeight(20); this.useEntireDataSet = true; for (String header : tableHeaders) { if (header.equalsIgnoreCase("Use Entire DataSet")) tableModel.addRow(new Object[] { header, Boolean.TRUE }); else tableModel.addRow(new Object[] { header, "" }); } this.updateLiveDataSet(); for (int i = 0; i < numTransactionTypes; ++i) { tableModel.addRow(new Object[] { "Name of Transaction Type " + (i + 1), "Type " + (i + 1) }); DBSeerTransactionType type = new DBSeerTransactionType("Type " + (i + 1), true); transactionTypes.add(type); } for (int i = 0; i < transactionTypes.size(); ++i) { DBSeerTransactionType txType = transactionTypes.get(i); if (txType.isEnabled()) { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.TRUE }); } else { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.FALSE }); } } this.updateTable(); dataSetLoaded = false; tableModel.setUseEntireDataSet(this.useEntireDataSet.booleanValue()); }
From source file:org.gumtree.vis.plot1d.Plot1D.java
private void createChart() { String title = null;/*w w w. j ava 2 s .c o m*/ String xTitle = null; String yTitle = null; if (dataset != null) { title = dataset.getTitle(); xTitle = dataset.getXTitle() + (dataset.getXUnits() == null ? "" : " (" + dataset.getXUnits() + ")"); yTitle = dataset.getYTitle() + (dataset.getYUnits() == null ? "" : " (" + dataset.getYUnits() + ")"); } else { dataset = new XYErrorDataset(); } chart = createXYLineChart(title, xTitle, yTitle, dataset, PlotOrientation.VERTICAL, true, false, true); chart.setBackgroundPaint(Color.WHITE); final LegendTitle legend = (LegendTitle) chart.getLegend(); RectangleEdge legendPosition = RectangleEdge.BOTTOM; try { String legendProperty = "RectangleEdge." + System.getProperty("kuranda1D.legendPosition"); if (RectangleEdge.BOTTOM.toString().equals(legendProperty)) legendPosition = RectangleEdge.BOTTOM; else if (RectangleEdge.RIGHT.toString().equals(legendProperty)) legendPosition = RectangleEdge.RIGHT; else if (RectangleEdge.LEFT.toString().equals(legendProperty)) legendPosition = RectangleEdge.LEFT; else if (RectangleEdge.TOP.toString().equals(legendProperty)) legendPosition = RectangleEdge.TOP; } catch (Exception e) { // TODO: handle exception } legend.setPosition(legendPosition); chart.setBorderVisible(true); // ChartUtilities.applyCurrentTheme(chart); // chartTheme.apply(chart); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainPannable(true); plot.setRangePannable(true); plot.setDomainGridlinesVisible(true); // plot.setDomainCrosshairLockedOnData(true); // plot.setDomainCrosshairVisible(true); plot.setRangeGridlinesVisible(true); // plot.setRangeCrosshairLockedOnData(true); // plot.setRangeCrosshairVisible(true); xAxis = plot.getDomainAxis(); yAxis = plot.getRangeAxis(); plot.setDataset(dataset); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); if (renderer instanceof XYLineAndShapeRenderer) { // ((XYLineAndShapeRenderer) renderer).setBaseShapesVisible(true); ((XYLineAndShapeRenderer) renderer).setBaseShapesFilled(true); } // XYErrorRenderer errorRenderer = (XYErrorRenderer) chart.getXYPlot().getRenderer(); // errorRenderer.setDrawXError(true); // StandardXYItemRenderer renderer = (StandardXYItemRenderer) plot.getRenderer(); // renderer.setPlotLines(true); // renderer.setBaseShapesVisible(true); chart.fireChartChanged(); }
From source file:net.frontlinesms.plugins.textforms.ui.ManageQuestionsPanelHandler.java
public void focusLost(Object textfield) { String searchText = this.ui.getText(textfield); if (searchText == null || searchText.length() == 0) { this.ui.setText(textfield, TextFormsMessages.getMessageSearchQuestions()); this.ui.setForeground(Color.LIGHT_GRAY); } else {// w w w . j a va 2s.c om this.ui.setForeground(Color.BLACK); } }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep1(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step1.1", "Konfigurationsdatei"), localeDelegate.getMessage("dbtransfer.import.step1.2", "Bitte w\u00e4hlen Sie eine Konfigurationsdatei aus.")); final JLabel lbFile = new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.3", "Datei")); utils.initJPanel(step,/*from w w w . j a v a 2 s . com*/ new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, TableLayout.PREFERRED, lbFile.getPreferredSize().height, TableLayout.FILL }); final JButton btnBrowse = new JButton("..."); //final JProgressBar progressBar = new JProgressBar(0, 230); final JCheckBox chbxImportAsNuclon = new JCheckBox( localeDelegate.getMessage("configuration.transfer.import.as.nuclon", "Import als Nuclon")); chbxImportAsNuclon.setEnabled(false); final JEditorPane editWarnings = new JEditorPane(); editWarnings.setContentType("text/html"); editWarnings.setEditable(false); editWarnings.setBackground(Color.WHITE); final JScrollPane scrollWarn = new JScrollPane(editWarnings); scrollWarn.setPreferredSize(new Dimension(680, 250)); scrollWarn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); scrollWarn.getVerticalScrollBar().setUnitIncrement(20); scrollWarn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollWarn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JScrollPane scrollPrev = new JScrollPane(jpnPreviewContent); scrollPrev.setPreferredSize(new Dimension(680, 250)); scrollPrev.setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); scrollPrev.getVerticalScrollBar().setUnitIncrement(20); scrollPrev.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPrev.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JPanel jpnPreview = new JPanel(new BorderLayout()); jpnPreview.add(jpnPreviewHeader, BorderLayout.NORTH); jpnPreview.add(scrollPrev, BorderLayout.CENTER); jpnPreview.add(jpnPreviewFooter, BorderLayout.SOUTH); jpnPreview.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jpnPreview.setBackground(Color.WHITE); jpnPreviewHeader.setBackground(Color.WHITE); jpnPreviewContent.setBackground(Color.WHITE); jpnPreviewFooter.setBackground(Color.WHITE); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(localeDelegate.getMessage("configuration.transfer.prepare.warnings.tab", "Warnungen"), scrollWarn); final String sDefaultPreparePreviewTabText = localeDelegate .getMessage("configuration.transfer.prepare.preview.tab", "Vorschau der Schema Aenderungen"); tabbedPane.addTab(sDefaultPreparePreviewTabText, jpnPreview); final JLabel lbNewUser = new JLabel(); step.add(lbFile, "0,0"); step.add(tfTransferFile, "1,0"); step.add(btnBrowse, "2,0"); step.add(chbxImportAsNuclon, "1,1");//step.add(progressBar, "1,1"); step.add(lbNewUser, "0,2,3,2"); step.add(tabbedPane, "0,3,3,3"); tfTransferFile.setEditable(false); final ActionListener prepareImportAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_PREPARE); Thread t = new Thread() { @Override public void run() { step.setComplete(false); boolean blnTransferWithWarnings = false; //progressBar.setValue(0); //progressBar.setVisible(true); try { String fileName = tfTransferFile.getText(); if (StringUtils.isNullOrEmpty(fileName)) { return; } File f = new File(fileName); long size = f.length(); final InputStream fin = new BufferedInputStream(new FileInputStream(f)); final byte[] transferFile; try { transferFile = utils.getBytes(fin, (int) size); } finally { fin.close(); } resetStep2(); importTransferObject = getTransferFacadeRemote().prepareTransfer(isNuclon, transferFile); chbxImportAsNuclon.setEnabled(importTransferObject.getTransferOptions() .containsKey(TransferOption.IS_NUCLON_IMPORT_ALLOWED)); step.setComplete(!importTransferObject.result.hasCriticals()); if (!importTransferObject.result.hasCriticals() && !importTransferObject.result.hasWarnings()) { editWarnings.setText(localeDelegate.getMessage( "configuration.transfer.prepare.no.warnings", "Keine Warnungen")); } else { editWarnings.setText("<html><body><font color=\"#800000\">" + importTransferObject.result.getCriticals() + "</font>" + (importTransferObject.result.hasCriticals() ? "<br />" : "") + importTransferObject.result.getWarnings() + "</body></html>"); } int iPreviewSize = importTransferObject.getPreviewParts().size(); blnTransferWithWarnings = setupPreviewPanel(importTransferObject.getPreviewParts()); tabbedPane.setTitleAt(1, sDefaultPreparePreviewTabText + (iPreviewSize == 0 ? "" : " (" + iPreviewSize + ")")); lbNewUser.setText( "Neue Benutzer" + ": " + (importTransferObject.getNewUserCount() == 0 ? "keine" : importTransferObject.getNewUserCount())); } catch (Exception e) { // progressBar.setVisible(false); Errors.getInstance().showExceptionDialog(ifrm, e); } finally { btnBrowse.setEnabled(true); // progressBar.setVisible(false); ifrm.unlockLayer(); } if (blnTransferWithWarnings) { JOptionPane.showMessageDialog(jpnPreviewContent, localeDelegate.getMessage( "dbtransfer.import.step1.19", "Nicht alle Statements knnen durchgefhrt werden!\nBitte kontrollieren Sie die mit rot markierten Eintrge!", "Warning", JOptionPane.WARNING_MESSAGE)); } } }; t.start(); } }; final ActionListener browseAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.nuclet", "Nuclet-Dateien"), ".nuclet"); final int iBtn = filechooser.showOpenDialog(ifrm); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { tfTransferFile.setText(""); btnBrowse.setEnabled(false); //progressBar.setVisible(true); String fileName = file.getPath(); if (StringUtils.isNullOrEmpty(fileName)) { return; } tfTransferFile.setText(fileName); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } } } }; final ActionListener importAsNuclonAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isNuclon = chbxImportAsNuclon.isSelected(); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } }; btnBrowse.addActionListener(browseAction); chbxImportAsNuclon.addActionListener(importAsNuclonAction); // progressBar.setVisible(false); return step; }
From source file:cs.stats.gui.StatsCharts.java
private ChartPanel createChart(String axisLabel, int type) { int width = (screenSize.width - (screenSize.width / 35)); int height = (int) (screenSize.height - (screenSize.height / (double) 4)); //int width = (screenSize.width - (screenSize.width / 35)) / 2; //int height = (int) (screenSize.height - (screenSize.height / (double) 4)) / 2; lastValue = new double[SUBPLOT_COUNT]; //================= visualise standard chart ========================== CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(new DateAxis("Time")); lastValue[0] = 100D;/*from w w w .jav a2s. c o m*/ TimeSeries timeseries = null; XYPlot xyplot = null; //add new timeseries to modularity row datasets[type] = new TimeSeriesCollection(); NumberAxis numberaxis = new NumberAxis(axisLabel); numberaxis.setAutoRangeIncludesZero(true); //fast StandardXYItemRenderer xyItemRender = new StandardXYItemRenderer(); //original //xyItemRender = new StandardXYItemRenderer(); xyItemRender.setSeriesStroke(0, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(1, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(2, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(3, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(4, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(5, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(6, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(7, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(8, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); xyItemRender.setSeriesStroke(9, new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0)); //TODO colours need to be defined statically before the renderer is created! xyplot = new XYPlot(datasets[type], null, numberaxis, xyItemRender); switch (type) { case 0: { xyItemRender.setSeriesPaint(0, Color.BLACK); timeseries = new TimeSeries("Reply rate 1.0", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(1, Color.BLUE); timeseries = new TimeSeries("Reply rate 0.9", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(2, Color.ORANGE); timeseries = new TimeSeries("Reply rate 0.8", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(3, Color.GREEN); timeseries = new TimeSeries("Reply rate 0.7", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(4, Color.MAGENTA); timeseries = new TimeSeries("Reply rate 0.6", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY); timeseries = new TimeSeries("Reply rate 0.5", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(6, Color.YELLOW); timeseries = new TimeSeries("Reply rate 0.4", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); // xyItemRender.setSeriesPaint(7, Color.PINK); // timeseries = new TimeSeries("Reply rate 0.3", org.jfree.data.time.Hour.class); // datasets[type].addSeries(timeseries); // // xyItemRender.setSeriesPaint(8, Color.RED); // timeseries = new TimeSeries("Reply rate 0.2", org.jfree.data.time.Hour.class); // datasets[type].addSeries(timeseries); // // xyItemRender.setSeriesPaint(9, Color.CYAN); // timeseries = new TimeSeries("Reply rate 0.1", org.jfree.data.time.Hour.class); // datasets[type].addSeries(timeseries); } break; case 1: { xyItemRender.setSeriesPaint(0, Color.BLACK); timeseries = new TimeSeries("0% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(1, Color.BLUE); timeseries = new TimeSeries("1% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(2, Color.ORANGE); timeseries = new TimeSeries("2% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(3, Color.GREEN); timeseries = new TimeSeries("3% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(4, Color.MAGENTA); timeseries = new TimeSeries("3.5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY); timeseries = new TimeSeries("4% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(6, Color.YELLOW); timeseries = new TimeSeries("4.5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(7, Color.PINK); timeseries = new TimeSeries("5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(8, Color.RED); timeseries = new TimeSeries("5.5% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(9, Color.CYAN); timeseries = new TimeSeries("6% of community users removed", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; case 2: { xyItemRender.setSeriesPaint(0, Color.GRAY); timeseries = new TimeSeries("Average number of thread replies (per hour)", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; case 3: { xyItemRender.setSeriesPaint(0, Color.GREEN); timeseries = new TimeSeries("New thread arrival activity change (%)", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); xyItemRender.setSeriesPaint(1, Color.BLUE); timeseries = new TimeSeries("Thread reply activity change (%)", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; case 4: { xyItemRender.setSeriesPaint(0, Color.GREEN); timeseries = new TimeSeries("Mean thread aswer time", org.jfree.data.time.Hour.class); datasets[type].addSeries(timeseries); } break; } NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis(); //rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setTickUnit(new NumberTickUnit(0.1)); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.add(xyplot); ChartPanel chart = null; switch (type) { case 0: { jfreechart1 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart1.getSubtitle(0); //set legend fonts jfreechart1.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart1.setBorderPaint(Color.black); jfreechart1.setBorderVisible(true); jfreechart1.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis1 = combineddomainxyplot.getDomainAxis(); dateAxis1 = (DateAxis) valueAxis1; dateAxis1.setTickUnit(new DateTickUnit(1, 1)); if (scope1 == 0) { valueAxis1.setAutoRange(true); } else { valueAxis1.setFixedAutoRange(scope1); } chart = new ChartPanel(jfreechart1); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); //chart.add(buildPlotDisplayManagementPanel(valueAxis1, dateAxis1, ddlScope1)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart1.setAntiAlias(false); } break; case 1: { jfreechart2 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart2.getSubtitle(0); //set legend fonts jfreechart2.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart2.setBorderPaint(Color.black); jfreechart2.setBorderVisible(true); jfreechart2.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis2 = combineddomainxyplot.getDomainAxis(); dateAxis2 = (DateAxis) valueAxis2; dateAxis2.setTickUnit(new DateTickUnit(1, 1)); if (scope2 == 0) { valueAxis2.setAutoRange(true); } else { valueAxis2.setFixedAutoRange(scope2); } chart = new ChartPanel(jfreechart2); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart2.setAntiAlias(false); } break; case 2: { jfreechart3 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart3.getSubtitle(0); //set legend fonts jfreechart3.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart3.setBorderPaint(Color.black); jfreechart3.setBorderVisible(true); jfreechart3.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis3 = combineddomainxyplot.getDomainAxis(); dateAxis3 = (DateAxis) valueAxis3; if (scope3 == 0) { valueAxis3.setAutoRange(true); } else { valueAxis3.setFixedAutoRange(scope3); } chart = new ChartPanel(jfreechart3); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chart.add(buildPlotDisplayManagementPanel(valueAxis3, dateAxis3, ddlScope3)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart3.setAntiAlias(false); } break; case 3: { jfreechart4 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart4.getSubtitle(0); //set legend fonts jfreechart4.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart4.setBorderPaint(Color.black); jfreechart4.setBorderVisible(true); jfreechart4.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis4 = combineddomainxyplot.getDomainAxis(); dateAxis4 = (DateAxis) valueAxis4; if (scope4 == 0) { valueAxis4.setAutoRange(true); } else { valueAxis4.setFixedAutoRange(scope4); } chart = new ChartPanel(jfreechart4); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chart.add(buildPlotDisplayManagementPanel(valueAxis4, dateAxis4, ddlScope4)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart4.setAntiAlias(false); } break; case 4: { jfreechart5 = new JFreeChart("", combineddomainxyplot); LegendTitle legendtitle = (LegendTitle) jfreechart5.getSubtitle(0); //set legend fonts jfreechart5.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11)); legendtitle.setPosition(RectangleEdge.BOTTOM); legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D)); jfreechart5.setBorderPaint(Color.black); jfreechart5.setBorderVisible(true); jfreechart5.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); valueAxis5 = combineddomainxyplot.getDomainAxis(); dateAxis5 = (DateAxis) valueAxis5; if (scope5 == 0) { valueAxis5.setAutoRange(true); } else { valueAxis5.setFixedAutoRange(scope5); } chart = new ChartPanel(jfreechart5); chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chart.add(buildPlotDisplayManagementPanel(valueAxis5, dateAxis5, ddlScope5)); combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10)); chart.setPreferredSize(new Dimension(width, height)); jfreechart5.setAntiAlias(false); } break; } return chart; }
From source file:eremeykin.pete.plotter.PolarPlotterTopComponent.java
JFreeChart createChart(XYDataset dataset) { final JFreeChart chart = ChartFactory.createPolarChart(" ?", dataset, true, true, false);/*from ww w . j av a 2 s.co m*/ chart.setBackgroundPaint(Color.white); plot = (PolarPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAngleGridlinePaint(Color.BLACK); plot.setRadiusGridlinePaint(Color.LIGHT_GRAY); final DefaultPolarItemRenderer renderer = new DefaultPolarItemRenderer(); renderer.setSeriesShape(1, ShapeUtilities.createDiamond(1)); renderer.setSeriesShape(2, ShapeUtilities.createDiamond(1)); renderer.setSeriesShape(3, ShapeUtilities.createDiamond(1)); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesPaint(2, Color.BLUE); renderer.setSeriesPaint(3, Color.BLACK); plot.setRenderer(renderer); chart.setTitle(new org.jfree.chart.title.TextTitle(" ?", new java.awt.Font("Arial", java.awt.Font.PLAIN, 16))); return chart; }