List of usage examples for java.awt Color darkGray
Color darkGray
To view the source code for java.awt Color darkGray.
Click Source Link
From source file:org.fhaes.jsea.JSEABarChart.java
/** * Returns an array of paint objects that will be used for the bar colors. this method sets the colors for each bar. * // w ww . ja va2 s .co m * @return An array of paint objects. */ private static Paint[] createPaint(int lengthOfWindow, Color color) { Paint[] colors = new Paint[lengthOfWindow]; for (int i = 0; i <= lengthOfWindow - 1; i++) { colors[i] = new GradientPaint(0f, 0f, color, 0f, 0f, color); // colors[i] = new GradientPaint(0f, 0f, Color.pink, 0f, 0f, Color.yellow); } for (int i = 0; i <= lengthOfWindow - 1; i++) { if (meanByWindow[i] > leftEndPointSim[i][alphaLevel] && meanByWindow[i] < rightEndPointSim[i][alphaLevel]) { colors[i] = new GradientPaint(0f, 0f, Color.darkGray, 0f, 0f, Color.darkGray); // colors[i] = new GradientPaint(0f, 0f, Color.CYAN, 0f, 0f, // Color.ORANGE); } } return colors; }
From source file:dk.dma.epd.common.prototype.notification.StrategicRouteNotificationDetailPanelCommon.java
/** * Create the panel./*from w w w . j a v a2s . c o m*/ * * @param title the title of the message panel * @param routeMessage the request message * @param routeChanges the route changes * @param the index of the message with 0 being the latest */ public StrategicNotificationMessageView(String title, StrategicRouteMessage routeMessage, String routeChanges, int index) { super(new GridBagLayout()); boolean isLatest = index == 0; if (!isLatest) { setBackground(Color.darkGray); } Insets insets0 = new Insets(0, 0, 0, 0); Insets insets1 = new Insets(5, 5, 5, 5); // ************************* // Create the title panel // ************************* JPanel titlePanel = new JPanel(new GridBagLayout()); add(titlePanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets0, 0, 0)); // Title if (isLatest) { titlePanel.setBackground(titlePanel.getBackground().darker()); } titlePanel.add(bold(new JLabel(title)), new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets1, 0, 0)); titlePanel.add(new JLabel(Formatter.formatLongDateTime(routeMessage.getSentDate())), new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, EAST, NONE, insets1, 0, 0)); // Type CloudMessageStatus cloudStatus = isLatest ? routeMessage.getCloudMessageStatus() : null; add(new JLabel("Status:"), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); add(new JLabel(StrategicRouteNotificationDetailPanelCommon.getStatusType(routeMessage.getStatus(), cloudStatus, false)), new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); // Message label if (!StringUtils.isBlank(routeMessage.getMessage())) { JLabel msgLabel = new JLabel("<html>" + Formatter.formatHtml(routeMessage.getMessage()) + "</html>"); msgLabel.setBorder(new TitledBorder("Message")); add(msgLabel, new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets1, 0, 0)); } // Route changes if (!StringUtils.isBlank(routeChanges)) { JLabel routeLabel = new JLabel("<html>" + Formatter.formatHtml(routeChanges) + "</html>"); routeLabel.setBorder(new TitledBorder("Route changes")); add(routeLabel, new GridBagConstraints(0, 3, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets1, 0, 0)); } }
From source file:net.sf.mzmine.chartbasics.chartthemes.ChartThemeFactory.java
/** * Creates the theme called "Karst". In this theme, the charts have a blue background and yellow * lines and labels.// w w w .j ava 2 s.co m * * @return The "Karst" theme. */ public static EStandardChartTheme createKarstTheme() { EStandardChartTheme theme = new EStandardChartTheme(THEME.KARST, "Karst"); // Fonts theme.setExtraLargeFont(new Font("Arial", Font.BOLD, 20)); theme.setLargeFont(new Font("Arial", Font.BOLD, 11)); theme.setRegularFont(new Font("Arial", Font.PLAIN, 11)); theme.setSmallFont(new Font("Arial", Font.PLAIN, 11)); // Paint bg = new Color(50, 50, 202); // theme.setTitlePaint(Color.green); theme.setSubtitlePaint(Color.yellow); theme.setLegendBackgroundPaint(bg); theme.setLegendItemPaint(Color.yellow); theme.setChartBackgroundPaint(bg); theme.setPlotBackgroundPaint(bg); theme.setPlotOutlinePaint(Color.yellow); theme.setBaselinePaint(Color.white); theme.setCrosshairPaint(Color.red); theme.setLabelLinkPaint(Color.lightGray); theme.setTickLabelPaint(Color.yellow); theme.setAxisLabelPaint(Color.yellow); theme.setShadowPaint(Color.darkGray); theme.setItemLabelPaint(Color.yellow); theme.setDrawingSupplier(new DefaultDrawingSupplier( new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587") }, new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC") }, new Stroke[] { new BasicStroke(2.0f) }, new Stroke[] { new BasicStroke(0.5f) }, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE)); theme.setErrorIndicatorPaint(Color.lightGray); theme.setGridBandPaint(new Color(255, 255, 255, 20)); theme.setGridBandAlternatePaint(new Color(255, 255, 255, 40)); // axis Color transp = new Color(255, 255, 255, 200); theme.setRangeGridlinePaint(transp); theme.setDomainGridlinePaint(transp); theme.setAxisLinePaint(Color.yellow); theme.setMasterFontColor(Color.yellow); // axis offset theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); return theme; }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.dialcharts.SimpleDial.java
/** * Creates the chart ./*from ww w . ja va 2 s . c o m*/ * * @param chartTitle the chart title. * @param dataset the dataset. * * @return A chart . */ public JFreeChart createChart(DatasetMap datasets) { // get data for diagrams logger.debug("IN"); Dataset dataset = (Dataset) datasets.getDatasets().get("1"); DialPlot plot = new DialPlot(); plot.setDataset((ValueDataset) dataset); ArcDialFrame dialFrame = null; if (!horizontalView) { plot.setView(0.78, 0.37, 0.22, 0.26); dialFrame = new ArcDialFrame(-10.0, 20.0); } else { plot.setView(0.21, 0.0, 0.58, 0.30); dialFrame = new ArcDialFrame(60.0, 60.0); } dialFrame.setInnerRadius(0.65); dialFrame.setOuterRadius(0.90); dialFrame.setForegroundPaint(Color.darkGray); dialFrame.setStroke(new BasicStroke(3.0f)); plot.setDialFrame(dialFrame); GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(240, 240, 240)); DialBackground sdb = new DialBackground(gp); GradientPaintTransformType gradientPaintTransformType = GradientPaintTransformType.VERTICAL; if (horizontalView) { gradientPaintTransformType = GradientPaintTransformType.HORIZONTAL; } sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer(gradientPaintTransformType)); plot.addLayer(sdb); if (!(increment > 0)) { logger.warn("increment cannot be less than 0, put default to 0.1 "); increment = 0.1; } StandardDialScale scale = null; if (!horizontalView) { scale = new StandardDialScale(lower, upper, -8, 16.0, increment, minorTickCount); } else { scale = new StandardDialScale(lower, upper, 115.0, -50.0, increment, minorTickCount); } // sets intervals for (Iterator iterator = intervals.iterator(); iterator.hasNext();) { KpiInterval interval = (KpiInterval) iterator.next(); StandardDialRange range = new StandardDialRange(interval.getMin(), interval.getMax(), interval.getColor()); range.setInnerRadius(0.70); range.setOuterRadius(0.75); plot.addLayer(range); } scale.setTickRadius(0.88); scale.setTickLabelOffset(0.07); //set tick label style Font tickLabelsFont = new Font(labelsTickStyle.getFontName(), Font.PLAIN, labelsTickStyle.getSize()); scale.setTickLabelFont(tickLabelsFont); scale.setTickLabelPaint(labelsTickStyle.getColor()); //scale.setMajorTickIncrement(25.0); plot.addScale(0, scale); DialPointer needle = new DialPointer.Pin(); needle.setRadius(0.82); plot.addLayer(needle); DialValueIndicator dvi = new DialValueIndicator(0); dvi.setFont(new Font(labelsValueStyle.getFontName(), Font.PLAIN, labelsValueStyle.getSize())); dvi.setPaint(labelsValueStyle.getColor()); plot.addLayer(dvi); JFreeChart chart1 = new JFreeChart(plot); chart1.setBackgroundPaint(color); TextTitle title = setStyleTitle(name, styleTitle); chart1.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart1.addSubtitle(subTitle); } logger.debug("OUT"); return chart1; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a bar chart.//from www. j a va 2s .co m * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @return JfreeChart instance. */ public JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); return chart; }
From source file:nu.nethome.home.items.web.GraphServlet.java
/** * This is the main enterence point of the class. This is called when a http request is * routed to this servlet.// ww w .ja va2 s .c o m */ public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { ServletOutputStream p = res.getOutputStream(); Date startTime = null; Date stopTime = null; // Analyse arguments String fileName = req.getParameter("file"); if (fileName != null) fileName = getFullFileName(fromURL(fileName)); String startTimeString = req.getParameter("start"); String stopTimeString = req.getParameter("stop"); try { if (startTimeString != null) { startTime = m_Format.parse(startTimeString); } if (stopTimeString != null) { stopTime = m_Format.parse(stopTimeString); } } catch (ParseException e1) { e1.printStackTrace(); } String look = req.getParameter("look"); if (look == null) look = ""; TimeSeries timeSeries = new TimeSeries("Data", Minute.class); // Calculate time window Calendar cal = Calendar.getInstance(); Date currentTime = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); Date startOfDay = cal.getTime(); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); Date startOfWeek = cal.getTime(); cal.set(Calendar.DAY_OF_MONTH, 1); Date startOfMonth = cal.getTime(); cal.set(Calendar.MONTH, Calendar.JANUARY); Date startOfYear = cal.getTime(); // if (startTime == null) startTime = startOfWeek; if (stopTime == null) stopTime = currentTime; if (startTime == null) startTime = new Date(stopTime.getTime() - 1000L * 60L * 60L * 24L * 2L); try { // Open the data file File logFile = new File(fileName); Scanner fileScanner = new Scanner(logFile); Long startTimeMs = startTime.getTime(); Long month = 1000L * 60L * 60L * 24L * 30L; boolean doOptimize = true; boolean justOptimized = false; try { while (fileScanner.hasNext()) { try { // Get next log entry String line = fileScanner.nextLine(); if (line.length() > 21) { // Adapt the time format String minuteTime = line.substring(0, 16).replace('.', '-'); // Parse the time stamp Minute min = Minute.parseMinute(minuteTime); // Ok, this is an ugly optimization. If the current time position in the file // is more than a month (30 days) ahead of the start of the time window, we // quick read two weeks worth of data, assuming that there is 4 samples per hour. // This may lead to scanning past start of window if there are holes in the data // series. if (doOptimize && ((startTimeMs - min.getFirstMillisecond()) > month)) { for (int i = 0; (i < (24 * 4 * 14)) && fileScanner.hasNext(); i++) { fileScanner.nextLine(); } justOptimized = true; continue; } // Detect if we have scanned past the window start position just after an optimization scan. // If this is the case it may be because of the optimization. In that case we have to switch // optimization off and start over. if ((min.getFirstMillisecond() > startTimeMs) && doOptimize && justOptimized) { logFile = new File(fileName); fileScanner = new Scanner(logFile); doOptimize = false; continue; } justOptimized = false; // Check if value is within time window if ((min.getFirstMillisecond() > startTimeMs) && (min.getFirstMillisecond() < stopTime.getTime())) { // Parse the value double value = Double.parseDouble((line.substring(20)).replace(',', '.')); // Add the entry timeSeries.add(min, value); doOptimize = false; } } } catch (SeriesException se) { // Bad entry, for example due to duplicates at daylight saving time switch } catch (NumberFormatException nfe) { // Bad number format in a line, try to continue } } } catch (Exception e) { System.out.println(e.toString()); } finally { fileScanner.close(); } } catch (FileNotFoundException f) { System.out.println(f.toString()); } // Create a collection for plotting TimeSeriesCollection data = new TimeSeriesCollection(); data.addSeries(timeSeries); JFreeChart chart; int xSize = 750; int ySize = 450; // Customize colors and look of the Graph. if (look.equals("mobtemp")) { // Look for the mobile GUI chart = ChartFactory.createTimeSeriesChart(null, null, null, data, false, false, false); XYPlot plot = chart.getXYPlot(); ValueAxis timeAxis = plot.getDomainAxis(); timeAxis.setAxisLineVisible(false); ValueAxis valueAxis = plot.getRangeAxis(0); valueAxis.setAxisLineVisible(false); xSize = 175; ySize = 180; } else { // Create a Chart with time range as heading SimpleDateFormat localFormat = new SimpleDateFormat(); String heading = localFormat.format(startTime) + " - " + localFormat.format(stopTime); chart = ChartFactory.createTimeSeriesChart(heading, null, null, data, false, false, false); Paint background = new Color(0x9D8140); chart.setBackgroundPaint(background); TextTitle title = chart.getTitle(); // fix title Font titleFont = title.getFont(); titleFont = titleFont.deriveFont(Font.PLAIN, (float) 14.0); title.setFont(titleFont); title.setPaint(Color.darkGray); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(background); plot.setDomainGridlinePaint(Color.darkGray); ValueAxis timeAxis = plot.getDomainAxis(); timeAxis.setAxisLineVisible(false); ValueAxis valueAxis = plot.getRangeAxis(0); valueAxis.setAxisLineVisible(false); plot.setRangeGridlinePaint(Color.darkGray); XYItemRenderer renderer = plot.getRenderer(0); renderer.setSeriesPaint(0, Color.darkGray); xSize = 750; ySize = 450; } try { res.setContentType("image/png"); res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); res.setHeader("Pragma", "no-cache"); res.setStatus(HttpServletResponse.SC_OK); ChartUtilities.writeChartAsPNG(p, chart, xSize, ySize); } catch (IOException e) { System.err.println("Problem occurred creating chart."); } p.flush(); p.close(); return; }
From source file:net.sourceforge.processdash.ui.web.psp.TimeLogPhaseWaterfallChart.java
private void setupGaps(GapSkipTracker gapTracker, DateAxis dateAxis, XYPlot plot) { if (gapTracker.gaps.isEmpty()) return;// w ww . j a v a 2s . c o m SegmentedTimeline timeline = new SegmentedTimeline(1000, 100, 0); timeline.setStartTime(gapTracker.leftEnd); for (Span gap : gapTracker.gaps) { timeline.addException(gap.start + GAP_SPACING, gap.end - 1000); long annotationX = gap.start + GAP_SPACING / 2; plot.addAnnotation(new XYLineAnnotation(annotationX, VERT_LINE_MIN_Y, annotationX, VERT_LINE_MAX_Y, GAP_STROKE, Color.darkGray)); double boxW = GAP_SPACING * 0.4; XYBoxAnnotation box = new XYBoxAnnotation(annotationX - boxW, VERT_LINE_MIN_Y, annotationX + boxW, VERT_LINE_MAX_Y, null, null, null); String toolTip = resources.format("No_Activity_FMT", gap.getStart(), gap.getEnd()); box.setToolTipText(toolTip); plot.addAnnotation(box); } dateAxis.setTimeline(timeline); }
From source file:com.juanhg.icewalker.IceWalkerApplet.java
@Override public void run() { end = false;/*from w ww .j a v a2 s .c o m*/ while (!end) { model.getT().pause(); chart.deleteAnnotation(boxAnnotation); boxAnnotation = chart.setImageAtPoint(boxImage, model.getBoxPoint()); chart.deleteAnnotation(personAnnotation); rotatedPersonImage = ImageProcessing.rotateRadians(getPersonImage(), model.getPhiPerson()); personAnnotation = chart.setImageAtPoint(rotatedPersonImage, model.getPersonPoint()); chart.replacePlot(1, model.getRopeToPerson(), "", Color.darkGray, 3f, true); chart.replacePlot(2, model.getRopeToBox(), "", Color.darkGray, 3f, true); paintEnergy(); panelSimulation.actualizaGrafica(chart); repaint(); //Begin step of simulation model.simulate(); //End Step of simulation String v = String.valueOf((model.getV())); if (v.length() > 8) { lblVValue.setText(v.substring(0, 8)); } else { lblVValue.setText(v); } String x = String.valueOf(model.getPersonX()); if (x.length() > 8) { lblPositionValue.setText(x.substring(0, 8)); } else { lblPositionValue.setText(x); } if (model.readyToEat()) { btnBanana.setEnabled(true); btnBurger.setEnabled(true); btnCarrot.setEnabled(true); btnCookie.setEnabled(true); } try { Thread.sleep((long) sleepTime); } catch (InterruptedException ex) { Logger.getLogger(IceWalkerApplet.class.getName()).log(Level.SEVERE, null, ex); } model.getT().start(); try { Thread.sleep((long) 20); } catch (InterruptedException ex) { Logger.getLogger(IceWalkerApplet.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:savant.view.swing.Frame.java
/** * Set the tracks associated with this frame. Normally, this should only be * done once, since the Frame also uses this opportunity to set up some GUI * elements which depend on the presence of loaded tracks. * * @param newTracks the tracks to be displayed in this frame *//*from w ww . j a va 2 s . co m*/ public void setTracks(Track[] newTracks) { Track t0 = newTracks[0]; DataFormat df = t0.getDataFormat(); if (!GenomeController.getInstance().isGenomeLoaded() && df != DataFormat.SEQUENCE) { handleEvent(new TrackCreationEvent(new Exception())); for (Track track : newTracks) { TrackController.getInstance().removeTrack(track); } DialogUtils.displayError("Sorry", "This does not appear to be a genome track. Please load a genome first."); return; } if (df == DataFormat.SEQUENCE) { GenomeController.getInstance().setSequence((SequenceTrack) newTracks[0]); } tracks = newTracks; graphPane.setTracks(tracks); for (Track t : tracks) { t.setFrame(this, initialDrawingMode); // Adds the track to the TrackController's internal list, and fires a TrackEvent.ADDED event to all listeners. TrackController.getInstance().addTrack(t); } commandBar = new FrameCommandBar(this); // We get the name and other properties from the zero'th track. setKey(t0.getName()); if (df != DataFormat.SEQUENCE && df != DataFormat.RICH_INTERVAL) { yMaxPanel = new JLabel(); yMaxPanel.setBorder(BorderFactory.createLineBorder(Color.darkGray)); yMaxPanel.setBackground(new Color(240, 240, 240)); yMaxPanel.setOpaque(true); yMaxPanel.setAlignmentX(0.5f); if (df == DataFormat.ALIGNMENT) { // We need to listen to genome changes so that we can redraw mismatches as appropriate. GenomeController.getInstance().addListener(new Listener<GenomeChangedEvent>() { @Override public void handleEvent(GenomeChangedEvent event) { // In certain BAM modes, we care about whether the sequence has been set (or unset). if (event.getNewGenome() == event.getOldGenome()) { forceRedraw(); } } }); } } GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.anchor = GridBagConstraints.NORTHEAST; gbc.weightx = 1.0; gbc.insets = new Insets(4, 0, 0, 0); sidePanel.add(commandBar, gbc); sidePanel.add(legend, gbc); if (yMaxPanel != null) { sidePanel.add(yMaxPanel, gbc); } gbc.weighty = 1.0; gbc.fill = GridBagConstraints.VERTICAL; JPanel filler = new JPanel(); filler.setOpaque(false); sidePanel.add(filler, gbc); drawTracksInRange(LocationController.getInstance().getReferenceName(), LocationController.getInstance().getRange()); JPanel contentPane = (JPanel) getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(frameLandscape); }
From source file:com.polivoto.vistas.acciones.Datos.java
private void setcolors() { colores.add(Color.red);/*from www.j ava 2s. c o m*/ colores.add(Color.green); colores.add(Color.blue); colores.add(Color.yellow); colores.add(Color.magenta); colores.add(Color.cyan); colores.add(Color.pink); colores.add(Color.orange); colores.add(Color.darkGray); colores.add(Color.white); }