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:net.sf.dynamicreports.test.jasper.chart.HighLowChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*from w w w . ja va 2 s.c o m*/ JFreeChart chart = getChart("summary.chart1", 0); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); Assert.assertEquals("renderer", HighLowRenderer.class, renderer.getClass()); Assert.assertEquals("show open ticks", true, ((HighLowRenderer) renderer).getDrawOpenTicks()); Assert.assertEquals("show close ticks", true, ((HighLowRenderer) renderer).getDrawCloseTicks()); highLowChartDataTest(chart, 0, new Object[][] { { "serie", date1, 50d, 35d, 40d, 47d, 70d }, { "serie", date2, 55d, 40d, 50d, 45d, 120d }, { "serie", date3, 48d, 41d, 42d, 47d, 90d } }); chart = getChart("summary.chart2", 0); Axis axis = chart.getXYPlot().getDomainAxis(); Assert.assertEquals("category label", "time", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); chart = getChart("summary.chart3", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); }
From source file:org.cyberoam.iview.charts.CustomDomainAxis.java
public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null;/*from w w w . j a va 2 s. c o m*/ // DefaultCategoryDataset dataset=null; CustomCategoryDataset datasetCustom = null; try { ReportColumnBean reportColumnBeanX = null; ReportColumnBean reportColumnBeanY = null; ReportColumnBean reportColumnBeanZ = null; GraphBean graphBean = null; graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId()); reportColumnBeanX = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getXColumnId());//getting ReportColumnBean For X Axis String xColumnDBname = reportColumnBeanX.getDbColumnName(); reportColumnBeanY = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBeanY.getDbColumnName(); String zColumnDBname = null; datasetCustom = new CustomCategoryDataset(); rsw.beforeFirst(); String data = ""; int count = -1; Boolean showLegend = false; if (graphBean.getZColumnId() == -1) { while (rsw.next()) { data = rsw.getString(xColumnDBname); datasetCustom.addValue(rsw.getLong(yColumnDBname), "", data); } } else { String zData; showLegend = true; reportColumnBeanZ = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getZColumnId()); zColumnDBname = reportColumnBeanZ.getDbColumnName(); while (rsw.next()) { data = rsw.getString(xColumnDBname); zData = rsw.getString(zColumnDBname); datasetCustom.addValue(rsw.getLong(yColumnDBname), zData, data); count++; } } chart = ChartFactory.createLineChart("", // chart title "", // domain axis label "", // range axis label datasetCustom, // data PlotOrientation.VERTICAL, // orientation showLegend, // include legend true, // tooltips false // urls ); LegendTitle legendTitle = chart.getLegend(); if (legendTitle != null) legendTitle.setItemFont(new Font("Vandara", Font.BOLD, 11)); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); rangeAxis.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); rangeAxis.setTickLabelInsets(new RectangleInsets(0, 0, 0, 5)); rangeAxis.setTickLabelsVisible(true); rangeAxis.setTickMarksVisible(false); rangeAxis.setAxisLineVisible(false); CustomDomainAxis catAxis = new CustomDomainAxis(); CustomDomainAxis.counter = 0; CustomDomainAxis.colCount = datasetCustom.getColumnCount(); catAxis.setTickLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10)); catAxis.setTickMarksVisible(false); catAxis.setTickLabelInsets(new RectangleInsets(10, 15, 30, 10)); catAxis.setAxisLineVisible(false); catAxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(20 * Math.PI / 180)); plot.setDomainAxis(catAxis); final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.DARK_GRAY); if (count > 0) { Color[] colors = null; colors = new Color[5]; colors[0] = new Color(24, 112, 176); colors[1] = new Color(168, 192, 232); colors[2] = new Color(248, 120, 8); colors[3] = new Color(248, 184, 120); colors[4] = new Color(152, 216, 136); for (int i = 0; i < count && i < colors.length; i++) renderer.setSeriesPaint(i, colors[i]); } } catch (Exception e) { CyberoamLogger.appLog.debug("LineChart: " + e.getMessage(), e); } return chart; }
From source file:edu.harvard.mcz.imagecapture.encoder.LabelEncoder.java
@SuppressWarnings("hiding") public static boolean printList(List<UnitTrayLabel> taxa) throws PrintFailedException { boolean result = false; UnitTrayLabel label = new UnitTrayLabel(); LabelEncoder encoder = new LabelEncoder(label); Image image = encoder.getImage(); int counter = 0; try {//from www .j a va 2s. co m Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("labels.pdf")); document.setPageSize(PageSize.LETTER); document.open(); PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100f); //table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT); float[] cellWidths = { 30f, 20f, 30f, 20f }; table.setWidths(cellWidths); UnitTrayLabelLifeCycle uls = new UnitTrayLabelLifeCycle(); if (taxa == null) { taxa = uls.findAll(); } Iterator<UnitTrayLabel> i = taxa.iterator(); PdfPCell cell = null; PdfPCell cell_barcode = null; // Create two lists of 12 cells, the first 6 of each representing // the left hand column of 6 labels, the second 6 of each // representing the right hand column. // cells holds the text for each label, cells_barcode the barcode. ArrayList<PdfPCell> cells = new ArrayList<PdfPCell>(12); ArrayList<PdfPCell> cells_barcode = new ArrayList<PdfPCell>(12); for (int x = 0; x < 12; x++) { cells.add(null); cells_barcode.add(null); } int cellCounter = 0; while (i.hasNext()) { // Loop through all of the taxa (unit tray labels) found to print label = i.next(); for (int toPrint = 0; toPrint < label.getNumberToPrint(); toPrint++) { // For each taxon, loop through the number of requested copies // Generate a text and a barcode cell for each, and add to array for page log.debug("Label " + toPrint + " of " + label.getNumberToPrint()); cell = new PdfPCell(); cell.setBorderColor(Color.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); cell.disableBorderSide(PdfPCell.RIGHT); cell.setPaddingLeft(3); String higherNames = ""; if (label.getTribe().trim().length() > 0) { higherNames = label.getFamily() + ": " + label.getSubfamily() + ": " + label.getTribe(); } else { higherNames = label.getFamily() + ": " + label.getSubfamily(); } Paragraph higher = new Paragraph(); higher.setFont(new Font(Font.TIMES_ROMAN, 11, Font.NORMAL)); higher.add(new Chunk(higherNames)); cell.addElement(higher); Paragraph name = new Paragraph(); Chunk genus = new Chunk(label.getGenus().trim() + " "); genus.setFont(new Font(Font.TIMES_ROMAN, 11, Font.ITALIC)); Chunk species = new Chunk(label.getSpecificEpithet().trim()); Chunk normal = null; // normal font prefix to preceed specific epithet (nr. <i>epithet</i>) if (label.getSpecificEpithet().contains(".") || label.getSpecificEpithet().contains("[")) { if (label.getSpecificEpithet().startsWith("nr. ")) { normal = new Chunk("nr. "); normal.setFont(new Font(Font.TIMES_ROMAN, 11, Font.NORMAL)); species = new Chunk(label.getSpecificEpithet().trim().substring(4)); species.setFont(new Font(Font.TIMES_ROMAN, 11, Font.ITALIC)); } else { species.setFont(new Font(Font.TIMES_ROMAN, 11, Font.NORMAL)); } } else { species.setFont(new Font(Font.TIMES_ROMAN, 11, Font.ITALIC)); } String s = ""; if (label.getSubspecificEpithet().trim().length() > 0) { s = " "; } else { s = ""; } Chunk subspecies = new Chunk(s + label.getSubspecificEpithet().trim()); if (label.getSubspecificEpithet().contains(".") || label.getSubspecificEpithet().contains("[")) { subspecies.setFont(new Font(Font.TIMES_ROMAN, 11, Font.NORMAL)); } else { subspecies.setFont(new Font(Font.TIMES_ROMAN, 11, Font.ITALIC)); } if (label.getInfraspecificRank().trim().length() > 0) { s = " "; } else { s = ""; } Chunk infraRank = new Chunk(s + label.getInfraspecificRank().trim()); infraRank.setFont(new Font(Font.TIMES_ROMAN, 11, Font.NORMAL)); if (label.getInfraspecificEpithet().trim().length() > 0) { s = " "; } else { s = ""; } Chunk infra = new Chunk(s + label.getInfraspecificEpithet().trim()); infra.setFont(new Font(Font.TIMES_ROMAN, 11, Font.ITALIC)); if (label.getUnNamedForm().trim().length() > 0) { s = " "; } else { s = ""; } Chunk unNamed = new Chunk(s + label.getUnNamedForm().trim()); unNamed.setFont(new Font(Font.TIMES_ROMAN, 11, Font.NORMAL)); name.add(genus); if (normal != null) { name.add(normal); } name.add(species); name.add(subspecies); name.add(infraRank); name.add(infra); name.add(unNamed); cell.addElement(name); Paragraph authorship = new Paragraph(); authorship.setFont(new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); if (label.getAuthorship() != null && label.getAuthorship().length() > 0) { Chunk c_authorship = new Chunk(label.getAuthorship()); authorship.add(c_authorship); } cell.addElement(authorship); //cell.addElement(new Paragraph(" ")); if (label.getDrawerNumber() != null && label.getDrawerNumber().length() > 0) { Paragraph drawerNumber = new Paragraph(); drawerNumber.setFont(new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); Chunk c_drawerNumber = new Chunk(label.getDrawerNumber()); drawerNumber.add(c_drawerNumber); cell.addElement(drawerNumber); } else { if (label.getCollection() != null && label.getCollection().length() > 0) { Paragraph collection = new Paragraph(); collection.setFont(new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); Chunk c_collection = new Chunk(label.getCollection()); collection.add(c_collection); cell.addElement(collection); } } cell_barcode = new PdfPCell(); cell_barcode.setBorderColor(Color.LIGHT_GRAY); cell_barcode.disableBorderSide(PdfPCell.LEFT); cell_barcode.setVerticalAlignment(PdfPCell.ALIGN_TOP); encoder = new LabelEncoder(label); image = encoder.getImage(); image.setAlignment(Image.ALIGN_TOP); cell_barcode.addElement(image); cells.add(cellCounter, cell); cells_barcode.add(cellCounter, cell_barcode); cellCounter++; // If we have hit a full set of 12 labels, add them to the document // in two columns, filling left column first, then right if (cellCounter == 12) { // add a page of 12 cells in columns of two. for (int x = 0; x < 6; x++) { if (cells.get(x) == null) { PdfPCell c = new PdfPCell(); c.setBorder(0); table.addCell(c); table.addCell(c); } else { table.addCell(cells.get(x)); table.addCell(cells_barcode.get(x)); } if (cells.get(x + 6) == null) { PdfPCell c = new PdfPCell(); c.setBorder(0); table.addCell(c); table.addCell(c); } else { table.addCell(cells.get(x + 6)); table.addCell(cells_barcode.get(x + 6)); } } // Reset to begin next page cellCounter = 0; document.add(table); table = new PdfPTable(4); table.setWidthPercentage(100f); table.setWidths(cellWidths); for (int x = 0; x < 12; x++) { cells.set(x, null); cells_barcode.set(x, null); } } } // end loop through toPrint (for a taxon) counter++; } // end while results has next (for all taxa requested) // get any remaining cells in pairs for (int x = 0; x < 6; x++) { if (cells.get(x) == null) { PdfPCell c = new PdfPCell(); c.setBorder(0); table.addCell(c); table.addCell(c); } else { table.addCell(cells.get(x)); table.addCell(cells_barcode.get(x)); } if (cells.get(x + 6) == null) { PdfPCell c = new PdfPCell(); c.setBorder(0); table.addCell(c); table.addCell(c); } else { table.addCell(cells.get(x + 6)); table.addCell(cells_barcode.get(x + 6)); } } // add any remaining cells document.add(table); try { document.close(); } catch (Exception e) { throw new PrintFailedException("No labels to print." + e.getMessage()); } // Check to see if there was content in the document. if (counter == 0) { result = false; } else { // Printed to pdf ok. result = true; // Increment number printed. i = taxa.iterator(); while (i.hasNext()) { label = i.next(); for (int toPrint = 0; toPrint < label.getNumberToPrint(); toPrint++) { label.setPrinted(label.getPrinted() + 1); } label.setNumberToPrint(0); try { uls.attachDirty(label); } catch (SaveFailedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); throw new PrintFailedException("File not found."); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); throw new PrintFailedException("Error buiding PDF document."); } catch (OutOfMemoryError e) { System.out.println("Out of memory error. " + e.getMessage()); System.out.println("Failed. Too many labels."); throw new PrintFailedException("Ran out of memory, too many labels at once."); } return result; }
From source file:fr.lig.sigma.astral.gui.graph.JUNGEnginePanel.java
public JUNGEnginePanel(JUNGEngineGraph graph) { // Graph<V, E> where V is the type of the vertices and E is the type of the edges labelTransformer = new Transformer<QueryNode, String>() { public String transform(QueryNode vertex) { if (vertex.getName().equals("virtual")) { return ""; }//w w w .jav a 2s .c o m if (vertex.getName().equals("source")) { return getDisplayLabel("<b> " + vertex.getParameters().get("id") + " </b>"); } if (vertex.getName().equals("handler")) { return getDisplayLabel("<b> " + vertex.getParameters().get("type") + " </b>"); } if (vertex.getName().equals("unary")) { String r = "<table><tr><td> </td><td><b><center>"; List<Map<String, Object>> operations = (List<Map<String, Object>>) vertex.getParameters() .get("operations"); for (Map<String, Object> op : operations) { r += "" + op.get("otype") + "<br/>"; } r += "</center></b></td><td> </td></tr></table>"; //r = r.substring(0, r.length()-5); return getDisplayLabel(r); } String label = ""; label += "<table><tr><td> </td><td><b><center>"; label += vertex.getName().replaceAll("\n", "<br/>"); label += "</center></b></td><td> </td></tr></table>"; /*if (debugVertices) { label += "<hr/>"; label += out instanceof Stream ? "Stream" : "Relation"; label += "<br/>"; label += AttributeSet.string(out.getAttributes()); } */ return getDisplayLabel(label); } }; g = graph; g.setPanel(this); layout = new JUNGEngineLayout(g.getGraph(), labelTransformer); vv = new VisualizationViewer<QueryNode, String>(layout); vv.setPreferredSize(layout.getSize()); vv.getRenderContext().setVertexLabelTransformer(labelTransformer); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<QueryNode, String>()); VertexLabelAsShapeRenderer<QueryNode, String> vlasr = new VertexLabelAsShapeRenderer<QueryNode, String>( vv.getRenderContext()); vv.getRenderContext().setVertexShapeTransformer(vlasr); vv.getRenderer().setVertexRenderer(new BasicVertexRenderer<QueryNode, String>()); vv.getRenderer().setVertexLabelRenderer(vlasr); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.black)); /*ConstantTransformer whiteColor = new ConstantTransformer(Color.WHITE); vv.getRenderContext().setEdgeDrawPaintTransformer(whiteColor); vv.getRenderContext().setArrowDrawPaintTransformer(whiteColor); */ ps = new MultiPickedState<QueryNode>(); vv.setPickedVertexState(ps); vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<QueryNode>( vv.getPickedVertexState(), Color.LIGHT_GRAY, new Color(255, 102, 0))); vv.setBackground(Color.WHITE); scaler = new CrossoverScalingControl(); this.addComponentListener(this); setLayout(new BorderLayout()); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv.setGraphMouse(graphMouse); add(panel, BorderLayout.CENTER); /*new Thread(new Runnable() { public void run() { try { Thread.sleep(30000); } catch (InterruptedException e) { } Dimension size = layout.getSize(); BufferedImage bi = new BufferedImage((int)size.getWidth(),(int)size.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); vv.setSize(size); vv.paint(g); //this == JComponent g.dispose(); try{ ImageIO.write(bi, "png", new File("test.png"));}catch (Exception e) {} } }).start(); */ }
From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.PreviewParametersDialog.java
private JPanel createButtonsPanel() { final JButton okButton = new JButton(confirmAction); okButton.setDefaultCapable(true);/*from w ww . j a va 2 s .c om*/ final JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); buttonsPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY)); buttonsPanel.add(okButton); buttonsPanel.add(new JButton(new CancelAction())); return buttonsPanel; }
From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java
/** * Sets the default text for the specified field. * * @param field The field to handle./*from w ww .j a v a 2s .c om*/ * @param text The text to display. */ private void setTextFieldDefault(JTextField field, String text) { field.getDocument().removeDocumentListener(this); if (text == null) { field.setText(""); field.setForeground(originalColor); } else { field.setText(text); field.setForeground(Color.LIGHT_GRAY); } field.getDocument().addDocumentListener(this); setControls(); }
From source file:org.ut.biolab.medsavant.client.view.UpdatesPanel.java
private void showPopup(final int start) { popup = new JPopupMenu(); popup.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1)); if (notifications == null) { popup.add(new NotificationIcon(null, null)); } else {/*from ww w . j a va 2 s . com*/ //add notifications for (int i = start; i < Math.min(start + 5, notifications.length); i++) { popup.add(new NotificationIcon(notifications[i], popup)); if (i != Math.min(start + 5, notifications.length) - 1) { popup.add(createSeparator()); } } //add page header if (notifications.length > 5) { JPanel header = new JPanel(); header.setMinimumSize(new Dimension(1, 15)); header.setLayout(new BoxLayout(header, BoxLayout.X_AXIS)); if (start >= 5) { JLabel prevButton = ViewUtil.createLabelButton(" Prev Page "); prevButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { showPopup(start - 5); } }); header.add(prevButton); } header.add(Box.createHorizontalGlue()); if (start + 5 < notifications.length) { JLabel nextButton = ViewUtil.createLabelButton(" Next Page "); nextButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { showPopup(start + 5); } }); header.add(nextButton); } popup.add(createSeparator()); popup.add(header); } } //int offset = -Math.min(5, notifications.length - start) * (MENU_ICON_SIZE.height + 2) -3 - (headerAdded ? 16 : 0); popup.show(this, 0, this.getPreferredSize().height); }
From source file:umontreal.iro.lecuyer.charts.SSJCategorySeriesCollection.java
protected static String detectXColorClassic(Color color) { String retour = null;/*from w w w . ja va 2 s .c o m*/ int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); // On utilise pas la method Color.equals(Color ) car on ne veut pas tester le parametre de transparence : Alpha if (red == Color.GREEN.getRed() && blue == Color.GREEN.getBlue() && green == Color.GREEN.getGreen()) return "green"; else if (red == Color.RED.getRed() && blue == Color.RED.getBlue() && green == Color.RED.getGreen()) return "red"; else if (red == Color.WHITE.getRed() && blue == Color.WHITE.getBlue() && green == Color.WHITE.getGreen()) return "white"; else if (red == Color.GRAY.getRed() && blue == Color.GRAY.getBlue() && green == Color.GRAY.getGreen()) return "gray"; else if (red == Color.BLACK.getRed() && blue == Color.BLACK.getBlue() && green == Color.BLACK.getGreen()) return "black"; else if (red == Color.YELLOW.getRed() && blue == Color.YELLOW.getBlue() && green == Color.YELLOW.getGreen()) return "yellow"; else if (red == Color.MAGENTA.getRed() && blue == Color.MAGENTA.getBlue() && green == Color.MAGENTA.getGreen()) return "magenta"; else if (red == Color.CYAN.getRed() && blue == Color.CYAN.getBlue() && green == Color.CYAN.getGreen()) return "cyan"; else if (red == Color.BLUE.getRed() && blue == Color.BLUE.getBlue() && green == Color.BLUE.getGreen()) return "blue"; else if (red == Color.DARK_GRAY.getRed() && blue == Color.DARK_GRAY.getBlue() && green == Color.DARK_GRAY.getGreen()) return "darkgray"; else if (red == Color.LIGHT_GRAY.getRed() && blue == Color.LIGHT_GRAY.getBlue() && green == Color.LIGHT_GRAY.getGreen()) return "lightgray"; else if (red == Color.ORANGE.getRed() && blue == Color.ORANGE.getBlue() && green == Color.ORANGE.getGreen()) return "orange"; else if (red == Color.PINK.getRed() && blue == Color.PINK.getBlue() && green == Color.PINK.getGreen()) return "pink"; if (red == 192 && blue == 128 && green == 64) return "brown"; else if (red == 128 && blue == 128 && green == 0) return "olive"; else if (red == 128 && blue == 0 && green == 128) return "violet"; else if (red == 192 && blue == 0 && green == 64) return "purple"; else return null; }
From source file:org.pmedv.core.dialogs.AbstractNiceDialog.java
private JPanel createHeader(String title, String subTitle, ImageIcon icon) { int headerHeight = 50; FormLayout formLayout = new FormLayout("8dlu, 10dlu, fill:pref:grow, 7dlu, pref, 7dlu", "4dlu, 13dlu,max(" + (headerHeight - 17) + "dlu;default),default"); // GradientPanel header = new GradientPanel(formLayout,Color.WHITE,Color.LIGHT_GRAY); Color blue = new Color(153, 204, 255); GradientPanel header = new GradientPanel(formLayout, Color.WHITE, blue); header.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); header.setBackground(Color.white); JLabel titleLabel = new JLabel(title); JLabel subTitleLabel = new JLabel(subTitle); JLabel iconLabel = (icon == null ? new JLabel() : new JLabel(icon)); titleLabel.setForeground(Color.black); subTitleLabel.setForeground(Color.black); titleLabel.setFont(new Font("Arial", Font.BOLD, 15)); subTitleLabel.setFont(new Font("Arial", Font.PLAIN, 12)); CellConstraints cc = new CellConstraints(); header.add(titleLabel, cc.xywh(2, 2, 2, 1)); header.add(subTitleLabel, cc.xywh(2, 3, 2, 1)); header.add(iconLabel, cc.xywh(5, 1, 1, 3, "right,center")); return (header); }
From source file:com.itemanalysis.jmetrik.graph.barchart.BarChartPanel.java
public void setGraph() throws IllegalArgumentException { boolean hasGroupingVariable = false; if (command.getFreeOption("groupvar").hasValue()) { hasGroupingVariable = true;// w ww .ja v a 2s . co m } String name = command.getFreeOption("variable").getString(); String xLabel = name; DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String yLabel = ""; if (command.getSelectOneOption("yaxis").isValueSelected("freq")) { yLabel = "Frequency"; } else { yLabel = "Percentage"; } if (command.getSelectOneOption("layout").isValueSelected("stacked")) { chart = ChartFactory.createStackedBarChart(command.getFreeOption("title").getString(), xLabel, yLabel, dataset, chartOrientation, hasGroupingVariable, //only show legend if has grouping variable true, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); } else if (command.getSelectOneOption("view").isValueSelected("3D")) { chart = ChartFactory.createBarChart3D(command.getFreeOption("title").getString(), xLabel, yLabel, dataset, chartOrientation, hasGroupingVariable, //only show legend if has grouping variable true, false); } else { chart = ChartFactory.createBarChart(command.getFreeOption("title").getString(), xLabel, yLabel, dataset, chartOrientation, hasGroupingVariable, //only show legend if has grouping variable true, false); } String sub = ""; if (command.getFreeOption("subtitle").getString() != null) { sub = command.getFreeOption("subtitle").getString(); } TextTitle subtitle1 = new TextTitle(sub); chart.addSubtitle(subtitle1); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainGridlinesVisible(true); if (command.getSelectOneOption("layout").isValueSelected("layered")) { LayeredBarRenderer renderer = new LayeredBarRenderer(); // renderer.setDrawBarOutline(false); plot.setRenderer(renderer); plot.setRowRenderingOrder(SortOrder.DESCENDING); } chart.setPadding(new RectangleInsets(20.0, 5.0, 20.0, 5.0)); ChartPanel panel = new ChartPanel(chart); panel.getPopupMenu().addSeparator(); this.addJpgMenuItem(BarChartPanel.this, panel.getPopupMenu()); panel.setPreferredSize(new Dimension(width, height)); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); // plot.setForegroundAlpha(0.80f); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); this.setBackground(Color.WHITE); this.add(panel); }