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:no.met.jtimeseries.chart.ChartPlotter.java
public void addPercipitationBars(TimeBase timeBase, String title, NumberPhenomenon phenomenon, Color color) { XYDataset dataSet = phenomenon.getTimeSeries(title, timeBase); if (dataSet.getSeriesCount() > 0) { double margin = 0.1; double maxPrecipitation = phenomenon.getMaxValue(); addBarChart(dataSet, "value", color, margin, maxPrecipitation); showBarValuesOnTop(plotIndex - 1, 6D); plot.getRangeAxis(getRangeAxisIndex() - 1).setVisible(false); final Marker marker = new ValueMarker(0); marker.setPaint(Color.GRAY); marker.setStroke(new BasicStroke(1)); plot.addRangeMarker(getRangeAxisIndex() - 1, marker, Layer.BACKGROUND); }// w w w . ja va2 s . c o m }
From source file:oscar.oscarEncounter.oscarMeasurements.pageUtil.MeasurementGraphAction2.java
JFreeChart labChart(String demographicNo, String typeIdName, String typeIdName2, String patientName, String chartTitle) {/* ww w . j ava 2s . co m*/ org.jfree.data.time.TimeSeriesCollection dataset = new org.jfree.data.time.TimeSeriesCollection(); ArrayList<EctMeasurementsDataBean> list = getList(demographicNo, typeIdName); String typeYAxisName = ""; if (typeIdName.equals("BP")) { log.debug("Using BP LOGIC FOR type 1 "); EctMeasurementsDataBean sampleLine = list.get(0); typeYAxisName = sampleLine.getTypeDescription(); TimeSeries systolic = new TimeSeries("Systolic", Day.class); TimeSeries diastolic = new TimeSeries("Diastolic", Day.class); for (EctMeasurementsDataBean mdb : list) { // dataVector) { String[] str = mdb.getDataField().split("/"); systolic.addOrUpdate(new Day(mdb.getDateObservedAsDate()), Double.parseDouble(str[0])); diastolic.addOrUpdate(new Day(mdb.getDateObservedAsDate()), Double.parseDouble(str[1])); } dataset.addSeries(diastolic); dataset.addSeries(systolic); } else { log.debug("Not Using BP LOGIC FOR type 1 "); // get the name from the TimeSeries EctMeasurementsDataBean sampleLine = list.get(0); String typeLegendName = sampleLine.getTypeDisplayName(); typeYAxisName = sampleLine.getTypeDescription(); // this should be the type of measurement TimeSeries newSeries = new TimeSeries(typeLegendName, Day.class); for (EctMeasurementsDataBean mdb : list) { //dataVector) { newSeries.addOrUpdate(new Day(mdb.getDateObservedAsDate()), Double.parseDouble(mdb.getDataField())); } dataset.addSeries(newSeries); } JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, "Days", typeYAxisName, dataset, true, true, true); XYPlot plot = chart.getXYPlot(); plot.getDomainAxis().setAutoRange(true); log.debug("LEN " + plot.getDomainAxis().getLowerBound() + " ddd " + plot.getDomainAxis().getUpperMargin() + " eee " + plot.getDomainAxis().getLowerMargin()); plot.getDomainAxis().setUpperMargin(plot.getDomainAxis().getUpperMargin() * 6); plot.getDomainAxis().setLowerMargin(plot.getDomainAxis().getLowerMargin() * 6); plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin() * 1.7); plot.getDomainAxis().setUpperMargin(0.9); plot.getDomainAxis().setLowerMargin(0.9); plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin() * 4); ValueAxis va = plot.getRangeAxis(); va.setAutoRange(true); XYItemRenderer renderer = plot.getRenderer(); //DateFormat.getInstance() XYItemLabelGenerator generator = new StandardXYItemLabelGenerator("{1} \n {2}", new SimpleDateFormat("yyyy.MM.dd"), new DecimalFormat("0.00")); renderer.setSeriesItemLabelGenerator(0, generator);//setLabelGenerator(generator); renderer.setBaseItemLabelsVisible(true); plot.setBackgroundPaint(Color.WHITE); plot.setDomainCrosshairPaint(Color.GRAY); if (renderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer rend = (XYLineAndShapeRenderer) renderer; rend.setBaseShapesVisible(true); rend.setBaseShapesFilled(true); } plot.setRenderer(renderer); return chart; }
From source file:org.mwc.cmap.xyplot.views.XYPlotView.java
@SuppressWarnings("deprecation") private void fillThePlot(final String title, final String units, final formattingOperation theFormatter, final AbstractSeriesDataset dataset) { final StepControl _theStepper = null; // the working variables we rely on later _thePlotArea = null;/*from w ww . j a v a 2 s .c o m*/ ValueAxis xAxis = null; XYToolTipGenerator tooltipGenerator = null; // the y axis is common to hi & lo res. Format it here final NumberAxis yAxis = new NumberAxis(units); final Font tickFont = new Font("SansSerif", Font.PLAIN, 14); Font labelFont = new Font("SansSerif", Font.PLAIN, 16); yAxis.setLabelFont(labelFont); yAxis.setTickLabelFont(tickFont); // hmm, see if we are in hi-res mode. If we are, don't use a formatted // y-axis, just use the plain long microseconds // value if (HiResDate.inHiResProcessingMode()) { // final SimpleDateFormat _secFormat = new SimpleDateFormat("ss"); // ok, simple enough for us... final NumberAxis nAxis = new NumberAxis("time (secs.micros)") { /** * */ private static final long serialVersionUID = 1L; // public String getTickLabel(double currentTickValue) // { // long time = (long) currentTickValue; // Date dtg = new HiResDate(0, time).getDate(); // String res = _secFormat.format(dtg) + "." // + DebriefFormatDateTime.formatMicros(new HiResDate(0, time)); // return res; // } }; nAxis.setAutoRangeIncludesZero(false); xAxis = nAxis; // just show the raw data values tooltipGenerator = new StandardXYToolTipGenerator(); } else { // create a date-formatting axis final DateAxis dAxis = new RelativeDateAxis(); dAxis.setStandardTickUnits(DateAxisEditor.createStandardDateTickUnitsAsTickUnits()); xAxis = dAxis; // also create the date-knowledgable tooltip writer tooltipGenerator = new DatedToolTipGenerator(); } xAxis.setTickLabelFont(tickFont); xAxis.setLabelFont(labelFont); // create the special stepper plot final ColourStandardXYItemRenderer theRenderer = new ColourStandardXYItemRenderer(tooltipGenerator, null, null); _thePlot = new StepperXYPlot(null, (RelativeDateAxis) xAxis, yAxis, _theStepper, theRenderer); theRenderer.setPlot(_thePlot); theRenderer.setStroke(new BasicStroke(3.0f)); _thePlot.setRangeGridlineStroke(new BasicStroke(1f)); _thePlot.setDomainGridlineStroke(new BasicStroke(1f)); _thePlot.setRangeGridlinePaint(Color.LIGHT_GRAY); xAxis.setTickMarkStroke(new BasicStroke(1f)); yAxis.setTickMarkStroke(new BasicStroke(1f)); _thePlot.setOutlineStroke(new BasicStroke(2f)); // loop through the datasets, setting the color of each series to the first // color in that series if (dataset instanceof TimeSeriesCollection) { Color seriesCol = null; final TimeSeriesCollection tsc = (TimeSeriesCollection) dataset; for (int i = 0; i < dataset.getSeriesCount(); i++) { final TimeSeries ts = tsc.getSeries(i); if (ts.getItemCount() > 0) { final TimeSeriesDataItem dataItem = ts.getDataItem(0); if (dataItem instanceof ColouredDataItem) { final ColouredDataItem cd = (ColouredDataItem) dataItem; seriesCol = cd.getColor(); _thePlot.getRenderer().setSeriesPaint(i, seriesCol); } } } } // apply any formatting for this choice if (theFormatter != null) { theFormatter.format(_thePlot); } boolean createLegend = dataset.getSeriesCount() > 1; _thePlotArea = new NewFormattedJFreeChart(title, null, _thePlot, createLegend, _theStepper); // set the color of the area surrounding the plot // - naah, don't bother. leave it in the application background color. _thePlotArea.setBackgroundPaint(Color.white); // //////////////////////////////////////////////// // put the holder into one of our special items // //////////////////////////////////////////////// _chartInPanel = new StepperChartPanel(_thePlotArea, true, _theStepper); // ok - we need to fire time-changes to the chart setupFiringChangesToChart(); // format the chart _chartInPanel.setName(title); _chartInPanel.setMouseZoomable(true, true); // and insert into the composite _plotControl.setChart(_thePlotArea); // get the cross hairs ready _thePlot.setDomainCrosshairVisible(true); _thePlot.setRangeCrosshairVisible(true); _thePlot.setDomainCrosshairPaint(Color.GRAY); _thePlot.setRangeCrosshairPaint(Color.GRAY); _thePlot.setDomainCrosshairStroke(new BasicStroke(2)); _thePlot.setRangeCrosshairStroke(new BasicStroke(2)); // and the plot object to display the cross hair value _crosshairValueText = new XYTextAnnotation(" ", 0, 0); _crosshairValueText.setTextAnchor(TextAnchor.TOP_LEFT); _crosshairValueText.setFont(new Font("SansSerif", Font.BOLD, 15)); _crosshairValueText.setPaint(Color.black); _crosshairValueText.setBackgroundPaint(Color.white); _thePlot.addAnnotation(_crosshairValueText); _thePlotArea.addChangeListener(new ChartChangeListener() { @Override public void chartChanged(ChartChangeEvent event) { if (_showSymbols.isShowSymbols() != _thePlotArea.isShowSymbols()) { _showSymbols.updateAction(); } } }); _showSymbols.updateAction(); _thePlotArea.addProgressListener(new ChartProgressListener() { public void chartProgress(final ChartProgressEvent cpe) { if (cpe.getType() != ChartProgressEvent.DRAWING_FINISHED) return; // double-check our label is still in the right place final double xVal = _thePlot.getRangeAxis().getUpperBound(); final double yVal = _thePlot.getDomainAxis().getLowerBound(); boolean annotChanged = false; if (_crosshairValueText.getX() != yVal) { _crosshairValueText.setX(yVal); annotChanged = true; } if (_crosshairValueText.getY() != xVal) { _crosshairValueText.setY(xVal); annotChanged = true; } // and write the text final String numA = MWC.Utilities.TextFormatting.GeneralFormat .formatOneDecimalPlace(_thePlot.getRangeCrosshairValue()); final Date newDate = new Date((long) _thePlot.getDomainCrosshairValue()); final SimpleDateFormat _df = new SimpleDateFormat("HHmm:ss"); _df.setTimeZone(TimeZone.getTimeZone("GMT")); final String dateVal = _df.format(newDate); final String theMessage = " [" + dateVal + "," + numA + "]"; if (!theMessage.equals(_crosshairValueText.getText())) { _crosshairValueText.setText(theMessage); annotChanged = true; } if (annotChanged) { _plotControl.getChart().setNotify(true); } } }); // //////////////////////////////////////////////////// // put the time series into the plot // //////////////////////////////////////////////////// _thePlot.setDataset((XYDataset) dataset); }
From source file:base.BasePlayer.BedTable.java
void drawScreen(Graphics g) { try {/*from w w w. j a v a 2 s. com*/ buf.setColor(Color.black); buf.fillRect(0, 0, this.getWidth(), this.getHeight()); if (width != this.getWidth()) { width = this.getWidth(); createPolygon(); resizeTable(); } genemutcount = 0; if (!bedtrack.intersect) { buf.setColor(Color.white); buf.drawString("Press play on bed track to annotate variants", 5, 40); } else if (getTableSize() > 0) { hoverVar = null; hoverSample = -1; headerHover = -1; geneHeaderHover = -1; if (!mouseDrag) { resizeColumn = -1; } if (aminoarray == null) { aminoarray = new ArrayList<AminoEntry>(); } firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - samplecount - listAdd - aminoarray.size(); if (firstrow < 0) { firstrow = 0; } for (int i = firstrow; i < bedarray.size(); i++) { dot = false; if ((i + 1 + samplecount + listAdd + aminoarray.size()) * rowHeight < tablescroll .getVerticalScrollBar().getValue()) { continue; } if (i * rowHeight > tablescroll.getVerticalScrollBar().getValue() + tablescroll.getViewport().getHeight()) { break; } if (mouseY >= (rowHeight * (i + genemutcount + 1)) && mouseY < (rowHeight * (i + genemutcount + 2))) { hoverNode = bedarray.get(i); } try { buf.setColor(Color.darkGray); buf.drawLine(4, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } if (bedarray.get(i).getTrack().hasvalues) { buf.drawString( (i + 1) + ". " + MethodLibrary.shortString(bedarray.get(i).name, 10) + "=" + MethodLibrary.round(bedarray.get(i).value, 3), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString((i + 1) + ". " + MethodLibrary.shortString(bedarray.get(i).name, 10), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect( headerlengths[1][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, headerlengths[1][1], rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } mutcountbuffer = new StringBuffer("" + bedarray.get(i).mutations + " "); buf.drawString(mutcountbuffer.toString(), headerlengths[1][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); // lastpos = Integer.toString(bedarray.get(i).mutations).length() +2; //TODO textWidth = (int)fm.getStringBounds("", buf).getWidth(); // textWidth = (int)fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); // buf.drawString(" ", headerlengths[1][0]+5+textWidth, (rowHeight*(i+1+genemutcount))-tablescroll.getVerticalScrollBar().getValue()+rowHeight); // buf.setColor(Color.gray); // textWidth = (int)fm.getStringBounds(mutcountbuffer.toString() , buf).getWidth(); // buf.drawString(" " +bedarray.get(i).varnodes.size() +" samples", headerlengths[1][0]+5+textWidth, (rowHeight*(i+1+genemutcount))-tablescroll.getVerticalScrollBar().getValue()+rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[2][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } buf.drawString( bedarray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(bedarray.get(i).getPosition() + 1) + "-" + MethodLibrary.formatNumber( bedarray.get(i).getPosition() + 1 + bedarray.get(i).getLength()), headerlengths[2][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[3][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } buf.drawString(MethodLibrary.formatNumber(bedarray.get(i).getLength()), headerlengths[3][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[4][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } buf.drawString("" + MethodLibrary .round((bedarray.get(i).mutations / (double) bedarray.get(i).getLength()) * 100, 4), headerlengths[4][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[5][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } firstvisible = 0; if (bedarray.get(i).varnodes != null) { for (int f = 0; f < bedarray.get(i).varnodes.size(); f++) { if (!Main.drawCanvas.hideNode(bedarray.get(i).varnodes.get(f))) { firstvisible = f; break; } } if (bedarray.get(i).varnodes.get(firstvisible).getExons() != null) { if (bedarray.get(i).varnodes.get(firstvisible).coding) { buf.setColor(Color.red); buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getExons().get(0) .getTranscript().getGenename() + " (Coding)", headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.lightGray); buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getExons().get(0) .getTranscript().getGenename() + " (UTR)", headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else if (bedarray.get(i).varnodes.get(firstvisible).isInGene()) { buf.setColor(Color.lightGray); buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getGenename() + " (Intronic)", headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.gray); if (!bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0).equals( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(1))) { buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getGenename() + " ... " + bedarray.get(i).varnodes.get(firstvisible).getTranscripts() .get(1).getGenename(), headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { if (bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getEnd() > bedarray.get(i).varnodes.get(firstvisible).getPosition()) { buf.drawString( " ... " + bedarray.get(i).varnodes.get(firstvisible) .getTranscripts().get(0).getGenename(), headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getGenename() + " ... ", headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } } buf.setColor(Color.darkGray); buf.drawLine(3, rowHeight + 3, 3, (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); for (int r = 0; r < headerlengths.length; r++) { buf.drawLine(headerlengths[r][0], (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, headerlengths[r][0], (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedNode != null && selectedNode.equals(bedarray.get(i))) { hoverSample = -1; genemutcount = aminoarray.size() + 1; listAdd = 1; buf.drawLine(20, (rowHeight * (i + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); drawGeneheader((rowHeight * (i + listAdd + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); for (int s = 0; s < aminoarray.size(); s++) { buf.setColor(Color.darkGray); buf.drawLine(21, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); if (mouseY >= (rowHeight * (i + s + listAdd + 2)) && mouseY < (rowHeight * (i + s + listAdd + 3))) { hoverNode = null; hoverVar = aminoarray.get(s).getNode(); hoverString = aminoarray.get(s).getRow(); buf.setColor(Color.white); for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getSample().getIndex(); break; } } } else { if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("nonsense")) { buf.setColor(Color.red); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("missense")) { buf.setColor(Color.yellow); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("synonymous")) { buf.setColor(Color.green); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("UTR")) { buf.setColor(Color.lightGray); } else { buf.setColor(Color.gray); } } if (!aminoarray.get(s).getRow()[1].equals("1")) { buf.drawString("Multiple", 24, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { buf.drawString( aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getSample().getName(), 24, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); break; } } } if (hoverVar != null && hoverString.equals(aminoarray.get(s).getRow())) { //TODO textcolor = Color.white; } else { if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("nonsense")) { textcolor = Color.red; } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("missense")) { textcolor = Color.yellow; } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("synonymous")) { textcolor = Color.green; } else if (aminoarray.get(s).getRow()[3].contains("UTR")) { textcolor = Color.lightGray; } else { textcolor = Color.gray; } } for (int h = 1; h < 4; h++) { buf.setColor(Color.black); buf.fillRect((int) geneheader.get(h)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(h)[2], rowHeight - 1); buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } if (aminoarray.get(s).getRow()[1].equals("1")) { buf.setColor(Color.black); buf.fillRect((int) geneheader.get(4)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .isHomozygous()) { buf.drawString( "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(0).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(0).getCoverage() + ")", (int) geneheader.get(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 2; casefreq = 2 / (double) (Main.varsamples * 2); } } else { buf.drawString( "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(0).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(0).getCoverage() + ")", (int) geneheader.get(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 1; casefreq = 1 / (double) (Main.varsamples * 2); } } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 1, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + aminoarray.get(s).getNode().vars .get(v).getValue().get(0).getQuality(), (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } if (Control.controlData.controlsOn) { cases = 0; for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .isHomozygous()) { cases += Integer.parseInt(aminoarray.get(s).getRow()[1]) * 2; } else { cases += Integer.parseInt(aminoarray.get(s).getRow()[1]); } } } casefreq = cases / (double) (Main.varsamples * 2); } buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { buf.setColor(textcolor); for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { vararray = aminoarray.get(s).getNode().vars.get(v).getValue(); controlarray = new SampleNode[Control.controlData.fileArray.size()]; if (vararray.get(vararray.size() - 1).alleles != null) { for (int e = vararray.size() - 1; e > 0; e--) { if (vararray.get(e).alleles == null) { break; } controlarray[vararray.get(e).getControlSample() .getIndex()] = vararray.get(e); } } for (int e = 0; e < controlarray.length; e++) { if (Control.controlData.fileArray.get(e).controlOn) { if (controlarray[e] == null) { buf.setColor(Color.black); buf.fillRect( (int) geneheader .get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString("0", (int) geneheader .get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader .get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString("-", (int) geneheader .get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.black); buf.fillRect( (int) geneheader .get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + MethodLibrary.round(controlarray[e].alleles / (double) controlarray[e].allelenumber, 2), (int) geneheader .get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader .get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString("" + MethodLibrary .round(casefreq / (controlarray[e].alleles / (double) controlarray[e].allelenumber), 2) + " (p=" + MethodLibrary.round( VariantHandler.table.fe.getRightTailedP( cases, Main.varsamples * 2 - cases, controlarray[e].alleles, controlarray[e].allelenumber - controlarray[e].alleles), 2) + ")", (int) geneheader .get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll .getVerticalScrollBar().getValue() + rowHeight); } } else { buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(Color.darkGray); buf.drawString("Apply controls", (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader .get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(Color.darkGray); buf.drawString("-", (int) geneheader .get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } } } else { buf.setColor(Color.darkGray); for (int e = geneheaderlength; e < geneheader.size(); e++) { if (geneheader.get(e)[0] instanceof ControlFile) { buf.drawString("Apply controls", (int) geneheader.get(e)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } buf.setColor(Color.lightGray); } vararray = null; if (Main.bedCanvas.bedOn) { for (int a = 0; a < aminoarray.size(); a++) { StringBuffer[] bedarraytemp = MethodLibrary.makeTrackArray( aminoarray.get(a).getNode(), aminoarray.get(a).getRow()[5]); if (bedarraytemp != null) { int h = 0; for (int b = 0; b < bedarraytemp.length; b++) { if (b == bedtrack.trackIndex) { continue; } buf.setColor(Color.black); if (b == bedarraytemp.length - 1) { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth() - (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1], rowHeight - 1); } else { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[2], rowHeight - 1); } buf.setColor(Color.white); if (bedarraytemp[b] != null) { buf.drawString(bedarraytemp[b].toString(), (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1] + 14, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } h++; // buf.drawLine((int)geneheader.get(geneheaderlength+Control.controlData.fileArray.size()*2+h)[1], (rowHeight*(i+a+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+4, (int)geneheader.get(geneheaderlength+Control.controlData.fileArray.size()*2+h)[1], (rowHeight*(i+a+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+10); } } } } buf.setColor(Color.darkGray); for (int j = 0; j < geneheader.size(); j++) { buf.drawLine((int) geneheader.get(j)[1] + 11, (rowHeight * (i + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedVar != null && selectedString.equals(aminoarray.get(s).getRow()) && Integer.parseInt(selectedString[1]) > 1) { //hoverSample = -1; pointer = 0; //TODO for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(selectedString[5])) { for (int l = 0; l < aminoarray.get(s).getNode().vars.get(v).getValue() .size(); l++) { if (aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).alleles != null) { break; } if (mouseY > (rowHeight * (i + s + pointer + 4)) && mouseY < (rowHeight * (i + s + pointer + 5))) { textcolor = Color.white; hoverVar = aminoarray.get(s).getNode(); hoverString = aminoarray.get(s).getRow(); hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getSample().getIndex(); } else { textcolor = Color.lightGray; } // if(aminoarray.get(s).getNode().getSamples().get(l).getVariation().equals(selectedString[5])) { buf.setColor(textcolor); buf.drawString( aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .getSample().getName(), 30, (rowHeight * (i + s + pointer + 4)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); pointer++; // } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(4)[1] + 10, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .isHomozygous()) { buf.drawString( "Hom (" + aminoarray.get(s).getNode().vars.get(v) .getValue().get(l).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v) .getValue().get(l).getCoverage() + ")", (int) geneheader.get(4)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( "Het (" + aminoarray.get(s).getNode().vars.get(v) .getValue().get(l).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v) .getValue().get(l).getCoverage() + ")", (int) geneheader.get(4)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 10, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getQuality(), (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.darkGray); for (int j = 4; j < 7; j++) { buf.drawLine((int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue(), (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight + 2); } } } } listAdd = Integer.parseInt(selectedString[1]) + 1; genemutcount = aminoarray.size() + listAdd; buf.setColor(Color.darkGray); buf.drawLine(21, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); } } } } catch (Exception e) { ErrorLog.addError(e.getStackTrace()); e.printStackTrace(); } } buf.setColor(Color.darkGray); buf.drawLine(4, (rowHeight * (bedarray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (bedarray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); } drawHeader(); if (headerHover == -1 && geneHeaderHover == -1) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (resizeColumn == -1) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); } } g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null); } catch (Exception e) { e.printStackTrace(); } }
From source file:lucee.runtime.tag.Chart.java
private void chartPie() throws PageException, IOException { // do dataset DefaultPieDataset dataset = new DefaultPieDataset(); ChartSeriesBean csb = _series.get(0); ChartDataBean cdb;/*from w w w . j a v a2s . c om*/ List datas = csb.getDatas(); if (sortxaxis) Collections.sort(datas); Iterator itt = datas.iterator(); while (itt.hasNext()) { cdb = (ChartDataBean) itt.next(); dataset.setValue(cdb.getItemAsString(), cdb.getValue()); } JFreeChart chart = show3d ? ChartFactory.createPieChart3D(title, dataset, false, true, true) : ChartFactory.createPieChart(title, dataset, false, true, true); Plot p = chart.getPlot(); PiePlot pp = (PiePlot) p; Font _font = getFont(); pp.setLegendLabelGenerator(new PieSectionLegendLabelGeneratorImpl(_font, chartwidth)); pp.setBaseSectionOutlinePaint(Color.GRAY); // border pp.setLegendItemShape(new Rectangle(7, 7)); pp.setLabelFont(new Font(font, 0, 11)); pp.setLabelLinkPaint(COLOR_333333); pp.setLabelLinkMargin(-0.05); pp.setInteriorGap(0.123); pp.setLabelGenerator(new PieSectionLabelGeneratorImpl(labelFormat)); databackgroundcolor = backgroundcolor; setBackground(chart, p); setBorder(chart, p); setLegend(chart, p, _font); set3d(p); setFont(chart, _font); setTooltip(chart); setScale(chart); // Slice Type and colors boolean doSclice = pieslicestyle == PIE_SLICE_STYLE_SLICED; Color[] colors = csb.getColorlist(); Iterator it = csb.getDatas().iterator(); int count = 0; while (it.hasNext()) { cdb = (ChartDataBean) it.next(); if (doSclice) pp.setExplodePercent(cdb.getItemAsString(), 0.13); if (count < colors.length) { pp.setSectionPaint(cdb.getItemAsString(), colors[count]); } count++; } writeOut(chart); }
From source file:gov.nih.nci.ispy.ui.graphing.chart.plot.ISPYCorrelationScatterPlot.java
private Color getColorForDataPoint(ISPYPlotPoint plotPoint) { Color defaultColor = Color.GRAY; Color retColor = null;/* ww w .j ava 2s . c om*/ ClinicalResponseType clinResp = null; ClinicalStageType clinStage = null; TimepointType timepoint = null; PatientData pd = plotPoint.getPatientData(); if (pd == null) { return defaultColor; } if (colorBy == ColorByType.CLINICALRESPONSE) { clinResp = plotPoint.getClinicalResponse(); if (clinResp != null) { retColor = clinResp.getColor(); } } else if (colorBy == ColorByType.DISEASESTAGE) { clinStage = plotPoint.getClinicalStage(); if (clinStage != null) { retColor = clinStage.getColor(); } } else if (colorBy == ColorByType.TIMEPOINT) { timepoint = plotPoint.getTimepoint(); if (timepoint != null) { retColor = timepoint.getColor(); } } else if ((colorBy == ColorByType.IHC_EXPRESSION_X) || (colorBy == ColorByType.IHC_EXPRESSION_Y)) { SampleInfo info = plotPoint.getSampleInfo(); // //get the IHC expression for the point // // String labtrakId = info.getLabtrackId(); // // logger.info("geting ihc info for labtrakId=" + labtrakId); String patientDID = info.getISPYId(); String tp = info.getTimepoint().name(); List<IHCFinding> ihcfList = ihcData.get(patientDID); IHCFinding theFinding = null; if (ihcfList != null) { //the list could be null if there are no ihc findings for the patientDID for (IHCFinding ihcf : ihcfList) { if (ihcf.getSpecimen().getTimePoint().equalsIgnoreCase(tp)) { theFinding = ihcf; break; } } if (theFinding != null) { //figure out the color to use if (theFinding instanceof LossOfExpressionIHCFinding) { LossOfExpressionIHCFinding lossf = (LossOfExpressionIHCFinding) theFinding; String result = lossf.getLossResult(); if (result != null) { result = result.replace(' ', '_'); retColor = getColorForIHCResult(result, ihcBiomarkerType); } } else if (theFinding instanceof LevelOfExpressionIHCFinding) { LevelOfExpressionIHCFinding levf = (LevelOfExpressionIHCFinding) theFinding; String result = levf.getOverallExpression(); if (result != null) { result = result.replace(' ', '_'); retColor = getColorForIHCResult(result, ihcBiomarkerType); } } } } else { logger.info("PatientDID: " + patientDID + " has no ihc findings. Using default color."); } } if (retColor == null) { retColor = defaultColor; } return retColor; }
From source file:org.adempiere.apps.graph.ChartBuilder.java
private void setupCategoryChart(JFreeChart chart) { CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesPaint(2, Color.YELLOW); renderer.setSeriesPaint(3, Color.GREEN); renderer.setSeriesPaint(4, Color.ORANGE); renderer.setSeriesPaint(5, Color.CYAN); renderer.setSeriesPaint(6, Color.MAGENTA); renderer.setSeriesPaint(7, Color.GRAY); renderer.setSeriesPaint(8, Color.PINK); plot.setRenderer(renderer);//from w w w .j a va 2 s.co m }
From source file:cool.pandora.modeller.ui.jpanel.base.BagView.java
/** * createBagTagButtonPanel.//from www.j a va2 s . c o m * * @return buttonPanel */ private JPanel createBagTagButtonPanel() { final JPanel buttonPanel = new JPanel(); final ShowTagFilesHandler showTageFileHandler = new ShowTagFilesHandler(this); addTagFileHandler = new AddTagFileHandler(this); removeTagFileHandler = new RemoveTagFileHandler(this); buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 2, 2)); viewTagFilesToolbarAction = new JLabel(""); viewTagFilesToolbarAction.setEnabled(false); viewTagFilesToolbarAction.setHorizontalAlignment(SwingConstants.CENTER); viewTagFilesToolbarAction.setBorder(new LineBorder(viewTagFilesToolbarAction.getBackground(), 1)); viewTagFilesToolbarAction.setIcon(getPropertyImage("Bag_ViewTagFile.icon")); viewTagFilesToolbarAction.setToolTipText(getMessage("bagView.TagFilesTree.viewfile" + ".tooltip")); viewTagFilesToolbarAction.addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { if (viewTagFilesToolbarAction.isEnabled()) { showTageFileHandler.actionPerformed(null); } } @Override public void mouseExited(final MouseEvent e) { viewTagFilesToolbarAction.setBorder(new LineBorder(viewTagFilesToolbarAction.getBackground(), 1)); } @Override public void mouseEntered(final MouseEvent e) { if (viewTagFilesToolbarAction.isEnabled()) { viewTagFilesToolbarAction.setBorder(new LineBorder(Color.GRAY, 1)); } } }); buttonPanel.add(viewTagFilesToolbarAction); addTagFileToolBarAction = new JLabel(""); addTagFileToolBarAction.setEnabled(false); addTagFileToolBarAction.setHorizontalAlignment(SwingConstants.CENTER); addTagFileToolBarAction.setBorder(new LineBorder(addTagFileToolBarAction.getBackground(), 1)); addTagFileToolBarAction.setIcon(getPropertyImage("Bag_Content.add.icon")); addTagFileToolBarAction.setToolTipText(getMessage("bagView.TagFilesTree.addbutton" + ".tooltip")); addTagFileToolBarAction.addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { if (addTagFileToolBarAction.isEnabled()) { addTagFileHandler.actionPerformed(null); } } @Override public void mouseExited(final MouseEvent e) { addTagFileToolBarAction.setBorder(new LineBorder(addTagFileToolBarAction.getBackground(), 1)); } @Override public void mouseEntered(final MouseEvent e) { if (addTagFileToolBarAction.isEnabled()) { addTagFileToolBarAction.setBorder(new LineBorder(Color.GRAY, 1)); } } }); buttonPanel.add(addTagFileToolBarAction); removeTagFileToolbarAction = new JLabel(""); removeTagFileToolbarAction.setEnabled(false); removeTagFileToolbarAction.setHorizontalAlignment(SwingConstants.CENTER); removeTagFileToolbarAction.setBorder(new LineBorder(removeTagFileToolbarAction.getBackground(), 1)); removeTagFileToolbarAction.setIcon(getPropertyImage("Bag_Content.minus.icon")); removeTagFileToolbarAction.setToolTipText(getMessage("bagView.TagFilesTree.remove" + ".tooltip")); buttonPanel.add(removeTagFileToolbarAction); removeTagFileToolbarAction.addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { if (removeTagFileToolbarAction.isEnabled()) { removeTagFileHandler.actionPerformed(null); } } @Override public void mouseExited(final MouseEvent e) { removeTagFileToolbarAction.setBorder(new LineBorder(removeTagFileToolbarAction.getBackground(), 1)); } @Override public void mouseEntered(final MouseEvent e) { if (removeTagFileToolbarAction.isEnabled()) { removeTagFileToolbarAction.setBorder(new LineBorder(Color.GRAY, 1)); } } }); final JLabel spacerLabel = new JLabel(" "); buttonPanel.add(spacerLabel); addTagFileHandler = new AddTagFileHandler(this); removeTagFileHandler = new RemoveTagFileHandler(this); return buttonPanel; }
From source file:com.openbravo.pos.util.JRViewer411.java
/** This method is called from within the constructor to * initialize the form./*from w ww .j a v a2s. c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); jToolBar = new javax.swing.JToolBar(); btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); jSeparator2 = new javax.swing.JToolBar.Separator(); btnZoomIn = new javax.swing.JButton(); cmbZoom = new javax.swing.JComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < zooms.length; i++) { model.addElement("" + zooms[i] + "%"); } cmbZoom.setModel(model); btnZoomOut = new javax.swing.JButton(); jSeparator3 = new javax.swing.JToolBar.Separator(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); jSeparator4 = new javax.swing.JToolBar.Separator(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); jToolBar.setFloatable(false); jToolBar.setOpaque(false); btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/filesave.png"))); // NOI18N btnSave.setToolTipText(getBundleString("save")); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); jToolBar.add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/yast_printer.png"))); // NOI18N btnPrint.setToolTipText(getBundleString("print")); btnPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); jToolBar.add(btnPrint); btnReload.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/reload.png"))); // NOI18N btnReload.setToolTipText(getBundleString("reload")); btnReload.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } }); jToolBar.add(btnReload); jToolBar.add(jSeparator1); btnActualSize.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime.png"))); // NOI18N btnActualSize.setToolTipText(getBundleString("actual.size")); btnActualSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); jToolBar.add(btnActualSize); btnFitPage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime2.png"))); // NOI18N btnFitPage.setToolTipText(getBundleString("fit.page")); btnFitPage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); jToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime3.png"))); // NOI18N btnFitWidth.setToolTipText(getBundleString("fit.width")); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); jToolBar.add(btnFitWidth); jToolBar.add(jSeparator2); btnZoomIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag+.png"))); // NOI18N btnZoomIn.setToolTipText(getBundleString("zoom.in")); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); jToolBar.add(btnZoomIn); cmbZoom.setEditable(true); cmbZoom.setToolTipText(getBundleString("zoom.ratio")); cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23)); cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23)); cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23)); cmbZoom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); cmbZoom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); jToolBar.add(cmbZoom); btnZoomOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag-.png"))); // NOI18N btnZoomOut.setToolTipText(getBundleString("zoom.out")); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); jToolBar.add(btnZoomOut); jToolBar.add(jSeparator3); btnFirst.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/2leftarrow.png"))); // NOI18N btnFirst.setToolTipText(getBundleString("first.page")); btnFirst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); jToolBar.add(btnFirst); btnPrevious .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1leftarrow.png"))); // NOI18N btnPrevious.setToolTipText(getBundleString("previous.page")); btnPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); jToolBar.add(btnPrevious); txtGoTo.setToolTipText(getBundleString("go.to.page")); txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23)); txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23)); txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23)); txtGoTo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); jToolBar.add(txtGoTo); btnNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1rightarrow.png"))); // NOI18N btnNext.setToolTipText(getBundleString("next.page")); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); jToolBar.add(btnNext); btnLast.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/2rightarrow.png"))); // NOI18N btnLast.setToolTipText(getBundleString("last.page")); btnLast.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); jToolBar.add(btnLast); jToolBar.add(jSeparator4); lblStatus.setText("Page i of n"); jToolBar.add(lblStatus); pnlMain.add(jToolBar, java.awt.BorderLayout.NORTH); add(pnlMain, java.awt.BorderLayout.CENTER); }
From source file:edu.ucla.stat.SOCR.applications.demo.StockApplication.java
void updateGraph() { //System.out.println("UpdateGraph get called") // System.out.println("S0="+S0+" E="+E+" P="+P); calculate(choice);// www . j av a2 s . c om XYSeriesCollection ds = createDataset(choice); JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title xAxis, // x axis label yAxis, // y axis label ds, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); XYPlot subplot1 = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) subplot1.getRenderer(); renderer1.setSeriesPaint(0, Color.red); renderer1.setSeriesPaint(1, Color.blue); renderer1.setSeriesPaint(2, Color.green); renderer1.setSeriesPaint(3, Color.gray); /* Shape shape = renderer1.getBaseShape(); renderer1.setSeriesShape(2, shape); renderer1.setSeriesShape(3, shape);*/ renderer1.setBaseLinesVisible(true); renderer1.setBaseShapesVisible(true); renderer1.setBaseShapesFilled(true); chartPanel = new ChartPanel(chart, false); chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y)); upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel), new JScrollPane(chartPanel)); this.getMainPanel().removeAll(); this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER); this.getMainPanel().validate(); // getRecordTable().setText("Any Explaination goes here."); // }