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:nl.detoren.ijsco.ui.Mainscreen.java
public JPanel createDeelnemersPanel() { JPanel panel = new JPanel(false); panel.setBackground(Color.BLACK); //panel.setLayout(new GridLayout(1, 0)); panel.setLayout(new BorderLayout()); JPanel innerPanel = new JPanel(); JLabel lbAanwezig = new JLabel("Deelnemers: "); innerPanel.add(lbAanwezig, BorderLayout.NORTH); tfAanwezig = new JLabel(Integer.toString(status.deelnemers.aantalAanwezig()), 10); innerPanel.add(tfAanwezig, BorderLayout.NORTH); //innerPanel.setLayout(new GridLayout(1, 0)); innerPanel.add(new JLabel("Naam:"), BorderLayout.NORTH); JTextField deelnemer = new JTextField(15); ArrayList<String> words = new ArrayList<>(); if (status.OSBOSpelers != null) { for (Speler s : status.OSBOSpelers.values()) { words.add(s.getNaam().trim()); words.add(Integer.toString(s.getKnsbnummer())); }// ww w .j a va2 s.c o m } @SuppressWarnings("unused") Suggesties suggesties = new Suggesties(deelnemer, this, words, 2); innerPanel.add(deelnemer, BorderLayout.NORTH); deelnemer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { actieVoegSpelerToe(deelnemer.getText().trim()); deelnemer.setText(""); } }); JButton btVoegToe = new JButton("Voeg toe"); btVoegToe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { actieVoegSpelerToe(deelnemer.getText().trim()); deelnemer.setText(""); } }); innerPanel.add(btVoegToe); panel.add(innerPanel); // panel_deelnemers.add(new JLabel("Deelnemers IJSCO toernooi")); deelnemersModel = new DeelnemersModel(panel, status.deelnemers); JTable deelnemersTabel = new JTable(deelnemersModel) { private static final long serialVersionUID = -8293073016982337108L; @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); DeelnemersModel model = (DeelnemersModel) getModel(); // Tooltip if (c instanceof JComponent) { ((JComponent) c) .setToolTipText(model.getToolTip(convertRowIndexToModel(row), column).toString()); } // Alternate row color if (!isRowSelected(row)) { c.setBackground(row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY); } // Highlight overruled entries if (status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam() || status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam()) { c.setForeground(Color.BLUE); } else { c.setForeground(Color.BLACK); } return c; } }; deelnemersTabel.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { status.groepen = null; status.schemas = null; status.schema = null; groepenText.setText(""); schemaModel.setSchemas(null); schemaModel.fireTableDataChanged(); if (status.deelnemers != null && tfAanwezig != null) { tfAanwezig.setText(Integer.toString(status.deelnemers.aantalAanwezig())); } panel.repaint(); } }); deelnemersTabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { logger.log(Level.INFO, "MouseEvent on table fired, type : " + e.toString()); logger.log(Level.INFO, "Popup trigger? : " + e.isPopupTrigger()); if (e.isPopupTrigger()) { int row = deelnemersTabel.rowAtPoint(e.getPoint()); JPopupMenu popup = new JPopupMenu(); JMenuItem menuItem = new JMenuItem("Bewerk speler"); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logger.log(Level.INFO, "Bewerk Speler : " + deelnemersTabel.convertRowIndexToModel(row)); Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row)); BewerkSpelerDialoog rd = new BewerkSpelerDialoog(new JFrame(), "Bewerk Speler", s, deelnemersModel); rd.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { System.out.println("closing..."); } }); rd.setVisible(true); } }); popup.add(menuItem); menuItem = new JMenuItem("Verwijder Speler"); popup.add(menuItem); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logger.log(Level.INFO, "Verwijder Speler : " + deelnemersTabel.convertRowIndexToModel(row)); Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row)); status.deelnemers.remove(s); deelnemersModel.fireTableDataChanged(); } }); popup.show(e.getComponent(), e.getX(), e.getY()); } } }); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(deelnemersTabel); innerPanel.add(scrollPane, BorderLayout.CENTER); TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(deelnemersModel); deelnemersTabel.setRowSorter(sorter); innerPanel.add(new JLabel("Filter op : ")); JTextField tfFilter = new JTextField(10); tfFilter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String text = tfFilter.getText(); logger.log(Level.INFO, "Filter tabel op : " + text); if (text.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } }); innerPanel.add(tfFilter); JButton btPasToe = new JButton("Apply"); btPasToe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String text = tfFilter.getText(); logger.log(Level.INFO, "Filter tabel op : " + text); if (text.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } }); innerPanel.add(btPasToe); JButton btWis = new JButton("Wis"); btWis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { tfFilter.setText(""); logger.log(Level.INFO, "Wis filter"); sorter.setRowFilter(null); } }); innerPanel.add(btWis); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(0), 30); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(1), 55); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(2), 170); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(3), 40); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(4), 40); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(5), 30); Utils.fixedComponentSize(scrollPane, 400, 580); return panel; }
From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java
private JFreeChart updateBubbleChartChartWithCustUserData( Set<QuantDiseaseGroupsComparison> selectedComparisonList) { tooltipsProtNumberMap.clear();/* w w w . j a v a2 s . c o m*/ DefaultXYZDataset defaultxyzdataset = new DefaultXYZDataset(); int counter = 0; int upper = -1; boolean significantOnly = this.Quant_Central_Manager.isSignificantOnly(); if (userCustomizedComparison.getComparProtsMap().size() > upper) { upper = userCustomizedComparison.getComparProtsMap().size(); } for (QuantDiseaseGroupsComparison qc : selectedComparisonList) { if (significantOnly) { int upperCounter = 0; for (DiseaseGroupsComparisonsProteinLayout qp : qc.getComparProtsMap().values()) { if (qp == null) { continue; } if (qp.getSignificantTrindCategory() == 2) { continue; } upperCounter++; } if (upperCounter > upper) { upper = upperCounter; } } else { if (qc.getComparProtsMap() == null) { System.out.println("null qc " + qc.getComparisonHeader()); } if (qc.getComparProtsMap().size() > upper) { upper = qc.getComparProtsMap().size(); } } } final Map<Integer, Color[]> seriousColorMap = new HashMap<Integer, Color[]>(); Color[] dataColor = new Color[] { Color.WHITE, new Color(0, 153, 0), new Color(0, 229, 132), stableColor, new Color(247, 119, 119), new Color(204, 0, 0), Color.WHITE }; double[] tempWidthValue = new double[8]; double[] yAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 }; double[] xAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 }; double[] widthValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 }; double[][] seriesValuesI = { yAxisValueI, xAxisValueI, widthValueI }; seriousColorMap.put(0, new Color[] { Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE }); defaultxyzdataset.addSeries(" ", seriesValuesI); for (String key : userCustomizedComparison.getComparProtsMap().keySet()) { userCustomizedComparison.getComparProtsMap().get(key).updateLabelLayout(); { tempWidthValue[userCustomizedComparison.getComparProtsMap().get(key).getSignificantTrindCategory() + 1] = tempWidthValue[userCustomizedComparison.getComparProtsMap().get(key) .getSignificantTrindCategory() + 1] + 1; } } int length = 0; if (upper < 10) { upper = 10; } double[] tooltipNumbess = new double[tempWidthValue.length]; System.arraycopy(tempWidthValue, 0, tooltipNumbess, 0, tempWidthValue.length); this.tooltipsProtNumberMap.put(userCustomizedComparison.getComparisonHeader(), tooltipNumbess); for (int z = 0; z < tempWidthValue.length; z++) { if (tempWidthValue[z] > 0) { tempWidthValue[z] = scaleValues(tempWidthValue[z], upper, 2.5, 0.05);//Math.max(tempWidthValue[z] * 1.5 / upper, 0.05); length++; } } double[] yAxisValue = new double[length]; double[] xAxisValue = new double[length]; double[] widthValue = new double[length]; Color[] serColorArr = new Color[length]; length = 0; for (int z = 0; z < tempWidthValue.length; z++) { if (tempWidthValue[z] > 0) { xAxisValue[length] = z; yAxisValue[length] = counter + 1; widthValue[length] = tempWidthValue[z]; serColorArr[length] = dataColor[z]; length++; } } if (length == 1 && selectedComparisonList.size() == 1) { widthValue[0] = 1; } seriousColorMap.put(++counter, serColorArr); double[][] seriesValues = { yAxisValue, xAxisValue, widthValue }; defaultxyzdataset.addSeries(userCustomizedComparison.getComparisonHeader(), seriesValues); for (QuantDiseaseGroupsComparison qc : selectedComparisonList) { tempWidthValue = new double[8]; if (qc.getComparProtsMap() == null) { continue; } for (String key : qc.getComparProtsMap().keySet()) { qc.getComparProtsMap().get(key).updateLabelLayout(); if (significantOnly && (qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 2 || qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 5)) { tempWidthValue[3] = 0; tempWidthValue[6] = 0; } else { tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory() + 1] = tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory() + 1] + 1; } } if (tempWidthValue[3] > 0 && tempWidthValue[6] >= 0) { stableColor = new Color(1, 141, 244); } else { stableColor = Color.decode("#b5babb"); } tempWidthValue[3] = tempWidthValue[3] + tempWidthValue[6]; tempWidthValue[6] = 0; dataColor[3] = stableColor; length = 0; if (upper < 10) { upper = 10; } tooltipNumbess = new double[tempWidthValue.length]; System.arraycopy(tempWidthValue, 0, tooltipNumbess, 0, tempWidthValue.length); this.tooltipsProtNumberMap.put(qc.getComparisonHeader(), tooltipNumbess); for (int x = 0; x < tempWidthValue.length; x++) { if (tempWidthValue[x] > 0) { tempWidthValue[x] = scaleValues(tempWidthValue[x], upper, 2.5, 0.05);//Math.max(tempWidthValue[z] * 1.5 / upper, 0.05); length++; } } yAxisValue = new double[length]; xAxisValue = new double[length]; widthValue = new double[length]; serColorArr = new Color[length]; length = 0; for (int x = 0; x < tempWidthValue.length; x++) { if (tempWidthValue[x] > 0) { xAxisValue[length] = x; yAxisValue[length] = counter + 1; widthValue[length] = tempWidthValue[x]; serColorArr[length] = dataColor[x]; length++; } } if (length == 1 && selectedComparisonList.size() == 1) { widthValue[0] = 1; } seriousColorMap.put(counter + 1, serColorArr); seriesValues = new double[][] { yAxisValue, xAxisValue, widthValue }; defaultxyzdataset.addSeries(qc.getComparisonHeader(), seriesValues); counter++; } double[] yAxisValueII = new double[0]; double[] xAxisValueII = new double[0]; double[] widthValueII = new double[0]; seriousColorMap.put(counter + 1, new Color[] {}); double[][] seriesValuesII = { yAxisValueII, xAxisValueII, widthValueII }; defaultxyzdataset.addSeries(" ", seriesValuesII); final Color[] labelsColor = new Color[] { Color.WHITE, new Color(80, 183, 71), Color.LIGHT_GRAY, new Color(1, 141, 244), Color.LIGHT_GRAY, new Color(204, 0, 0), Color.WHITE }; Font font = new Font("Verdana", Font.BOLD, 13); SymbolAxis yAxis = new SymbolAxis(null, new String[] { " ", "Decreased", " ", "Equal", " ", "Increased", " " }) { int x = 0; @Override public Paint getTickLabelPaint() { if (x >= labelsColor.length) { x = 0; } return labelsColor[x++]; } }; yAxis.setAutoRangeStickyZero(true); yAxis.setFixedAutoRange(8); yAxis.setTickLabelFont(font); yAxis.setGridBandsVisible(false); yAxis.setAxisLinePaint(Color.LIGHT_GRAY); yAxis.setTickMarksVisible(false); yAxis.setUpperBound(6); String[] xAxisLabels = new String[selectedComparisonList.size() + 3]; xAxisLabels[0] = " "; final Color[] diseaseGroupslabelsColor = new Color[selectedComparisonList.size() + 3]; int x = 0; int maxLength = -1; //init labels color String updatedHeader = userCustomizedComparison.getComparisonHeader().split(" / ")[0].split("\n")[0] + " / " + userCustomizedComparison.getComparisonHeader().split(" / ")[1].split("\n")[0] + ""; diseaseGroupslabelsColor[0] = Color.WHITE; diseaseGroupslabelsColor[x + 1] = diseaseColorMap.get("UserData"); xAxisLabels[x + 1] = updatedHeader + " (" + userCustomizedComparison.getDatasetIndexes().length + ") "; if (xAxisLabels[x + 1].length() > maxLength) { maxLength = xAxisLabels[++x].length(); } for (QuantDiseaseGroupsComparison comp : selectedComparisonList) { String header = comp.getComparisonHeader(); updatedHeader = header.split(" / ")[0].split("\n")[0] + " / " + header.split(" / ")[1].split("\n")[0] + ""; xAxisLabels[x + 1] = updatedHeader + " (" + comp.getDatasetIndexes().length + ") "; if (xAxisLabels[x + 1].length() > maxLength) { maxLength = xAxisLabels[x + 1].length(); } diseaseGroupslabelsColor[x + 1] = diseaseColorMap.get(header.split(" / ")[0].split("\n")[1]); x++; } xAxisLabels[x + 1] = " "; SymbolAxis xAxis; final boolean finalNum; finalNum = maxLength > 30 && selectedComparisonList.size() > 4; xAxis = new SymbolAxis(null, xAxisLabels) { int x = 0; @Override public Paint getTickLabelPaint() { if (x >= diseaseGroupslabelsColor.length) { x = 0; } return diseaseGroupslabelsColor[x++]; } private final boolean localfinal = finalNum; @Override protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) { if (localfinal) { setVerticalTickLabels(localfinal); return super.refreshTicksHorizontal(g2, dataArea, edge); } List ticks = new java.util.ArrayList(); Font tickLabelFont = getTickLabelFont(); g2.setFont(tickLabelFont); double size = getTickUnit().getSize(); int count = calculateVisibleTickCount(); double lowestTickValue = calculateLowestVisibleTickValue(); double previousDrawnTickLabelPos = 0.0; double previousDrawnTickLabelLength = 0.0; if (count <= ValueAxis.MAXIMUM_TICK_COUNT) { for (int i = 0; i < count; i++) { double currentTickValue = lowestTickValue + (i * size); double xx = valueToJava2D(currentTickValue, dataArea, edge); String tickLabel; NumberFormat formatter = getNumberFormatOverride(); if (formatter != null) { tickLabel = formatter.format(currentTickValue) + " "; } else { tickLabel = valueToString(currentTickValue) + " "; } // avoid to draw overlapping tick labels Rectangle2D bounds = TextUtilities.getTextBounds(tickLabel, g2, g2.getFontMetrics()); double tickLabelLength = isVerticalTickLabels() ? bounds.getHeight() : bounds.getWidth(); boolean tickLabelsOverlapping = false; if (i > 0) { double avgTickLabelLength = (previousDrawnTickLabelLength + tickLabelLength) / 2.0; if (Math.abs(xx - previousDrawnTickLabelPos) < avgTickLabelLength) { tickLabelsOverlapping = true; } } if (tickLabelsOverlapping) { setVerticalTickLabels(true); } else { // remember these values for next comparison previousDrawnTickLabelPos = xx; previousDrawnTickLabelLength = tickLabelLength; } TextAnchor anchor; TextAnchor rotationAnchor; double angle = 0.0; if (isVerticalTickLabels()) { anchor = TextAnchor.CENTER_RIGHT; rotationAnchor = TextAnchor.CENTER_RIGHT; if (edge == RectangleEdge.TOP) { angle = 76.5; } else { angle = -76.5; } } else { if (edge == RectangleEdge.TOP) { anchor = TextAnchor.BOTTOM_CENTER; rotationAnchor = TextAnchor.BOTTOM_CENTER; } else { anchor = TextAnchor.TOP_CENTER; rotationAnchor = TextAnchor.TOP_CENTER; } } Tick tick = new NumberTick(new Double(currentTickValue), tickLabel, anchor, rotationAnchor, angle); ticks.add(tick); } } return ticks; } }; // } xAxis.setTickLabelFont(font); xAxis.setTickLabelInsets(new RectangleInsets(2, 20, 2, 20)); xAxis.setAutoRangeStickyZero(true); xAxis.setAutoRangeStickyZero(true); xAxis.setTickMarksVisible(false); xAxis.setUpperBound(diseaseGroupslabelsColor.length - 1); xAxis.setGridBandsVisible(false); xAxis.setAxisLinePaint(Color.LIGHT_GRAY); int scale = XYBubbleRenderer.SCALE_ON_RANGE_AXIS; XYItemRenderer xyitemrenderer = new XYBubbleRenderer(scale) { private int counter = 0; private int localSerious = -1; private final Map<Integer, Color[]> localSeriousColorMap = seriousColorMap; @Override public Paint getSeriesPaint(int series) { if (series != localSerious || isNewImge || localSeriousColorMap.get(series).length == counter) { counter = 0; isNewImge = false; } localSerious = series; Color c = localSeriousColorMap.get(series)[counter]; counter++; return c; } }; XYPlot xyplot = new XYPlot(defaultxyzdataset, xAxis, yAxis, xyitemrenderer) { @Override protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area, List ticks) { try { if (!ticks.isEmpty()) { ticks.remove(0); } if (!ticks.isEmpty()) { ticks.remove(ticks.size() - 1); } } catch (Exception e) { } super.drawRangeGridlines(g2, area, ticks); //To change body of generated methods, choose Tools | Templates. } // private final Color[] labelsColor = new Color[]{new Color(0, 153, 0), new Color(0, 229, 132), new Color(1, 141, 244), new Color(255, 51, 51), new Color(204, 0, 0), Color.decode("#b5babb")}; // // private final Font font = new Font("Verdana", Font.PLAIN, 12); // private final String[] labels = new String[]{"Decreased 100%", "Decreased <100% ", "Equal", " Increased <100%", "Increased 100%", "No Quant. Info."}; // // @Override // public LegendItemCollection getLegendItems() { // LegendItemCollection legendItemCollection = new LegendItemCollection(); // for (int i = 0; i < labelsColor.length; i++) { // LegendItem item = new LegendItem(labels[i], labelsColor[i]); // item.setLabelFont(font); // legendItemCollection.add(item); // // } // // return legendItemCollection;//To change body of generated methods, choose Tools | Templates. // } }; JFreeChart generatedChart = new JFreeChart(xyplot) { }; xyplot.setOutlineVisible(false); LegendTitle legend = generatedChart.getLegend(); legend.setVisible(false); xyplot.setBackgroundPaint(Color.WHITE); generatedChart.setBackgroundPaint(Color.WHITE); generatedChart.setPadding(new RectangleInsets(0, 0, 0, 0)); Quant_Central_Manager.setProteinsOverviewBubbleChart(generatedChart); return generatedChart; }
From source file:de.tor.tribes.ui.panels.MinimapPanel.java
private boolean redraw() { Village[][] mVisibleVillages = DataHolder.getSingleton().getVillages(); if (mVisibleVillages == null || mBuffer == null) { return false; }/*from w ww . j a v a 2s. com*/ Graphics2D g2d = (Graphics2D) mBuffer.getGraphics(); Composite tempC = g2d.getComposite(); //clear g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR)); g2d.fillRect(0, 0, mBuffer.getWidth(), mBuffer.getHeight()); //reset composite g2d.setComposite(tempC); boolean markPlayer = GlobalOptions.getProperties().getBoolean("mark.villages.on.minimap"); if (ServerSettings.getSingleton().getMapDimension() == null) { //could not draw minimap if dimensions are not loaded yet return false; } boolean showBarbarian = GlobalOptions.getProperties().getBoolean("show.barbarian"); Color DEFAULT = Constants.DS_DEFAULT_MARKER; try { int mark = Integer.parseInt(GlobalOptions.getProperty("default.mark")); if (mark == 0) { DEFAULT = Constants.DS_DEFAULT_MARKER; } else if (mark == 1) { DEFAULT = Color.RED; } else if (mark == 2) { DEFAULT = Color.WHITE; } } catch (Exception e) { DEFAULT = Constants.DS_DEFAULT_MARKER; } Rectangle mapDim = ServerSettings.getSingleton().getMapDimension(); double wField = mapDim.getWidth() / (double) visiblePart.width; double hField = mapDim.getHeight() / (double) visiblePart.height; UserProfile profile = GlobalOptions.getSelectedProfile(); Tribe currentTribe = InvalidTribe.getSingleton(); if (profile != null) { currentTribe = profile.getTribe(); } for (int i = visiblePart.x; i < (visiblePart.width + visiblePart.x); i++) { for (int j = visiblePart.y; j < (visiblePart.height + visiblePart.y); j++) { Village v = mVisibleVillages[i][j]; if (v != null) { Color markerColor = null; boolean isLeft = false; if (v.getTribe() == Barbarians.getSingleton()) { isLeft = true; } else { if ((currentTribe != null) && (v.getTribe().getId() == currentTribe.getId())) { //village is owned by current player. mark it dependent on settings if (markPlayer) { markerColor = Color.YELLOW; } } else { try { Marker marker = MarkerManager.getSingleton().getMarker(v.getTribe()); if (marker != null && !marker.isShownOnMap()) { marker = null; markerColor = DEFAULT; } if (marker == null) { marker = MarkerManager.getSingleton().getMarker(v.getTribe().getAlly()); if (marker != null && marker.isShownOnMap()) { markerColor = marker.getMarkerColor(); } } else { if (marker.isShownOnMap()) { markerColor = marker.getMarkerColor(); } } } catch (Exception e) { markerColor = null; } } } if (!isLeft) { if (markerColor != null) { g2d.setColor(markerColor); } else { g2d.setColor(DEFAULT); } g2d.fillRect((int) Math.round((i - visiblePart.x) * wField), (int) Math.round((j - visiblePart.y) * hField), (int) Math.floor(wField), (int) Math.floor(hField)); } else { if (showBarbarian) { g2d.setColor(Color.LIGHT_GRAY); g2d.fillRect((int) Math.round((i - visiblePart.x) * wField), (int) Math.round((j - visiblePart.y) * hField), (int) Math.floor(wField), (int) Math.floor(hField)); } } } } } try { if (GlobalOptions.getProperties().getBoolean("map.showcontinents")) { g2d.setColor(Color.BLACK); Composite c = g2d.getComposite(); Composite a = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f); Font f = g2d.getFont(); Font t = new Font("Serif", Font.BOLD, (int) Math.round(30 * hField)); g2d.setFont(t); int fact = 10; int mid = (int) Math.round(50 * wField); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { g2d.setComposite(a); String conti = "K" + (j * 10 + i); Rectangle2D bounds = g2d.getFontMetrics(t).getStringBounds(conti, g2d); int cx = i * fact * 10 - visiblePart.x; int cy = j * fact * 10 - visiblePart.y; cx = (int) Math.round(cx * wField); cy = (int) Math.round(cy * hField); g2d.drawString(conti, (int) Math.rint(cx + mid - bounds.getWidth() / 2), (int) Math.rint(cy + mid + bounds.getHeight() / 2)); g2d.setComposite(c); int wk = 100; int hk = 100; if (i == 9) { wk -= 1; } if (j == 9) { hk -= 1; } g2d.drawRect(cx, cy, (int) Math.round(wk * wField), (int) Math.round(hk * hField)); } } g2d.setFont(f); } } catch (Exception e) { logger.error("Creation of Minimap failed", e); } g2d.dispose(); return true; }
From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImpl.java
/** * Internal implementation to add a list of documents to a presentation; either as a single slide or a series of slides. * @param imageSource the image source to convert images to data. * @param ppt the presentation to add to. * @param sl the slide to add to (can be null if pagination is enabled). * @param anchor bounding rectangle to draw onto, in PowerPoint coordinates. * @param paginate whether to render results as multiple slides if they don't fit on one slide. * @param data the documents to render./*ww w . j a v a2 s .co m*/ * @param results optional string to render into the top-left corner of the available space. * Will appear on each page if pagination is enabled. * @param sortBy optional string to render into the top-right corner of the available space. * Will appear on each page if pagination is enabled. */ private static void addList(final ImageSource imageSource, final XMLSlideShow ppt, XSLFSlide sl, final Rectangle2D.Double anchor, final boolean paginate, final ListData data, final String results, final String sortBy) { final double // How much space to leave at the left and right edge of the slide xMargin = 20, // How much space to leave at the top yMargin = 5, // Size of the icon iconWidth = 20, iconHeight = 24, // Find's thumbnail height is 97px by 55px, hardcoded in the CSS in .document-thumbnail thumbScale = 0.8, thumbW = 97 * thumbScale, thumbH = 55 * thumbScale, // Margin around the thumbnail thumbMargin = 4., // Space between list items listItemMargin = 5.; final Pattern highlightPattern = Pattern .compile("<HavenSearch-QueryText-Placeholder>(.*?)</HavenSearch-QueryText-Placeholder>"); double yCursor = yMargin + anchor.getMinY(), xCursor = xMargin + anchor.getMinX(); int docsOnPage = 0; final Document[] docs = data.getDocs(); for (int docIdx = 0; docIdx < docs.length; ++docIdx) { final Document doc = docs[docIdx]; if (sl == null) { sl = ppt.createSlide(); yCursor = yMargin + anchor.getMinY(); xCursor = xMargin + anchor.getMinX(); docsOnPage = 0; double yStep = 0; if (StringUtils.isNotBlank(results)) { final XSLFTextBox textBox = sl.createTextBox(); textBox.clearText(); final Rectangle2D.Double textBounds = new Rectangle2D.Double(xCursor, yCursor, Math.max(0, anchor.getMaxX() - xCursor - xMargin), 20); textBox.setAnchor(textBounds); addTextRun(textBox.addNewTextParagraph(), results, 12., Color.LIGHT_GRAY); yStep = textBox.getTextHeight(); } if (StringUtils.isNotBlank(sortBy)) { final XSLFTextBox sortByEl = sl.createTextBox(); sortByEl.clearText(); final XSLFTextParagraph sortByText = sortByEl.addNewTextParagraph(); sortByText.setTextAlign(TextParagraph.TextAlign.RIGHT); addTextRun(sortByText, sortBy, 12., Color.LIGHT_GRAY); sortByEl.setAnchor(new Rectangle2D.Double(xCursor, yCursor, Math.max(0, anchor.getMaxX() - xCursor - xMargin), 20)); yStep = Math.max(sortByEl.getTextHeight(), yStep); } if (yStep > 0) { yCursor += listItemMargin + yStep; } } XSLFAutoShape icon = null; if (data.isDrawIcons()) { icon = sl.createAutoShape(); icon.setShapeType(ShapeType.SNIP_1_RECT); icon.setAnchor(new Rectangle2D.Double(xCursor, yCursor + listItemMargin, iconWidth, iconHeight)); icon.setLineColor(Color.decode("#888888")); icon.setLineWidth(2.0); xCursor += iconWidth; } final XSLFTextBox listEl = sl.createTextBox(); listEl.clearText(); listEl.setAnchor(new Rectangle2D.Double(xCursor, yCursor, Math.max(0, anchor.getMaxX() - xCursor - xMargin), Math.max(0, anchor.getMaxY() - yCursor))); final XSLFTextParagraph titlePara = listEl.addNewTextParagraph(); addTextRun(titlePara, doc.getTitle(), data.getTitleFontSize(), Color.BLACK).setBold(true); if (StringUtils.isNotBlank(doc.getDate())) { final XSLFTextParagraph datePara = listEl.addNewTextParagraph(); datePara.setLeftMargin(5.); addTextRun(datePara, doc.getDate(), data.getDateFontSize(), Color.GRAY).setItalic(true); } if (StringUtils.isNotBlank(doc.getRef())) { addTextRun(listEl.addNewTextParagraph(), doc.getRef(), data.getRefFontSize(), Color.GRAY); } final double thumbnailOffset = listEl.getTextHeight(); final XSLFTextParagraph contentPara = listEl.addNewTextParagraph(); Rectangle2D.Double pictureAnchor = null; XSLFPictureData pictureData = null; if (StringUtils.isNotBlank(doc.getThumbnail())) { try { // Picture reuse is automatic pictureData = addPictureData(imageSource, ppt, doc.getThumbnail()); // We reserve space for the picture, but we don't actually add it yet. // The reason is we may have to remove it later if it doesn't fit; but due to a quirk of OpenOffice, // deleting the picture shape removes the pictureData as well; which is a problem since the // pictureData can be shared between multiple pictures. pictureAnchor = new Rectangle2D.Double(xCursor, yCursor + thumbnailOffset + thumbMargin, thumbW, thumbH); // If there is enough horizontal space, put the text summary to the right of the thumbnail image, // otherwise put it under the thumbnail, if (listEl.getAnchor().getWidth() > 2.5 * thumbW) { contentPara.setLeftMargin(thumbW); } else { contentPara.addLineBreak().setFontSize(thumbH); } } catch (RuntimeException e) { // if there's any errors, we'll just ignore the image } } final String rawSummary = doc.getSummary(); if (StringUtils.isNotBlank(rawSummary)) { // HTML treats newlines and multiple whitespace as a single whitespace. final String summary = rawSummary.replaceAll("\\s+", " "); final Matcher matcher = highlightPattern.matcher(summary); int idx = 0; while (matcher.find()) { final int start = matcher.start(); if (idx < start) { addTextRun(contentPara, summary.substring(idx, start), data.getSummaryFontSize(), Color.DARK_GRAY); } addTextRun(contentPara, matcher.group(1), data.getSummaryFontSize(), Color.DARK_GRAY) .setBold(true); idx = matcher.end(); } if (idx < summary.length()) { addTextRun(contentPara, summary.substring(idx), data.getSummaryFontSize(), Color.DARK_GRAY); } } double elHeight = Math.max(listEl.getTextHeight(), iconHeight); if (pictureAnchor != null) { elHeight = Math.max(elHeight, pictureAnchor.getMaxY() - yCursor); } yCursor += elHeight; xCursor = xMargin + anchor.getMinX(); docsOnPage++; if (yCursor > anchor.getMaxY()) { if (docsOnPage > 1) { // If we drew more than one list element on this page; and we exceeded the available space, // delete the last element's shapes and redraw it on the next page. // We don't have to remove the picture since we never added it. sl.removeShape(listEl); if (icon != null) { sl.removeShape(icon); } --docIdx; } else if (pictureAnchor != null) { // We've confirmed we need the picture, add it. sl.createPicture(pictureData).setAnchor(pictureAnchor); } sl = null; if (!paginate) { break; } } else { yCursor += listItemMargin; if (pictureAnchor != null) { // We've confirmed we need the picture, add it. sl.createPicture(pictureData).setAnchor(pictureAnchor); } } } }
From source file:de.bwravencl.controllerbuddy.gui.Main.java
private void initOverlay() { if (!preferences.getBoolean(PREFERENCES_SHOW_OVERLAY, Toolkit.getDefaultToolkit().isAlwaysOnTopSupported())) return;/*from w ww . ja v a2s .c o m*/ var longestDescription = ""; for (final var mode : input.getProfile().getModes()) { final var description = mode.getDescription(); if (description.length() > longestDescription.length()) longestDescription = description; } final var fontMetrics = labelCurrentMode.getFontMetrics(labelCurrentMode.getFont()); labelCurrentMode.setPreferredSize( new Dimension(fontMetrics.stringWidth(longestDescription), fontMetrics.getHeight())); labelCurrentMode.setForeground(Color.RED); labelCurrentMode.setText(input.getProfile().getActiveMode().getDescription()); overlayFrame = new JFrame("Overlay"); overlayFrame.setType(JFrame.Type.UTILITY); overlayFrame.setLayout(new BorderLayout()); overlayFrame.setFocusableWindowState(false); overlayFrame.setUndecorated(true); overlayFrame.setBackground(TRANSPARENT); overlayFrame.add(labelCurrentMode, BorderLayout.PAGE_END); overlayFrame.setAlwaysOnTop(true); indicatorPanelFlowLayout = new FlowLayout(); indicatorPanel = new JPanel(indicatorPanelFlowLayout); indicatorPanel.setBackground(TRANSPARENT); final var virtualAxisToOverlayAxisMap = input.getProfile().getVirtualAxisToOverlayAxisMap(); for (final var virtualAxis : Input.VirtualAxis.values()) { final var overlayAxis = virtualAxisToOverlayAxisMap.get(virtualAxis); if (overlayAxis != null) { final var progressBar = new JProgressBar(SwingConstants.VERTICAL) { private static final long serialVersionUID = 8167193907929992395L; @Override public void setMaximum(final int n) { if (overlayAxis.inverted) super.setMinimum(-n); else super.setMaximum(n); } @Override public void setMinimum(final int n) { if (overlayAxis.inverted) super.setMaximum(-n); else super.setMinimum(n); } @Override public void setValue(final int n) { super.setValue(overlayAxis.inverted ? -n : n); } }; progressBar.setPreferredSize(new Dimension(21, 149)); progressBar.setBorder(BorderFactory.createDashedBorder(Color.BLACK, (float) progressBar.getPreferredSize().getWidth(), (float) progressBar.getPreferredSize().getWidth())); progressBar.setBackground(Color.LIGHT_GRAY); progressBar.setForeground(overlayAxis.color); progressBar.setValue(1); indicatorPanel.add(progressBar); virtualAxisToProgressBarMap.put(virtualAxis, progressBar); } } overlayFrame.add(indicatorPanel); overlayFrameDragListener = new FrameDragListener(this, overlayFrame) { @Override public void mouseDragged(final MouseEvent e) { super.mouseDragged(e); final var maxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment() .getMaximumWindowBounds(); updateOverlayAlignment(maxWindowBounds); } }; overlayFrame.addMouseListener(overlayFrameDragListener); overlayFrame.addMouseMotionListener(overlayFrameDragListener); prevMaxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); updateOverlayLocation(prevMaxWindowBounds); overlayFrame.setVisible(true); }
From source file:com.projity.contrib.calendar.JXXMonthView.java
private void drawDay(boolean colored, boolean flagged, boolean today, Graphics g, String text, int x, int y) { Color defaultColor = g.getColor(); Font oldFont = getFont();/*from www . j a v a 2s .co m*/ if (colored) { g.setColor(Color.LIGHT_GRAY); g.fillRect(_bounds.x, _bounds.y, _bounds.width, _bounds.height); g.setColor(defaultColor); } if (today) g.setColor(Color.BLUE); if (flagged) { g.setColor(Color.RED); g.setFont(_derivedFont); } g.drawString(text, x, y); g.setColor(defaultColor); g.setFont(oldFont); }
From source file:CGgui.java
private void SaveGrayMinChrt() { //get chart and renderer XYPlot xyplot = (XYPlot) minchart.getPlot(); XYItemRenderer renderer0 = xyplot.getRenderer(0); XYItemRenderer renderer1 = xyplot.getRenderer(1); //set gray//from w w w. ja v a2 s.com Paint defaultPaint0 = renderer0.getSeriesPaint(0); Paint defaultPaint1 = renderer1.getSeriesPaint(0); renderer0.setSeriesPaint(0, Color.LIGHT_GRAY); renderer1.setSeriesPaint(0, Color.DARK_GRAY); xyplot.setRenderer(0, renderer0); xyplot.setRenderer(1, renderer1); //save SaveMinChrt(); //restore color renderer0.setSeriesPaint(0, defaultPaint0); renderer1.setSeriesPaint(0, defaultPaint1); xyplot.setRenderer(0, renderer0); xyplot.setRenderer(1, renderer1); }
From source file:org.pmedv.blackboard.components.BoardEditor.java
@Override protected void paintComponent(Graphics g) { Boolean useLayerColor = (Boolean) Preferences.values .get("org.pmedv.blackboard.BoardDesignerPerspective.useLayerColor"); // clear all // g.clearRect(0, 0, getWidth(), getHeight()); g.setColor(BLANK);/*w ww . ja v a2 s . com*/ g.fillRect(0, 0, getWidth(), getHeight()); // some nice anti aliasing... Graphics2D g2 = (Graphics2D) g; RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setRenderingHints(rh); // TODO : Should this be done here? // Sort layers by z-index g2.setColor(Color.LIGHT_GRAY); g2.setStroke(BoardUtil.stroke_1_0f); Collections.sort(model.getLayers()); for (int i = model.getLayers().size() - 1; i >= 0; i--) { // Sort items by z-index Collections.sort(model.getLayers().get(i).getItems()); drawLayer(model.getLayers().get(i), g2); } // draw selection border if (state.equals(SelectionState.DRAGGING_NEW_SELECTION) && button1Pressed) { g2.setColor(Color.GREEN); g2.setStroke(BoardUtil.stroke_1_0f); if (dragStopX < dragStartX && dragStopY > dragStartY) { selectionBorder.setSize(dragStartX - dragStopX, dragStopY - dragStartY); selectionBorder.setLocation(dragStopX, dragStartY); } else if (dragStopY < dragStartY && dragStopX > dragStartX) { selectionBorder.setSize(dragStopX - dragStartX, dragStartY - dragStopY); selectionBorder.setLocation(dragStartX, dragStopY); } else if (dragStopX < dragStartX && dragStopY < dragStartY) { selectionBorder.setSize(dragStartX - dragStopX, dragStartY - dragStopY); selectionBorder.setLocation(dragStopX, dragStopY); } else { selectionBorder.setSize(dragStopX - dragStartX, dragStopY - dragStartY); selectionBorder.setLocation(dragStartX, dragStartY); } g2.draw(selectionBorder); } // display shape currently being drawed if (lineStartX > 0 && lineStartY > 0 && lineStopX > 0 && lineStopY > 0) { if (useLayerColor) g2.setColor(model.getCurrentLayer().getColor()); else g2.setColor(palette.getCurrentColor()); g2.setStroke((BasicStroke) shapesPanel.getThicknessCombo().getSelectedItem()); // draw new line if (editorMode.equals(EditorMode.DRAW_LINE)) { if (useLayerColor) currentDrawingLine.setColor(model.getCurrentLayer().getColor()); else currentDrawingLine.setColor(palette.getCurrentColor()); currentDrawingLine.setStartType((LineEdgeType) shapesPanel.getStartLineCombo().getSelectedItem()); currentDrawingLine.setEndType((LineEdgeType) shapesPanel.getEndLineCombo().getSelectedItem()); currentDrawingLine.setStroke((BasicStroke) shapesPanel.getThicknessCombo().getSelectedItem()); currentDrawingLine.getStart().setLocation(lineStartX, lineStartY); currentDrawingLine.getEnd().setLocation(lineStopX, lineStopY); currentDrawingLine.draw(g2); } else if (editorMode.equals(EditorMode.DRAW_MEASURE)) { currentDrawingLine.setStroke(Measure.DEFAULT_STROKE); currentDrawingLine.getStart().setLocation(lineStartX, lineStartY); currentDrawingLine.getEnd().setLocation(lineStopX, lineStopY); currentDrawingLine.draw(g2); } // draw new box or ellipse else if (editorMode.equals(EditorMode.DRAW_RECTANGLE) || editorMode.equals(EditorMode.DRAW_ELLIPSE)) { int xLoc = lineStartX; int yLoc = lineStartY; int width = lineStopX - lineStartX; int height = lineStopY - lineStartY; ShapeStyle style = (ShapeStyle) shapesPanel.getStyleCombo().getSelectedItem(); if (style == null || style.equals(ShapeStyle.FILLED)) { if (editorMode.equals(EditorMode.DRAW_RECTANGLE)) { g2.fillRect(xLoc, yLoc, width, height); } else { g2.fillOval(xLoc, yLoc, width, height); } } else if (style.equals(ShapeStyle.OUTLINED)) { g2.setStroke((BasicStroke) shapesPanel.getThicknessCombo().getSelectedItem()); if (editorMode.equals(EditorMode.DRAW_RECTANGLE)) { g2.drawRect(xLoc, yLoc, width, height); } else { g2.drawOval(xLoc, yLoc, width, height); } } } } // draw selection handles if (selectedItem != null) { g2.setStroke(BoardUtil.stroke_1_0f); g2.setColor(Color.GREEN); selectedItem.drawHandles(g2, 8); } // draw border if (zoomLayer != null) { TransformUI ui = (TransformUI) (Object) zoomLayer.getUI(); DefaultTransformModel xmodel = (DefaultTransformModel) ui.getModel(); if (xmodel.isMirror()) { g2.setColor(Color.RED); } else { g2.setColor(Color.GREEN); } } else { g2.setColor(Color.GREEN); } g2.setStroke(DEFAULT_STROKE); Rectangle border = new Rectangle(0, 0, model.getWidth() - 1, model.getHeight() - 1); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); g2.draw(border); if (model.getType().equals(BoardType.STRIPES) || model.getType().equals(BoardType.HOLES)) { g2.setColor(Color.BLACK); g2.setFont(miniFont); int index = 1; for (int x = 12; x < model.getWidth() - 16; x += 16) { g2.drawString(String.valueOf(index++), x, 8); } index = 1; for (int y = 18; y < model.getHeight(); y += 16) { g2.drawString(String.valueOf(index++), 3, y); } } if (editorMode.equals(EditorMode.CHECK_CONNECTIONS)) { if (connectedLines != null) { for (Line line : connectedLines) { line.drawFat(g2); } } } if (drawing) { g2.setColor(Color.BLUE); g2.setStroke(DEFAULT_STROKE); if (selectedPin != null) { g2.drawRect(lineStopX - 8, lineStopY - 8, 16, 16); } } super.paintComponents(g2); }
From source file:ejemplo.grafica.java
private void suciedad() { //agregar/*from w w w . j a va 2 s . c o m*/ double nivelSuciedad = parseDouble(txtNivel.getText()); double min, pocosucia, sucia, muysucia, parte, max; max = parseDouble(txtMaxNivel.getText()); parte = max / 3; min = 0; pocosucia = parte; sucia = parte * 2; muysucia = parte * 3; //niveles para el color //niveles normal if (nivelSuciedad >= min && nivelSuciedad < pocosucia) { UIDefaults defaults = new UIDefaults(); defaults.put("ProgressBar[Enabled].foregroundPainter", new MyPainter(Color.BLUE)); defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", new MyPainter(Color.BLUE)); progressBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE); progressBar.putClientProperty("Nimbus.Overrides", defaults); } else { //nivel sucio if (nivelSuciedad >= pocosucia && nivelSuciedad < sucia) { UIDefaults defaults = new UIDefaults(); defaults.put("ProgressBar[Enabled].foregroundPainter", new MyPainter(Color.LIGHT_GRAY)); defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", new MyPainter(Color.LIGHT_GRAY)); progressBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE); progressBar.putClientProperty("Nimbus.Overrides", defaults); } else { //nivel muy sucio if (nivelSuciedad >= sucia && nivelSuciedad <= muysucia) { UIDefaults defaults = new UIDefaults(); defaults.put("ProgressBar[Enabled].foregroundPainter", new MyPainter(Color.GRAY)); defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", new MyPainter(Color.GRAY)); progressBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE); progressBar.putClientProperty("Nimbus.Overrides", defaults); } } } //fin niveles }
From source file:org.pmedv.blackboard.components.BoardEditor.java
/** * Draws the selected item to the graphics context * //from w w w . j a v a2 s .c o m * @param layer the layer to be drawn * @param g2d the graphics context */ private void drawLayer(Layer layer, Graphics2D g2d) { if (!layer.isVisible()) return; DefaultTransformModel xmodel = null; if (zoomLayer != null) { TransformUI ui = (TransformUI) (Object) zoomLayer.getUI(); xmodel = (DefaultTransformModel) ui.getModel(); } if (layer.getName().equalsIgnoreCase("board")) { if (backgroundImage != null) { g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, layer.getOpacity())); g2d.drawImage(backgroundImage, 0, 0, this); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); } else { g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, getWidth(), getHeight()); } g2d.setColor(Color.LIGHT_GRAY); g2d.setStroke(BoardUtil.stroke_1_0f); Boolean dotGrid = (Boolean) Preferences.values .get("org.pmedv.blackboard.BoardDesignerPerspective.dotGrid"); // draw grid if (gridVisible) { BoardUtil.drawGrid(g2d, raster, model.getWidth(), model.getHeight(), dotGrid.booleanValue()); } return; } if (layer.getName().equalsIgnoreCase("ratsnest")) { if (layer.getImage() != null) { g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, layer.getOpacity())); g2d.drawImage(layer.getImage(), 0, 0, this); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); } return; } for (Item item : layer.getItems()) { if (xmodel != null) item.setMirror(xmodel.isMirror()); item.setOpacity(layer.getOpacity()); if (item instanceof Line) { Line line = (Line) item; if (line.getStroke() != null) g2d.setStroke(line.getStroke()); else g2d.setStroke(BoardUtil.stroke_3_0f); g2d.setColor(item.getColor()); } item.draw(g2d); if (selectedItems.contains(item)) { g2d.setColor(Color.GREEN); g2d.setStroke(BoardUtil.stroke_1_0f); item.drawHandles(g2d, 8); } } }