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:com.AandR.beans.plotting.imagePlotPanel.CanvasPanel.java
/** * *//*w w w. j av a2 s . co m*/ @Override public void paintComponent(Graphics g) { super.paintComponent(g); setBackground(Color.GRAY); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (bufferedImage != null) { scaleGraphicsContext(g2); g2.drawImage(bufferedImage, 0, 0, null); drawTextBoxes(g2); } }
From source file:common.utils.ImageUtils.java
/** * * @param src images to draw, they must be resized to an appropriate size * @param dst image where given images will be drawen *///w w w .ja va 2s .c o m public static void draw4on1(BufferedImage[] src, BufferedImage dst) { Graphics2D g2 = dst.createGraphics(); g2.setColor(java.awt.Color.WHITE); g2.fillRect(0, 0, dst.getWidth(), dst.getHeight()); int dxi; int dyi = 0; int x0 = dst.getWidth() - 5; int y0 = 5; int x = x0; int y = y0; for (int i = 0; i < src.length; i++) { if (i % 2 == 0) { dxi = -10; } else { dxi = 0; } //g2.draw3DRect(dx - 1 , dy-tmp_bi.getHeight() - 1, tmp_bi.getWidth() + 1 , tmp_bi.getHeight() + 1, true); g2.drawImage(src[i], x - src[i].getWidth() + dxi, y + dyi, null); g2.drawString("#" + i, x - src[i].getWidth() + dxi, y + dyi + 20); //g2.rotate(Math.toRadians(4)); y = y + src[i].getHeight() / 2; if (y > dst.getHeight() - src[i].getHeight()) { y = y0; if (dyi == 0) dyi = 10; else dyi = 0; if (x < src[i].getWidth()) { x = dst.getWidth(); } x = x - src[i].getWidth() / 2; } } g2.setColor(Color.gray); g2.drawRect(0, 0, dst.getWidth() - 1, dst.getHeight() - 1); g2.dispose(); }
From source file:com.att.aro.ui.view.diagnostictab.GraphPanel.java
/** * Initializes a new instance of the GraphPanel class. *///w w w . j av a 2s . co m public GraphPanel(IAROView aroview, DiagnosticsTab parent) { if (statemachinefactory == null) { statemachinefactory = ContextAware.getAROConfigContext().getBean(IRrcStateMachineFactory.class); } if (burstcollectionanalyzer == null) { burstcollectionanalyzer = ContextAware.getAROConfigContext().getBean(IBurstCollectionAnalysis.class); } if (packetanalyzer == null) { packetanalyzer = ContextAware.getAROConfigContext().getBean(IPacketAnalyzer.class); } if (graphHelper == null) { graphHelper = new GraphPanelHelper(); } if (guiPreferences == null) { guiPreferences = GUIPreferences.getInstance(); } if (barPlot == null) { barPlot = new CreateBarPlot(); } this.parent = parent; subplotMap.put(ChartPlotOptions.THROUGHPUT, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.throughput"), getBarPlot().drawXYItemPlot(), 2)); subplotMap.put(ChartPlotOptions.BURSTS, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.bursts"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.USER_INPUT, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.userInput"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.RRC, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.rrc"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.ALARM, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.alarm"), getBarPlot().drawXYBarPlot(Color.gray, true), 2)); subplotMap.put(ChartPlotOptions.GPS, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.gps"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.BUFFER_OCCUPANCY, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.buffer.occupancy"), getBarPlot().drawXYItemPlot(), 1)); subplotMap.put(ChartPlotOptions.VIDEO_CHUNKS, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.video.chunks"), getBarPlot().drawYIntervalPlot(), 1)); subplotMap.put(ChartPlotOptions.RADIO, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.radio"), getBarPlot().drawStandardXYPlot(DEFAULT_POINT_SHAPE, Color.red, MIN_SIGNAL, MAX_SIGNAL), 2)); subplotMap.put(ChartPlotOptions.BLUETOOTH, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.bluetooth"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.CAMERA, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.camera"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.SCREEN, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.screen"), getBarPlot().drawXYBarPlot(new Color(34, 177, 76), false), 1)); subplotMap.put(ChartPlotOptions.BATTERY, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.battery"), getBarPlot().drawStandardXYPlot(DEFAULT_POINT_SHAPE, Color.red, MIN_BATTERY, MAX_BATTERY), 2)); subplotMap.put(ChartPlotOptions.TEMPERATURE, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.temperature"), getBarPlot() .drawStandardXYPlot(DEFAULT_POINT_SHAPE, Color.green, MIN_TEMPERATURE, MAX_TEMPERATURE), 2)); subplotMap.put(ChartPlotOptions.WAKELOCK, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.wakelock"), getBarPlot().drawXYBarPlot(Color.yellow, false), 1)); subplotMap.put(ChartPlotOptions.WIFI, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.wifi"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.NETWORK_TYPE, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.networkType"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.CPU, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.cpu"), getBarPlot().drawStandardXYPlot(CPU_PLOT_POINT_SHAPE, Color.black, MIN_CPU_USAGE, MAX_CPU_USAGE), 1)); subplotMap.put(ChartPlotOptions.UL_PACKETS, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.ul"), getBarPlot().drawYIntervalPlot(), 1)); subplotMap.put(ChartPlotOptions.DL_PACKETS, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.dl"), getBarPlot().drawYIntervalPlot(), 1)); subplotMap.put(ChartPlotOptions.BUFFER_TIME_OCCUPANCY, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.bufferTime.occupancy"), getBarPlot().drawXYItemPlot(), 1)); subplotMap.put(ChartPlotOptions.ATTENUATION, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.attenuation"), getBarPlot().drawStepChartPlot(), 2)); subplotMap.put(ChartPlotOptions.SPEED_THROTTLE, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.attenuation"), getBarPlot().drawStepChartPlot(), 2)); setLayout(new BorderLayout()); setMinimumSize(new Dimension(300, 280)); add(getZoomSavePanel(), BorderLayout.EAST); add(getPane(), BorderLayout.CENTER); setGraphPanelBorder(true); setChartOptions(guiPreferences.getChartPlotOptions()); }
From source file:adams.flow.sink.JFreeChartPlot.java
/** * Displays the token (the panel and dialog have already been created at * this stage).// w ww . j ava 2 s . co m * * @param token the token to display */ @Override protected void display(Token token) { SpreadSheet sheet; Dataset dataset; Shape shape; XYPlot plot; sheet = (SpreadSheet) token.getPayload(); dataset = m_Dataset.generate(sheet); m_JFreeChart = m_Chart.generate(dataset); m_JFreeChart.getPlot().setBackgroundPaint(Color.WHITE); if (m_JFreeChart.getPlot() instanceof XYPlot) { plot = (XYPlot) m_JFreeChart.getPlot(); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.GRAY); plot.getRenderer().setSeriesPaint(0, m_PlotColor); if (plot.getSeriesCount() > 1) plot.getRenderer().setSeriesPaint(1, m_DiagonalColor); shape = m_Shape.generate(); if (shape != null) plot.getRenderer().setSeriesShape(0, shape); } m_PlotPanel = new ChartPanel(m_JFreeChart); m_Panel.removeAll(); m_Panel.add(m_PlotPanel, BorderLayout.CENTER); }
From source file:sentimentanalyzer.ChartController.java
public Color getRandomColor() { Color[] picker = new Color[10]; picker[0] = Color.ORANGE;/*from w w w.j a v a 2s .com*/ picker[1] = Color.BLUE; picker[2] = Color.GREEN; picker[3] = Color.YELLOW; picker[4] = Color.BLACK; picker[5] = Color.PINK; picker[6] = Color.CYAN; picker[7] = Color.MAGENTA; picker[8] = Color.RED; picker[9] = Color.GRAY; int index = new Random().nextInt(picker.length); return picker[index]; }
From source file:com.bdb.weather.display.freeplot.SummaryFreePlot.java
/** * Create the JFreeChart series for the humidity values. * /*from w w w. j a v a 2 s .co m*/ * @param stroke The stroke for the series */ private List<FreePlotSeries<SummaryRecord>> createHumiditySeries(Stroke stroke) { List<FreePlotSeries<SummaryRecord>> list = new ArrayList<>(); int n = 0; list.add(new FreePlotSeries<>(MAX_OUTDOOR_HUMIDITY_SERIES_NAME, n++, Color.GRAY, stroke, SummaryRecord::getMaxOutdoorHumidity, dateMethod, period)); list.add(new FreePlotSeries<>(MIN_OUTDOOR_HUMIDITY_SERIES_NAME, n++, Color.BLACK, stroke, SummaryRecord::getMinOutdoorHumidity, dateMethod, period)); list.add(new FreePlotSeries<>(MEAN_OUTDOOR_HUMIDITY_SERIES_NAME, n++, Color.BLACK, stroke, SummaryRecord::getAvgOutdoorHumidity, dateMethod, period)); return list; }
From source file:gov.nih.nci.caintegrator.ui.graphing.chart.plot.PrincipalComponentAnalysisPlot.java
/** * Get the color for a PCA data point. The color is determined by the Color by parameter. * @param pcaPoint/*from w w w .j a v a 2 s .co m*/ * @return */ protected Color getColorForDataPoint(PrincipalComponentAnalysisDataPoint pcaPoint) { Color defaultColor = Color.GRAY; Color retColor = null; if (colorBy == PCAcolorByType.Disease) { String diseaseName = pcaPoint.getDiseaseName(); Color diseaseColor = Color.GRAY; if (diseaseName != null) { DiseaseType disease = DiseaseType.valueOf(diseaseName); if (disease != null) { diseaseColor = disease.getColor(); } } int grade = pcaPoint.getDiseaseGrade(); for (int i = 0; i < grade - 1; i++) { diseaseColor = diseaseColor.brighter(); } retColor = diseaseColor; } else if (colorBy == PCAcolorByType.Gender) { GenderType gender = pcaPoint.getGender(); if (gender != null) { retColor = gender.getColor(); } } if (retColor == null) { retColor = defaultColor; } return retColor; }
From source file:KIDLYRenderer.java
/** * Creates a new bar renderer with default settings. *///w w w .jav a 2 s . co m public KIDLYRenderer() { super(); this.base = 0.0; this.includeBaseInRange = true; this.itemMargin = DEFAULT_ITEM_MARGIN; this.drawBarOutline = false; this.maximumBarWidth = 1.0; // 100 percent, so it will not apply unless changed this.positiveItemLabelPositionFallback = null; this.negativeItemLabelPositionFallback = null; this.gradientPaintTransformer = new StandardGradientPaintTransformer(); this.minimumBarLength = 0.0; setBaseLegendShape(new Rectangle2D.Double(-4.0, -4.0, 8.0, 8.0)); this.barPainter = getDefaultBarPainter(); this.shadowsVisible = getDefaultShadowsVisible(); this.shadowPaint = Color.gray; this.shadowXOffset = 4.0; this.shadowYOffset = 4.0; }
From source file:de.citec.csra.allocation.vis.MovingChart.java
public void updateDataPoints(String id, String label, String resource, long start, long end, State state, Priority prio, boolean token) { synchronized (this.dataset) { TimeSeries series = this.dataset.getSeries(id); if (series == null) { series = new TimeSeries(id); this.dataset.addSeries(series); }//from ww w . ja v a2 s.co m series.setDomainDescription(label); int stroke = -1; Color c = null; boolean randomcolor = false; if (!randomcolor) { switch (prio) { case EMERGENCY: c = Color.RED; break; case URGENT: c = Color.ORANGE; break; case HIGH: c = Color.YELLOW; break; case NORMAL: c = Color.GREEN; break; case LOW: c = Color.BLUE; break; case NO: c = Color.BLACK; break; } } switch (state) { case REQUESTED: stroke = 1; break; case SCHEDULED: stroke = 3; break; case ALLOCATED: stroke = 9; break; case RELEASED: stroke = 1; break; case REJECTED: case CANCELLED: case ABORTED: c = Color.GRAY; stroke = 1; break; } XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) this.chart.getXYPlot() .getRendererForDataset(dataset); int number = -1; for (int i = 0; i < this.dataset.getSeries().size(); i++) { TimeSeries t = this.dataset.getSeries(i); if (t.getKey().equals(id)) { number = i; } } if (number > 0) { if (stroke > 0) { if (token) { r.setSeriesStroke(number, new BasicStroke(stroke, CAP_BUTT, JOIN_BEVEL, 1, new float[] { 1.5f, .5f }, .5f)); } else { r.setSeriesStroke(number, new BasicStroke(stroke, CAP_BUTT, JOIN_BEVEL, 1)); } } if (c != null) { r.setSeriesPaint(number, c); } } long channel; String key = resource; //prio if (values.containsKey(key)) { channel = values.get(key); } else { channel = events++; values.put(key, channel); } if (!series.isEmpty()) { series.clear(); } series.addOrUpdate(new Millisecond(new Date(start)), channel); series.addOrUpdate(new Millisecond(new Date(end)), channel); } }
From source file:MainProgram.MainProgram.java
private void initComponents() throws InterruptedException { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents welcomeMessage = new JLabel(); welcomeMessage2 = new JLabel(); pennIDLabel = new JLabel(); pennIDTextField = new JTextField(); pennPassLabel = new JLabel(); pennPassField = new JPasswordField(); emailLabel = new JLabel(); emailTextField = new JTextField(); emailDomainLabel = new JLabel(); emailPassLabel = new JLabel(); emailPassField = new JPasswordField(); semesterLabel = new JLabel(); semesterComboBox = new JComboBox(semestersString); credentials = new JLabel(); dropLabel = new JLabel(); dropCheckBox = new JCheckBox(); button = new JButton(); stopWatchLabel = new JLabel(); checkMail = false;/*ww w. j a v a2s.c o m*/ testConnection = false; mailCheckTimeInitializer(); StopWatchInitializer(); try { setUIFont(new javax.swing.plaf.FontUIResource("Segoe UI", Font.ROMAN_BASELINE, 12)); } catch (Exception e) { e.printStackTrace(MainProgram.errorLog); } String lcOSName = System.getProperty("os.name").toLowerCase(); boolean IS_MAC = lcOSName.startsWith("mac os x"); //======== this ======== setLayout(new GridBagLayout()); ((GridBagLayout) getLayout()).columnWidths = new int[] { 81, 5, 119, 5, 0, 0 }; if (!IS_MAC) { ((GridBagLayout) getLayout()).rowHeights = new int[] { 17, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 0, 0, 0 }; } ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.fill = GridBagConstraints.HORIZONTAL; //---- welcomeMessage ---- welcomeMessage.setText("Course Registration"); welcomeMessage.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- welcomeMessage2 ---- welcomeMessage2.setText("for Penn State (BETA)"); welcomeMessage2.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDLabel ---- pennIDLabel.setText("Penn State ID: "); pennIDLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennIDLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDTextField ---- pennIDTextField.setText("xxx123"); add(pennIDTextField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennPassLabel ---- pennPassLabel.setText("Penn State Password: "); pennPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennPassLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(pennPassField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailLabel ---- emailLabel.setText("Email: "); emailLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailTextField ---- emailTextField.setText("myEmail"); add(emailTextField, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailDomainLabel ---- emailDomainLabel.setText("@mail.com"); add(emailDomainLabel, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailPassLabel ---- emailPassLabel.setText("Email Password: "); emailPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailPassLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(emailPassField, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester label ---- semesterLabel.setText("Semester/Drop Option: "); semesterLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(semesterLabel, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester ComboBox ---- add(semesterComboBox, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Drop CheckBox ---- add(dropCheckBox, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- button ---- button.setText("Start"); add(button, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- stopWatchLabel ---- stopWatchLabel.setText(" " + stopWatchSplitting[0]); stopWatchLabel.setHorizontalAlignment(SwingConstants.LEFT); add(stopWatchLabel, new GridBagConstraints(2, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- label11 ---- credentials.setText(" Created by Daniyar Yeralin"); credentials.setForeground(Color.gray); credentials.setHorizontalAlignment(SwingConstants.RIGHT); credentials.setFont(new Font("Cambria", Font.ITALIC, 12)); add(credentials, new GridBagConstraints(2, 17, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); /*button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED); button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), JComponent.WHEN_FOCUSED);*/ StartButtonHandler buttonListener = new StartButtonHandler(); button.addActionListener(buttonListener); }