List of usage examples for java.awt Color gray
Color gray
To view the source code for java.awt Color gray.
Click Source Link
From source file:edu.umn.cs.spatialHadoop.OperationsParams.java
public static Color getColor(Configuration conf, String key, Color defaultValue) { String colorName = conf.get(key); if (colorName == null) return defaultValue; colorName = colorName.toLowerCase(); Color color = defaultValue;/*ww w . j a v a 2s . com*/ if (colorName.equals("red")) { color = Color.RED; } else if (colorName.equals("pink")) { color = Color.PINK; } else if (colorName.equals("blue")) { color = Color.BLUE; } else if (colorName.equals("cyan")) { color = Color.CYAN; } else if (colorName.equals("green")) { color = Color.GREEN; } else if (colorName.equals("black")) { color = Color.BLACK; } else if (colorName.equals("white")) { color = Color.WHITE; } else if (colorName.equals("gray")) { color = Color.GRAY; } else if (colorName.equals("yellow")) { color = Color.YELLOW; } else if (colorName.equals("orange")) { color = Color.ORANGE; } else if (colorName.equals("none")) { color = new Color(0, 0, 255, 0); } else if (colorName.matches("#[a-zA-Z0-9]{8}")) { String redHex = colorName.substring(1, 2); String greenHex = colorName.substring(3, 4); String blueHex = colorName.substring(5, 6); String opacityHex = colorName.substring(7, 8); int red = Integer.parseInt(redHex, 16); int green = Integer.parseInt(greenHex, 16); int blue = Integer.parseInt(blueHex, 16); int opacity = Integer.parseInt(opacityHex, 16); color = new Color(red, green, blue, opacity); } else { LOG.warn("Does not understand the color '" + conf.get(key) + "'"); } return color; }
From source file:edu.ucla.stat.SOCR.chart.SuperAreaChart_XY.java
/** * reset dataTable to default (demo data), and refesh chart *//* www.ja v a2s . c om*/ public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); // resetTable(); resetTableRows(tempDataTable.getRowCount()); resetTableColumns(tempDataTable.getColumnCount()); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping setMapping(); //updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperIntervalXYChart.java
/** * reset dataTable to default (demo data), and refesh chart *//*w w w. ja v a 2 s . c om*/ public void resetExample() { isDemo = true; IntervalXYDataset dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); int seriesCount = tempDataTable.getColumnCount() / 2; resetTableRows(tempDataTable.getRowCount() + 1); resetTableColumns(seriesCount * 2); for (int i = 0; i < seriesCount * 2; i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); setMapping(); updateStatus(url); }
From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java
/** * Create pie chart.//from w w w . j a v a2s. co m * * @param dataset * @param title * @return */ protected JFreeChart createBarChart(final CategoryDataset dataset, final String title) { final JFreeChart chart = ChartFactory.createBarChart("", // chart title App.getGuiProp("report.period.lbl"), // domain axis label App.getGuiProp("report.value.lbl"), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls ); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(App.getGuiProp("report.nodata.msg")); plot.setBackgroundPaint(Color.white); ((NumberAxis) plot.getRangeAxis()).setAutoRangeIncludesZero(false); ((CategoryAxis) plot.getDomainAxis()).setMaximumCategoryLabelLines(10); ((CategoryAxis) plot.getDomainAxis()).setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeGridlinesVisible(true); plot.setRangeZeroBaselinePaint(Color.black); plot.setRangeZeroBaselineVisible(true); int color = 0; ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter()); CategoryItemRenderer renderer = plot.getRenderer(); for (int ser = 0; ser < dataset.getColumnCount(); ser++) { renderer.setSeriesPaint(ser, COLORS[color]); renderer.setSeriesItemLabelGenerator(ser, new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance(Locale.GERMAN))); renderer.setSeriesItemLabelsVisible(ser, true); color++; if (COLORS.length == color) { color = 0; } } return chart; }
From source file:com.uttesh.pdfngreport.handler.PdfReportHandler.java
/** * Not Used for the current release/*www . j av a 2s . c o m*/ * * @param dataSet */ public void pieExplodeChart(DefaultPieDataset dataSet, String os) { try { JFreeChart chart = ChartFactory.createPieChart("", dataSet, true, true, false); ChartStyle.theme(chart); PiePlot plot = (PiePlot) chart.getPlot(); plot.setForegroundAlpha(0.6f); plot.setCircular(true); plot.setSectionPaint("Passed", Color.decode("#019244")); plot.setSectionPaint("Failed", Color.decode("#EE6044")); plot.setSectionPaint("Skipped", Color.decode("#F0AD4E")); Color transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f); //plot.setLabelLinksVisible(Boolean.FALSE); plot.setLabelOutlinePaint(transparent); plot.setLabelBackgroundPaint(transparent); plot.setLabelShadowPaint(transparent); plot.setLabelLinkPaint(Color.GRAY); Font font = new Font("SansSerif", Font.PLAIN, 10); plot.setLabelFont(font); plot.setLabelPaint(Color.DARK_GRAY); plot.setExplodePercent("Passed", 0.10); //plot.setExplodePercent("Failed", 0.10); //plot.setExplodePercent("Skipped", 0.10); plot.setSimpleLabels(true); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot.setLabelGenerator(gen); if (os != null && os.equalsIgnoreCase("w")) { ChartUtilities.saveChartAsPNG( new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE), chart, 560, 200); } else { ChartUtilities.saveChartAsPNG( new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE), chart, 560, 200); } } catch (Exception e) { e.printStackTrace(System.err); if (os != null && os.equalsIgnoreCase("w")) { new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE).delete(); } else { new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE).delete(); } System.exit(-1); } }
From source file:com.diversityarrays.kdxplore.field.FieldViewPanel.java
public FieldViewPanel(PlotVisitList plotVisitList, Map<Integer, Trait> traitMap, SeparatorVisibilityOption visible, SimplePlotCellRenderer plotRenderer, Component... extras) { super(new BorderLayout()); this.plotVisitList = plotVisitList; this.traitMap = traitMap; trial = plotVisitList.getTrial();/*from www . jav a 2 s . co m*/ fieldLayoutTableModel.setTrial(trial); int rowHeight = fieldLayoutTable.getRowHeight(); fieldLayoutTable.setRowHeight(4 * rowHeight); fieldLayoutTable.setCellSelectionEnabled(true); fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); // IMPORTANT: DO NOT SORT THE FIELD LAYOUT TABLE fieldLayoutTable.setAutoCreateRowSorter(false); Map<Integer, Plot> plotById = new HashMap<>(); FieldLayout<Integer> plotIdLayout = FieldLayoutUtil.createPlotIdLayout(trial.getTrialLayout(), trial.getPlotIdentSummary(), plotVisitList.getPlots(), plotById); KdxploreFieldLayout<Plot> kdxFieldLayout = new KdxploreFieldLayout<Plot>(Plot.class, plotIdLayout.imageId, plotIdLayout.xsize, plotIdLayout.ysize); kdxFieldLayout.warning = plotIdLayout.warning; String displayName = null; for (VisitOrder2D vo : VisitOrder2D.values()) { if (vo.imageId == plotIdLayout.imageId) { displayName = vo.displayName; break; } } // VisitOrder2D vo = plotVisitList.getVisitOrder(); KDClientUtils.initAction(plotIdLayout.imageId, changeCollectionOrder, displayName); hasUserPlotId = lookForUserPlotIdPresent(plotById, plotIdLayout, kdxFieldLayout); this.plotCellRenderer = plotRenderer; plotCellRenderer.setShowUserPlotId(hasUserPlotId); plotCellRenderer.setPlotXYprovider(getXYprovider()); plotCellRenderer.setPlotVisitList(plotVisitList); fieldLayoutTable.setDefaultRenderer(Plot.class, plotCellRenderer); fieldLayoutTable.setCellSelectionEnabled(true); fieldLayoutTableModel.setFieldLayout(kdxFieldLayout); if (kdxFieldLayout.warning != null && !kdxFieldLayout.warning.isEmpty()) { warningMessage.setText(kdxFieldLayout.warning); } else { warningMessage.setText(""); } fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fieldLayoutTable.getTableHeader().setReorderingAllowed(false); fieldLayoutTable.setCellSelectionEnabled(true); StringBuilder naming = new StringBuilder(); String nameForRow = plotVisitList.getTrial().getNameForRow(); if (!Check.isEmpty(nameForRow)) { naming.append(nameForRow); } String nameForCol = plotVisitList.getTrial().getNameForColumn(); if (!Check.isEmpty(nameForCol)) { if (naming.length() > 0) { naming.append('/'); } naming.append(nameForCol); } fieldTableScrollPane = new JScrollPane(fieldLayoutTable); if (naming.length() > 0) { JLabel cornerLabel = new JLabel(naming.toString()); fieldTableScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, cornerLabel); } fieldTableScrollPane.setRowHeaderView(rowHeaderTable); // fieldLayoutTable.setRowHeaderTable(rowHeaderTable); // Box extra = Box.createHorizontalBox(); // extra.add(new JButton(changeCollectionOrder)); // if (extras != null && extras.length > 0) { // extra.add(Box.createHorizontalStrut(8)); // for (Component c : extras) { // extra.add(c); // } // } // extra.add(Box.createHorizontalGlue()); switch (visible) { case NOTVISIBLE: break; case VISIBLE: default: Box top = Box.createHorizontalBox(); top.setOpaque(true); top.setBackground(Color.LIGHT_GRAY); top.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY)); JLabel label = new JLabel("Field"); label.setForeground(Color.DARK_GRAY); label.setFont(label.getFont().deriveFont(Font.BOLD)); top.add(label); top.add(new JButton(changeCollectionOrder)); if (extras != null && extras.length > 0) { top.add(Box.createHorizontalStrut(8)); for (Component c : extras) { top.add(c); } } add(top, BorderLayout.NORTH); break; } add(fieldTableScrollPane, BorderLayout.CENTER); add(warningMessage, BorderLayout.SOUTH); }
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart_QQ_DD.java
/** * reset dataTable to default (demo data), and refesh chart *///from w w w.j a va 2s . c o m public void resetExample() { XYDataset dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.XY2Table(raw_x, raw_y, larger_row_count); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount() + 1); resetTableColumns(tempDataTable.getColumnCount()); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { //columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); columnModel.getColumn(i).setHeaderValue("Group " + (i + 1)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformHistogramChart.java
protected void setTable(IntervalXYDataset ds, boolean binChanged) { convertor.data2Table(raw_x, transformed_x, "Data", "Transformed Data", row_count); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); resetTableColumns(tempDataTable.getColumnCount()); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); }/* w w w .j ava 2 s. co m*/ columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); JScrollPane dt = new JScrollPane(dataTable); dataPanel.add(dt); dt.setRowHeaderView(headerTable); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // don't bring graph to the front if the bin Size is not changed if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) { if (binChanged) tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel)); } else { dataPanel2.removeAll(); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Data")); JScrollPane dt2 = new JScrollPane(dataTable); dt2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8)); dt2.setRowHeaderView(headerTable); dataPanel2.add(dt2); JScrollPane st = new JScrollPane(summaryPanel); st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6)); dataPanel2.add(st); st.validate(); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Mapping")); mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2)); dataPanel2.add(mapPanel); dataPanel2.validate(); } }
From source file:org.peerfact.impl.service.aggregation.skyeye.visualization.MetricsPlot.java
private LinkedHashMap<String, SeriesInfo> createMetricSeriesInfo(DataSet dataSet) { String[] names = dataSet.getNames(); LinkedHashMap<String, SeriesInfo> tempMap = new LinkedHashMap<String, SeriesInfo>(); SeriesInfo seriesInfo = null;//ww w. j a v a 2s . c om for (int i = 0; i < names.length; i++) { DeviationSet set = dataSet.getValues()[i]; if (names[i].startsWith("Min_")) { seriesInfo = new SeriesInfo(interval, names[i], Color.BLUE, new BasicStroke(1)); } else if (names[i].startsWith("Max_")) { seriesInfo = new SeriesInfo(interval, names[i], Color.RED, new BasicStroke(1)); } else if (names[i].startsWith("Measured")) { seriesInfo = new SeriesInfo(interval, names[i], Color.GRAY, new BasicStroke(3)); } else { seriesInfo = new SeriesInfo(interval, names[i], Color.BLACK, new BasicStroke(4)); } seriesInfo.getDataSeries().add(dataSet.getTime(), set.getValue(), set.getValue() + set.getDeviation(), Math.max(set.getValue() - set.getDeviation(), 0)); tempMap.put(names[i], seriesInfo); } return tempMap; }
From source file:org.pentaho.chart.plugin.jfreechart.chart.dial.JFreeDialChartGenerator.java
protected void setDialPointer(ChartDocument chartDocument, DialPlot dialPlot) { // ~ params begin double pointerRadius = 0.9; // length of pointer double pointerWidthRadius = 0.05; // width of base of pointer Color pointerFillPaint = Color.gray; Color pointerOutlinePaint = Color.black; Stroke pointerOutlineStroke = new BasicStroke(2.0f); // ~ params end VariableStrokePointer pointer = new VariableStrokePointer(); ChartElement pointerElement = getUniqueElement(chartDocument, DIALPOINTER); final Color pointerColorTmp = ColorFactory.getInstance().getColor(pointerElement); if (pointerColorTmp != null) { pointerFillPaint = pointerColorTmp; }// w w w . ja v a 2 s . c o m final Color pointerBorderColorTmp = ColorFactory.getInstance().getColor(pointerElement, BorderStyleKeys.BORDER_TOP_COLOR); if (pointerBorderColorTmp != null) { pointerOutlinePaint = pointerBorderColorTmp; } double pointerWidthRadiusTmp = parseDouble(pointerElement.getLayoutStyle().getValue(BoxStyleKeys.WIDTH)) / 100; if (pointerWidthRadiusTmp != 0) { pointerWidthRadius = pointerWidthRadiusTmp; } double pointerRadiusTmp = parseDouble(pointerElement.getLayoutStyle().getValue(BoxStyleKeys.HEIGHT)) / 100; if (pointerRadiusTmp != 0) { pointerRadius = pointerRadiusTmp; } final BasicStroke borderStyleStroke = StrokeFactory.getInstance().getBorderStroke(pointerElement); if (borderStyleStroke != null) { pointerOutlineStroke = borderStyleStroke; } pointer.setRadius(pointerRadius); pointer.setOutlineStroke(pointerOutlineStroke); pointer.setWidthRadius(pointerWidthRadius); pointer.setFillPaint(pointerFillPaint); pointer.setOutlinePaint(pointerOutlinePaint); // DialPointer pointer = new DialPointer.Pin(); dialPlot.addPointer(pointer); }