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.willwinder.universalgcodesender.uielements.panels.MachineStatusPanel.java
private void initComponents() { // Hookup the reset buttons. resetXButton.addActionListener(ae -> resetCoordinateButton('X')); resetYButton.addActionListener(ae -> resetCoordinateButton('Y')); resetZButton.addActionListener(ae -> resetCoordinateButton('Z')); String debug = ""; //String debug = "debug, "; // MigLayout... 3rd party layout library. MigLayout layout = new MigLayout(debug + "fill, wrap 2"); setLayout(layout);// w w w .j a v a 2 s . c o m add(activeStateLabel, "al right"); add(activeStateValueLabel); add(latestCommentLabel, "al right"); add(latestCommentValueLabel); // Subpanels for work/machine read outs. JPanel workPanel = new JPanel(); workPanel.setBackground(Color.LIGHT_GRAY); workPanel.setLayout(new MigLayout(debug + "fillx, wrap 3, inset 8", "[left][right][grow, right]")); //workPanel.add(workPositionLabel, "span 2, wrap"); workPanel.add(resetXButton); workPanel.add(workPositionXLabel, "al right"); workPanel.add(workPositionXValue, "growx, bottom"); workPanel.add(machinePositionXValue, "span 3, al right, wrap"); workPanel.add(resetYButton); workPanel.add(workPositionYLabel, "al right"); workPanel.add(workPositionYValue, "growx, bottom"); workPanel.add(machinePositionYValue, "span 3, al right, wrap"); workPanel.add(resetZButton); workPanel.add(workPositionZLabel, "al right"); workPanel.add(workPositionZValue, "growx, bottom"); workPanel.add(machinePositionZValue, "span 3, al right, wrap"); add(workPanel, "growx, span 2"); // Enabled pin reporting. pinStatusPanel.setLayout(new MigLayout("flowy, wrap 3")); pinStatusPanel.add(pinX); pinX.setEnabled(false); pinStatusPanel.add(pinY); pinY.setEnabled(false); pinStatusPanel.add(pinZ); pinZ.setEnabled(false); pinStatusPanel.add(pinProbe); pinProbe.setEnabled(false); pinStatusPanel.add(pinDoor); pinDoor.setEnabled(false); pinStatusPanel.add(pinHold); pinHold.setEnabled(false); pinStatusPanel.add(pinSoftReset); pinSoftReset.setEnabled(false); pinStatusPanel.add(pinCycleStart); pinCycleStart.setEnabled(false); }
From source file:WeatherWizard.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Dimension size = getSize();//from ww w. ja va 2 s . c om Composite origComposite; setupWeatherReport(); origComposite = g2.getComposite(); if (alpha0 != null) g2.setComposite(alpha0); g2.drawImage(img0, 0, 0, size.width, size.height, 0, 0, img0.getWidth(null), img0.getHeight(null), null); if (img1 != null) { if (alpha1 != null) g2.setComposite(alpha1); g2.drawImage(img1, 0, 0, size.width, size.height, 0, 0, img1.getWidth(null), img1.getHeight(null), null); } g2.setComposite(origComposite); // Freezing, Cold, Cool, Warm, Hot, // Blue, Green, Yellow, Orange, Red Font font = new Font("Serif", Font.PLAIN, 36); g.setFont(font); String tempString = feels + " " + temperature + "F"; FontRenderContext frc = ((Graphics2D) g).getFontRenderContext(); Rectangle2D boundsTemp = font.getStringBounds(tempString, frc); Rectangle2D boundsCond = font.getStringBounds(condStr, frc); int wText = Math.max((int) boundsTemp.getWidth(), (int) boundsCond.getWidth()); int hText = (int) boundsTemp.getHeight() + (int) boundsCond.getHeight(); int rX = (size.width - wText) / 2; int rY = (size.height - hText) / 2; g.setColor(Color.LIGHT_GRAY); g2.fillRect(rX, rY, wText, hText); g.setColor(textColor); int xTextTemp = rX - (int) boundsTemp.getX(); int yTextTemp = rY - (int) boundsTemp.getY(); g.drawString(tempString, xTextTemp, yTextTemp); int xTextCond = rX - (int) boundsCond.getX(); int yTextCond = rY - (int) boundsCond.getY() + (int) boundsTemp.getHeight(); g.drawString(condStr, xTextCond, yTextCond); }
From source file:dk.dma.epd.common.prototype.gui.voct.VOCTAdditionalInfoPanel.java
/** * Updates the chat message panel in the Swing event thread *///from w w w . j a va 2 s . c o 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; } // Only enable send-function when there is chat data, and hence a target addBtn.setEnabled(true); messageText.setEditable(true); // 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; long ownMMSI = MaritimeCloudUtils.toMmsi(EPD.getInstance().getMaritimeId()); for (VOCTSARInfoMessage message : EPD.getInstance().getVoctHandler().getAdditionalInformationMsgs()) { boolean ownMessage = false; if (message.getSender() == ownMMSI) { ownMessage = true; } // EPD.getInstance().getIdentityHandler().getActor(mmsi) // Check if we need to add a time label if (message.getDate() - lastMessageTime > PRINT_DATE_INTERVAL) { JLabel dateLabel = new JLabel(String.format(ownMessage ? "Added %s" : "Received %s", Formatter.formatShortDateTimeNoTz(new Date(message.getDate())))); 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, ownMessage)); JLabel msgLabel = new ChatMessageLabel(message.getMessage(), ownMessage); msg.add(msgLabel); messagesPanel.add(msg, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, NORTH, HORIZONTAL, insets, 0, 0)); lastMessageTime = message.getDate(); } // 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:com.igalia.java.zk.components.JFreeChartEngine.java
public byte[] drawChart(Object data) { Chart chart = (Chart) data;//w w w . j a va2 s . co m ChartImpl impl = getChartImpl(chart); JFreeChart jfchart = impl.createChart(chart); Plot plot = (Plot) jfchart.getPlot(); float alpha = (float) (((float) chart.getFgAlpha()) / 255); plot.setForegroundAlpha(alpha); alpha = (float) (((float) chart.getBgAlpha()) / 255); plot.setBackgroundAlpha(alpha); int[] bgRGB = chart.getBgRGB(); if (bgRGB != null) { plot.setBackgroundPaint(new Color(bgRGB[0], bgRGB[1], bgRGB[2], chart.getBgAlpha())); } int[] paneRGB = chart.getPaneRGB(); if (paneRGB != null) { jfchart.setBackgroundPaint(new Color(paneRGB[0], paneRGB[1], paneRGB[2], chart.getPaneAlpha())); } //since 3.6.3, JFreeChart 1.0.13 change default fonts which does not support Chinese, allow //developer to set font. //title font final Font tfont = chart.getTitleFont(); if (tfont != null) { jfchart.getTitle().setFont(tfont); } //legend font final Font lfont = chart.getLegendFont(); if (lfont != null) { jfchart.getLegend().setItemFont(lfont); } if (plot instanceof CategoryPlot) { final CategoryPlot cplot = (CategoryPlot) plot; cplot.setRangeGridlinePaint(new Color(0xc0, 0xc0, 0xc0)); //Domain axis(x axis) final Font xlbfont = chart.getXAxisFont(); final Font xtkfont = chart.getXAxisTickFont(); if (xlbfont != null) { cplot.getDomainAxis().setLabelFont(xlbfont); } if (xtkfont != null) { cplot.getDomainAxis().setTickLabelFont(xtkfont); } Color[] colorMappings = (Color[]) chart.getAttribute("series-color-mappings"); if (colorMappings != null) { for (int ii = 0; ii < colorMappings.length; ii++) { cplot.getRenderer().setSeriesPaint(ii, colorMappings[ii]); } } Double lowerBound = (Double) chart.getAttribute("range-axis-lower-bound"); if (lowerBound != null) { cplot.getRangeAxis().setAutoRange(false); cplot.getRangeAxis().setLowerBound(lowerBound); } Double upperBound = (Double) chart.getAttribute("range-axis-upper-bound"); if (upperBound != null) { cplot.getRangeAxis().setAutoRange(false); cplot.getRangeAxis().setUpperBound(upperBound); } //Range axis(y axis) final Font ylbfont = chart.getYAxisFont(); final Font ytkfont = chart.getYAxisTickFont(); if (ylbfont != null) { cplot.getRangeAxis().setLabelFont(ylbfont); } if (ytkfont != null) { cplot.getRangeAxis().setTickLabelFont(ytkfont); } } else if (plot instanceof XYPlot) { final XYPlot xyplot = (XYPlot) plot; xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY); xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY); //Domain axis(x axis) final Font xlbfont = chart.getXAxisFont(); final Font xtkfont = chart.getXAxisTickFont(); if (xlbfont != null) { xyplot.getDomainAxis().setLabelFont(xlbfont); } if (xtkfont != null) { xyplot.getDomainAxis().setTickLabelFont(xtkfont); } //Range axis(y axis) final Font ylbfont = chart.getYAxisFont(); final Font ytkfont = chart.getYAxisTickFont(); if (ylbfont != null) { xyplot.getRangeAxis().setLabelFont(ylbfont); } if (ytkfont != null) { xyplot.getRangeAxis().setTickLabelFont(ytkfont); } } else if (plot instanceof PiePlot) { plot.setOutlineStroke(null); } //callbacks for each area ChartRenderingInfo jfinfo = new ChartRenderingInfo(); BufferedImage bi = jfchart.createBufferedImage(chart.getIntWidth(), chart.getIntHeight(), Transparency.TRANSLUCENT, jfinfo); //remove old areas if (chart.getChildren().size() > 20) chart.invalidate(); //improve performance if too many chart chart.getChildren().clear(); if (Events.isListened(chart, Events.ON_CLICK, false) || chart.isShowTooltiptext()) { int j = 0; String preUrl = null; for (Iterator it = jfinfo.getEntityCollection().iterator(); it.hasNext();) { ChartEntity ce = (ChartEntity) it.next(); final String url = ce.getURLText(); //workaround JFreeChart's bug (skip replicate areas) if (url != null) { if (preUrl == null) { preUrl = url; } else if (url.equals(preUrl)) { //start replicate, skip break; } } //1. JFreeChartEntity area cover the whole chart, will "mask" other areas //2. LegendTitle area cover the whole legend, will "mask" each legend //3. PlotEntity cover the whole chart plotting araa, will "mask" each bar/line/area if (!(ce instanceof JFreeChartEntity) && !(ce instanceof TitleEntity && ((TitleEntity) ce).getTitle() instanceof LegendTitle) && !(ce instanceof PlotEntity)) { Area area = new Area(); area.setParent(chart); area.setCoords(ce.getShapeCoords()); area.setShape(ce.getShapeType()); area.setId("area_" + chart.getId() + '_' + (j++)); if (chart.isShowTooltiptext() && ce.getToolTipText() != null) { area.setTooltiptext(ce.getToolTipText()); } area.setAttribute("url", ce.getURLText()); impl.render(chart, area, ce); if (chart.getAreaListener() != null) { try { chart.getAreaListener().onRender(area, ce); } catch (Exception ex) { throw UiException.Aide.wrap(ex); } } } } } //clean up the "LEGEND_SEQ" //used for workaround LegendItemEntity.getSeries() always return 0 //used for workaround TickLabelEntity no information chart.removeAttribute("LEGEND_SEQ"); chart.removeAttribute("TICK_SEQ"); try { //encode into png image format byte array return EncoderUtil.encode(bi, ImageFormat.PNG, true); } catch (java.io.IOException ex) { throw UiException.Aide.wrap(ex); } }
From source file:visualizer.datamining.dataanalysis.NeighborhoodHit.java
private JFreeChart createChart(XYDataset xydataset) { JFreeChart chart = ChartFactory.createXYLineChart("Neighborhood Hit", "Number Neighbors", "Precision", xydataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot xyplot = (XYPlot) chart.getPlot(); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setAutoRangeIncludesZero(false); xyplot.setDomainGridlinePaint(Color.BLACK); xyplot.setRangeGridlinePaint(Color.BLACK); xyplot.setOutlinePaint(Color.BLACK); xyplot.setOutlineStroke(new BasicStroke(1.0f)); xyplot.setBackgroundPaint(Color.white); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); xyplot.setDrawingSupplier(new DefaultDrawingSupplier( new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE, Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW }, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE)); XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); xylineandshaperenderer.setDrawOutlines(true); return chart; }
From source file:org.ut.biolab.medsavant.client.view.UpdatesPanel.java
private JSeparator createSeparator() { JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); sep.setMaximumSize(new Dimension(1000, 1)); sep.setBackground(Color.WHITE); sep.setForeground(Color.LIGHT_GRAY); return sep;/*from w w w. j a va 2s . co m*/ }
From source file:edu.purdue.cc.bionet.ui.ClusteringDisplayPanel.java
/** * Creates the visualization instance for a ClusteringDisplayPanel * //from ww w . jav a 2 s .c o m * @param experiments The experiments to be associated with this instance. * @return true if creating the visualization succeeded. */ public boolean createView(Collection<Experiment> experiments) { Logger logger = Logger.getLogger(getClass()); this.experiments = experiments; this.samples = new SampleGroup(""); this.molecules = new TreeSet<Molecule>(); for (Experiment experiment : experiments) { this.samples.addAll(experiment.getSamples()); this.molecules.addAll(experiment.getMolecules()); } Collection<SampleGroup> sampleGroups = new ArrayList<SampleGroup>(); sampleGroups.add(new SampleGroup("", samples)); this.sampleSelectorTree = new SampleSelectorTreePanel(this.experiments); this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); this.treeSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JPanel treePanel = new JPanel(new BorderLayout()); this.treeSplitPane.setBottomComponent(this.sampleSelectorTree); treePanel.add(this.treeSplitPane, BorderLayout.CENTER); this.splitPane.setLeftComponent(treePanel); this.clusterGraphPanel = new JPanel(new GridLayout(1, 1, 3, 3)); this.clusterGraphPanel.setBackground(Color.LIGHT_GRAY); this.splitPane.setRightComponent(this.clusterGraphPanel); this.add(this.splitPane, BorderLayout.CENTER); this.splitPane.setDividerLocation(250); this.selectorPanel = new JPanel(new GridLayout(1, 1)); this.treeSplitPane.setTopComponent(this.selectorPanel); this.setSampleGroups(sampleGroups); return true; }
From source file:com.mothsoft.alexis.web.ChartServlet.java
private void doLineGraph(final HttpServletRequest request, final HttpServletResponse response, final String title, final String[] dataSetIds, final Integer width, final Integer height, final Integer numberOfSamples) throws ServletException, IOException { final DataSetService dataSetService = WebApplicationContextUtils .getWebApplicationContext(this.getServletContext()).getBean(DataSetService.class); final OutputStream out = response.getOutputStream(); response.setContentType("image/png"); response.setHeader("Cache-Control", "max-age: 5; must-revalidate"); final XYSeriesCollection seriesCollection = new XYSeriesCollection(); final DateAxis dateAxis = new DateAxis(title != null ? title : "Time"); final DateTickUnit unit = new DateTickUnit(DateTickUnit.HOUR, 1); final DateFormat chartFormatter = new SimpleDateFormat("ha"); dateAxis.setDateFormatOverride(chartFormatter); dateAxis.setTickUnit(unit);/*from www . j a va 2s . c o m*/ dateAxis.setLabelFont(DEFAULT_FONT); dateAxis.setTickLabelFont(DEFAULT_FONT); if (numberOfSamples > 12) { dateAxis.setTickLabelFont( new Font(DEFAULT_FONT.getFamily(), Font.PLAIN, (int) (DEFAULT_FONT.getSize() * .8))); } final NumberAxis yAxis = new NumberAxis("Activity"); final StandardXYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES); int colorCounter = 0; if (dataSetIds != null) { for (final String dataSetIdString : dataSetIds) { final Long dataSetId = Long.valueOf(dataSetIdString); final DataSet dataSet = dataSetService.get(dataSetId); // go back for numberOfSamples, but include current hour final Calendar calendar = new GregorianCalendar(); calendar.add(Calendar.HOUR_OF_DAY, -1 * (numberOfSamples - 1)); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); final Timestamp startDate = new Timestamp(calendar.getTimeInMillis()); calendar.add(Calendar.HOUR_OF_DAY, numberOfSamples); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); final Timestamp endDate = new Timestamp(calendar.getTimeInMillis()); logger.debug(String.format("Generating chart for period: %s to %s", startDate.toString(), endDate.toString())); final List<DataSetPoint> dataSetPoints = dataSetService .findAndAggregatePointsGroupedByUnit(dataSetId, startDate, endDate, TimeUnits.HOUR); final boolean hasData = addSeries(seriesCollection, dataSet.getName(), dataSetPoints, startDate, numberOfSamples, renderer); if (dataSet.isAggregate()) { renderer.setSeriesPaint(seriesCollection.getSeriesCount() - 1, Color.BLACK); } else if (hasData) { renderer.setSeriesPaint(seriesCollection.getSeriesCount() - 1, PAINTS[colorCounter++ % PAINTS.length]); } else { renderer.setSeriesPaint(seriesCollection.getSeriesCount() - 1, Color.LIGHT_GRAY); } } } final XYPlot plot = new XYPlot(seriesCollection, dateAxis, yAxis, renderer); // create the chart... final JFreeChart chart = new JFreeChart(plot); // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... plot.setBackgroundPaint(new Color(253, 253, 253)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabelFont(DEFAULT_FONT); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerBound(0.00d); ChartUtilities.writeChartAsPNG(out, chart, width, height); }
From source file:eu.cassandra.csn.gui.CSN.java
/** * // w w w. j av a 2 s . c o m */ private static void setUpVV() { vv.setBackground(Color.white); vv.getRenderContext() .setVertexFillPaintTransformer(MapTransformer.<MyNode, Paint>getInstance(vertexPaints)); vv.getRenderContext().setVertexShapeTransformer(vertexSize); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<MyNode>()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<MyLink>()); vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<MyNode, Paint>() { public Paint transform(MyNode v) { if (vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else { return Color.BLACK; } } }); vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<MyLink, Paint>getInstance(edgePaints)); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<MyLink, Stroke>() { protected final Stroke THIN = new BasicStroke((float) 0.5); protected final Stroke THICK = new BasicStroke(1); public Stroke transform(MyLink e) { Paint c = edgePaints.get(e); if (c == Color.LIGHT_GRAY) { return THIN; } else { return THICK; } } }); vv.setGraphMouse(gm); vv.getPickedVertexState().addItemListener(new VertexPickListener()); }
From source file:de.tud.kom.p2psim.impl.skynet.visualization.MetricsPlot.java
private DeviationRenderer configureRendererForDataSet(XYItemRenderer r, YIntervalSeriesCollection dataSet) { DeviationRenderer renderer = (DeviationRenderer) r; YIntervalSeries serie = null;/* ww w. ja v a2 s .c o m*/ for (int i = 0; i < dataSet.getSeriesCount(); i++) { serie = dataSet.getSeries(i); renderer.setSeriesStroke(i, displayedSeries.get(serie.getKey()).getStroke()); renderer.setSeriesPaint(i, displayedSeries.get(serie.getKey()).getColor()); renderer.setSeriesFillPaint(i, Color.LIGHT_GRAY); } if (showSdtDev) { renderer.setAlpha(0.3f); } return renderer; }