List of usage examples for java.awt Color YELLOW
Color YELLOW
To view the source code for java.awt Color YELLOW.
Click Source Link
From source file:mio_de_pso.MainForm.java
private LookupPaintScale createLookupPaintScale(double[] values) { double minVal = values[0]; double maxVal = values[0]; for (int i = 0; i < values.length; ++i) { if (values[i] < minVal) minVal = values[i];/* ww w.j a v a 2s. c o m*/ if (values[i] > maxVal) maxVal = values[i]; } LookupPaintScale ps = new LookupPaintScale(minVal, maxVal + 0.0000001, Color.WHITE); Color startColor = Color.BLACK; Color secondColor = Color.BLUE; Color thirdColor = Color.GREEN; Color fourthColor = Color.YELLOW; Color endColor = Color.RED; int iterations = 80; int iterationPerColor = iterations / 4; double res = Math.round(((maxVal - minVal) / iterations) * 100.0) / 100.0; minVal -= res; for (int i = 0; i < iterationPerColor; ++i) { ps.add(minVal += res, new Color( startColor.getRed() + (((secondColor.getRed() - startColor.getRed()) * i) / iterationPerColor), startColor.getGreen() + (((secondColor.getGreen()) - startColor.getGreen()) * i) / iterationPerColor, startColor.getBlue() + (((secondColor.getBlue() - startColor.getBlue()) * i) / iterationPerColor))); } for (int i = 0; i < iterationPerColor; ++i) { ps.add(minVal += res, new Color( secondColor.getRed() + (((thirdColor.getRed() - secondColor.getRed()) * i) / iterationPerColor), secondColor.getGreen() + (((thirdColor.getGreen()) - secondColor.getGreen()) * i) / iterationPerColor, secondColor.getBlue() + (((thirdColor.getBlue() - secondColor.getBlue()) * i) / iterationPerColor))); } for (int i = 0; i < iterationPerColor; ++i) { ps.add(minVal += res, new Color( thirdColor.getRed() + (((fourthColor.getRed() - thirdColor.getRed()) * i) / iterationPerColor), thirdColor.getGreen() + (((fourthColor.getGreen()) - thirdColor.getGreen()) * i) / iterationPerColor, thirdColor.getBlue() + (((fourthColor.getBlue() - thirdColor.getBlue()) * i) / iterationPerColor))); } for (int i = 0; i < iterationPerColor; ++i) { ps.add(minVal += res, new Color( fourthColor.getRed() + (((endColor.getRed() - fourthColor.getRed()) * i) / iterationPerColor), fourthColor.getGreen() + (((endColor.getGreen()) - fourthColor.getGreen()) * i) / iterationPerColor, fourthColor.getBlue() + (((endColor.getBlue() - fourthColor.getBlue()) * i) / iterationPerColor))); } return ps; }
From source file:userinterface.Citizen.CitizenWorkAreaJPanel.java
private void graphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_graphButtonActionPerformed JFreeChart lineChart = ChartFactory.createLineChart("Vital Sign Chart", "TimeStamp", "Vital Signs", createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartFrame cf = new ChartFrame("Vital Sign Chart", lineChart); CategoryPlot plot = lineChart.getCategoryPlot(); // Stroke[] seriesStrokeArray = new Stroke[3]; // seriesStrokeArray[0] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[]{10.0f, 6.0f}, 0.0f); // seriesStrokeArray[1] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[]{6.0f, 6.0f}, 0.0f); // seriesStrokeArray[2] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[]{2.0f, 6.0f}, 0.0f); // plot.setShadowGenerator(null); lineChart.setBackgroundPaint(Color.yellow); plot.setBackgroundPaint(Color.yellow); cf.setSize(450, 450);/*from w w w .j av a 2s .co m*/ cf.setVisible(true); }
From source file:com.manydesigns.portofino.actions.admin.appwizard.ApplicationWizard.java
protected void setupCalendar(List<ChildPage> childPages) throws Exception { List<List<String>> calendarDefinitions = new ArrayList<List<String>>(); Color[] colors = { Color.RED, new Color(64, 128, 255), Color.CYAN.darker(), Color.GRAY, Color.GREEN.darker(), Color.ORANGE, Color.YELLOW.darker(), Color.MAGENTA.darker(), Color.PINK }; int colorIndex = 0; for (Table table : allTables) { List<Column> dateColumns = new ArrayList<Column>(); for (Column column : table.getColumns()) { if (column.getActualJavaType() != null && Date.class.isAssignableFrom(column.getActualJavaType())) { dateColumns.add(column); }/* ww w. j a v a 2 s . com*/ } if (!dateColumns.isEmpty()) { // ["Cal 1", "db1.schema1.table1", ["column1", "column2"], Color.RED] Color color = colors[colorIndex++ % colors.length]; List<String> calDef = new ArrayList<String>(); calDef.add('"' + Util.guessToWords(table.getActualEntityName()) + '"'); calDef.add('"' + table.getQualifiedName() + '"'); String cols = "["; boolean first = true; for (Column column : dateColumns) { if (first) { first = false; } else { cols += ", "; } cols += '"' + column.getActualPropertyName() + '"'; } cols += "]"; calDef.add(cols); calDef.add("new java.awt.Color(" + color.getRed() + ", " + color.getGreen() + ", " + color.getBlue() + ")"); calendarDefinitions.add(calDef); } } if (!calendarDefinitions.isEmpty()) { String calendarDefinitionsStr = "["; calendarDefinitionsStr += StringUtils.join(calendarDefinitions, ", "); calendarDefinitionsStr += "]"; String baseName = "calendar-" + connectionProvider.getDatabase().getDatabaseName(); File dir = new File(pagesDir, baseName); int retries = 1; while (dir.exists()) { retries++; dir = new File(pagesDir, baseName + "-" + retries); } if (dir.mkdirs()) { CalendarConfiguration configuration = new CalendarConfiguration(); DispatcherLogic.saveConfiguration(dir, configuration); Page page = new Page(); page.setId(RandomUtil.createRandomId()); String calendarTitle = "Calendar (" + connectionProvider.getDatabase().getDatabaseName() + ")"; if (retries > 1) { calendarTitle += " - " + retries; } page.setTitle(calendarTitle); page.setDescription(calendarTitle); DispatcherLogic.savePage(dir, page); File actionFile = new File(dir, "action.groovy"); try { TemplateEngine engine = new SimpleTemplateEngine(); Template template = engine .createTemplate(ApplicationWizard.class.getResource("CalendarPage.groovy")); Map<String, Object> bindings = new HashMap<String, Object>(); bindings.put("calendarDefinitions", calendarDefinitionsStr); FileWriter fw = new FileWriter(actionFile); template.make(bindings).writeTo(fw); IOUtils.closeQuietly(fw); } catch (Exception e) { logger.warn("Couldn't create calendar", e); SessionMessages.addWarningMessage("Couldn't create calendar: " + e); return; } ChildPage childPage = new ChildPage(); childPage.setName(dir.getName()); childPage.setShowInNavigation(true); childPages.add(childPage); } else { logger.warn("Couldn't create directory {}", dir.getAbsolutePath()); SessionMessages.addWarningMessage( ElementsThreadLocals.getText("couldnt.create.directory", dir.getAbsolutePath())); } } }
From source file:de.tor.tribes.ui.windows.DSWorkbenchMainFrame.java
public void showInfo(String pMessage) { mNotificationHideThread.interrupt(); infoPanel.setCollapsed(false);/*from w w w . ja v a 2 s .c o m*/ jXLabel1.setBackgroundPainter(new MattePainter(Color.YELLOW)); jXLabel1.setIcon(new ImageIcon("./graphics/icons/warning.png")); jXLabel1.setForeground(Color.BLACK); jXLabel1.setText(pMessage); }
From source file:userinterface.Citizen.CitizenWorkAreaJPanel.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed JFreeChart lineChart = ChartFactory.createBarChart("Vital Sign Chart", "TimeStamp", "Vital Signs", createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartFrame cf = new ChartFrame("Vital Sign Chart", lineChart); CategoryPlot plot = lineChart.getCategoryPlot(); // Stroke[] seriesStrokeArray = new Stroke[3]; // seriesStrokeArray[0] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[]{10.0f, 6.0f}, 0.0f); // seriesStrokeArray[1] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[]{6.0f, 6.0f}, 0.0f); // seriesStrokeArray[2] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[]{2.0f, 6.0f}, 0.0f); // plot.setShadowGenerator(null); lineChart.setBackgroundPaint(Color.yellow); plot.setBackgroundPaint(Color.yellow); cf.setSize(450, 450);// w ww . ja va 2s .c o m cf.setVisible(true); }
From source file:biogenesis.Organism.java
/** * Applies the effects produced by two touching segments. * /* ww w . ja va 2s . c om*/ * @param org The organism which is touching. * @param seg Index of this organism's segment. * @param oseg Index of the other organism's segment. * @param firstCall Indicates if this organism is the one that has detected the collision * or this method is called by this same method in the other organism. */ private void touchEffects(Organism org, int seg, int oseg, boolean firstCall) { if ((_parentID == org._ID || _ID == org._parentID) && org.alive) return; double takenEnergy = 0; switch (getTypeColor(_segColor[seg])) { case RED: // Red segment: try to get energy from the other organism // If the other segment is blue, it acts as a shield switch (getTypeColor(org._segColor[oseg])) { case BLUE: if (org.useEnergy(Utils.BLUE_ENERGY_CONSUMPTION)) { org.setColor(Color.BLUE); } else { // Doesn't have energy to use the shield if (useEnergy(Utils.RED_ENERGY_CONSUMPTION)) { // Get energy depending on segment length takenEnergy = Utils.between(_m[seg] * Utils.ORGANIC_OBTAINED_ENERGY, 0, org._energy); // The other organism will be shown in yellow org.setColor(Color.YELLOW); } } break; case RED: if (useEnergy(Utils.RED_ENERGY_CONSUMPTION)) { // Get energy depending on segment length takenEnergy = Utils.between(_m[seg] * Utils.ORGANIC_OBTAINED_ENERGY, 0, org._energy); // The other organism will be shown in red org.setColor(Color.RED); } break; default: if (useEnergy(Utils.RED_ENERGY_CONSUMPTION)) { // Get energy depending on segment length takenEnergy = Utils.between(_m[seg] * Utils.ORGANIC_OBTAINED_ENERGY, 0, org._energy); // The other organism will be shown in yellow org.setColor(Color.YELLOW); } } // energy interchange org._energy -= takenEnergy; _energy += takenEnergy; double CO2freed = takenEnergy * Utils.ORGANIC_SUBS_PRODUCED; useEnergy(CO2freed); // This organism will be shown in red setColor(Color.RED); break; case WHITE: // White segment: try to infect the other organism switch (getTypeColor(org._segColor[oseg])) { case BLUE: if (org.useEnergy(Utils.BLUE_ENERGY_CONSUMPTION)) { setColor(Color.WHITE); org.setColor(Color.BLUE); } else { if (org._infectedGeneticCode != _geneticCode) { if (useEnergy(Utils.WHITE_ENERGY_CONSUMPTION)) { org.infectedBy(this); org.setColor(Color.YELLOW); setColor(Color.WHITE); } } } break; case BROWN: break; default: if (org._infectedGeneticCode != _geneticCode) { if (useEnergy(Utils.WHITE_ENERGY_CONSUMPTION)) { org.infectedBy(this); org.setColor(Color.YELLOW); setColor(Color.WHITE); } } } break; case GRAY: switch (getTypeColor(org._segColor[oseg])) { case BLUE: if (org.useEnergy(Utils.BLUE_ENERGY_CONSUMPTION)) { org.setColor(Color.BLUE); setColor(Color.GRAY); } else { if (useEnergy(Utils.GRAY_ENERGY_CONSUMPTION)) { org.die(this); setColor(Color.GRAY); } } break; case BROWN: break; default: if (useEnergy(Utils.GRAY_ENERGY_CONSUMPTION)) { org.die(this); setColor(Color.GRAY); } } break; } // Check if the other organism has died if (org.isAlive() && org._energy < Utils.tol) { org.die(this); } if (firstCall) org.touchEffects(this, oseg, seg, false); }
From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java
/** * @deprecated Replaced by {@link ColorEnum}. *///from ww w. j av a 2 s .c o m public static Map getColorMap() { if (colorMap == null) { Map map = new HashMap(35); map.put(COLOR_BLACK, Color.black); map.put(COLOR_BLUE, Color.blue); map.put(COLOR_CYAN, Color.cyan); map.put(COLOR_DARK_GRAY, Color.darkGray); map.put(COLOR_GRAY, Color.gray); map.put(COLOR_GREEN, Color.green); map.put(COLOR_LIGHT_GRAY, Color.lightGray); map.put(COLOR_MAGENTA, Color.magenta); map.put(COLOR_ORANGE, Color.orange); map.put(COLOR_PINK, Color.pink); map.put(COLOR_RED, Color.red); map.put(COLOR_YELLOW, Color.yellow); map.put(COLOR_WHITE, Color.white); map.put(Color.black, COLOR_BLACK); map.put(Color.blue, COLOR_BLUE); map.put(Color.cyan, COLOR_CYAN); map.put(Color.darkGray, COLOR_DARK_GRAY); map.put(Color.gray, COLOR_GRAY); map.put(Color.green, COLOR_GREEN); map.put(Color.lightGray, COLOR_LIGHT_GRAY); map.put(Color.magenta, COLOR_MAGENTA); map.put(Color.orange, COLOR_ORANGE); map.put(Color.pink, COLOR_PINK); map.put(Color.red, COLOR_RED); map.put(Color.yellow, COLOR_YELLOW); map.put(Color.white, COLOR_WHITE); colorMap = Collections.unmodifiableMap(map); } return colorMap; }
From source file:op.care.reports.PnlReport.java
private JPanel createContentPanel4Day(LocalDate day) { // OPDE.getDisplayManager().setProgressBarMessage(new DisplayMessage("misc.msg.wait", progress, progressMax)); // progress++; final String key = DateFormat.getDateInstance().format(day.toDate()); synchronized (contentmap) { if (contentmap.containsKey(key)) { return contentmap.get(key); }//from w w w .ja v a 2 s . c o m } final JPanel dayPanel = new JPanel(new VerticalLayout()); dayPanel.setOpaque(false); synchronized (valuecache) { if (!valuecache.containsKey(key)) { valuecache.put(key, NReportTools.getNReports4Day(resident, day)); } int i = 0; // for zebra pattern for (final NReport nreport : valuecache.get(key)) { if (tbShowReplaced.isSelected() || !nreport.isObsolete()) { String title = SYSTools.toHTMLForScreen(SYSConst.html_table(SYSConst .html_table_tr("<td width=\"800\" align=\"left\">" + "<b><p>" + (nreport.isObsolete() ? SYSConst.html_16x16_Eraser_internal : "") + (nreport.isReplacement() ? SYSConst.html_16x16_Edited_internal : "") + DateFormat.getTimeInstance(DateFormat.SHORT).format(nreport.getPit()) + " " + SYSTools.xx("misc.msg.Time.short") + ", " + nreport.getMinutes() + " " + SYSTools.xx("misc.msg.Minute(s)") + ", " + nreport.getUser().getFullname() + (nreport.getCommontags().isEmpty() ? "" : " " + CommontagsTools.getAsHTML(nreport.getCommontags(), SYSConst.html_16x16_tagPurple_internal)) + "</p></b></td>") + SYSConst.html_table_tr("<td width=\"800\" align=\"left\">" + SYSTools.replace(nreport.getText(), "\n", "<br/>", false) + "</td>"), "0")); final DefaultCPTitle pnlSingle = new DefaultCPTitle(SYSTools.toHTMLForScreen(title), null); pnlSingle.getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GUITools.showPopup(GUITools.getHTMLPopup(pnlSingle.getButton(), NReportTools.getInfoAsHTML(nreport)), SwingConstants.NORTH); } }); if (!nreport.getAttachedFilesConnections().isEmpty()) { /*** * _ _ _____ _ _ * | |__ | |_ _ __ | ___(_) | ___ ___ * | '_ \| __| '_ \| |_ | | |/ _ \/ __| * | |_) | |_| | | | _| | | | __/\__ \ * |_.__/ \__|_| |_|_| |_|_|\___||___/ * */ final JButton btnFiles = new JButton( Integer.toString(nreport.getAttachedFilesConnections().size()), SYSConst.icon22greenStar); btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip")); btnFiles.setForeground(Color.BLUE); btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER); btnFiles.setFont(SYSConst.ARIAL18BOLD); btnFiles.setPressedIcon(SYSConst.icon22Pressed); btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT); btnFiles.setAlignmentY(Component.TOP_ALIGNMENT); btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnFiles.setContentAreaFilled(false); btnFiles.setBorder(null); btnFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Closure fileHandleClosure = OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID) ? null : new Closure() { @Override public void execute(Object o) { EntityManager em = OPDE.createEM(); final NReport myReport = em.find(NReport.class, nreport.getID()); em.close(); final String keyNewDay = DateFormat.getDateInstance() .format(myReport.getPit()); synchronized (contentmap) { contentmap.remove(keyNewDay); } synchronized (linemap) { linemap.remove(nreport); } synchronized (valuecache) { valuecache.get(keyNewDay).remove(nreport); valuecache.get(keyNewDay).add(myReport); Collections.sort(valuecache.get(keyNewDay)); } createCP4Day(new LocalDate(myReport.getPit())); buildPanel(); GUITools.flashBackground(linemap.get(myReport), Color.YELLOW, 2); } }; new DlgFiles(nreport, fileHandleClosure); } }); btnFiles.setEnabled(OPDE.isFTPworking()); pnlSingle.getRight().add(btnFiles); } if (!nreport.getAttachedQProcessConnections().isEmpty()) { /*** * _ _ ____ * | |__ | |_ _ __ | _ \ _ __ ___ ___ ___ ___ ___ * | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __| * | |_) | |_| | | | __/| | | (_) | (_| __/\__ \__ \ * |_.__/ \__|_| |_|_| |_| \___/ \___\___||___/___/ * */ final JButton btnProcess = new JButton( Integer.toString(nreport.getAttachedQProcessConnections().size()), SYSConst.icon22redStar); btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip")); btnProcess.setForeground(Color.YELLOW); btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER); btnProcess.setFont(SYSConst.ARIAL18BOLD); btnProcess.setPressedIcon(SYSConst.icon22Pressed); btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT); btnProcess.setAlignmentY(Component.TOP_ALIGNMENT); btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnProcess.setContentAreaFilled(false); btnProcess.setBorder(null); btnProcess.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgProcessAssign(nreport, new Closure() { @Override public void execute(Object o) { if (o == null) { return; } Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o; ArrayList<QProcess> assigned = result.getFirst(); ArrayList<QProcess> unassigned = result.getSecond(); EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); NReport myReport = em.merge(nreport); em.lock(myReport, LockModeType.OPTIMISTIC_FORCE_INCREMENT); ArrayList<SYSNR2PROCESS> attached = new ArrayList<SYSNR2PROCESS>( myReport.getAttachedQProcessConnections()); for (SYSNR2PROCESS linkObject : attached) { if (unassigned.contains(linkObject.getQProcess())) { linkObject.getQProcess().getAttachedNReportConnections() .remove(linkObject); linkObject.getNReport().getAttachedQProcessConnections() .remove(linkObject); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": " + nreport.getTitle() + " ID: " + nreport.getID(), PReportTools.PREPORT_TYPE_REMOVE_ELEMENT, linkObject.getQProcess())); em.remove(linkObject); } } attached.clear(); for (QProcess qProcess : assigned) { java.util.List<QProcessElement> listElements = qProcess .getElements(); if (!listElements.contains(myReport)) { QProcess myQProcess = em.merge(qProcess); SYSNR2PROCESS myLinkObject = em .merge(new SYSNR2PROCESS(myQProcess, myReport)); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": " + nreport.getTitle() + " ID: " + nreport.getID(), PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess)); qProcess.getAttachedNReportConnections().add(myLinkObject); myReport.getAttachedQProcessConnections().add(myLinkObject); } } em.getTransaction().commit(); final String keyNewDay = DateFormat.getDateInstance() .format(myReport.getPit()); synchronized (contentmap) { contentmap.remove(keyNewDay); } synchronized (linemap) { linemap.remove(nreport); } synchronized (valuecache) { valuecache.get(keyNewDay).remove(nreport); valuecache.get(keyNewDay).add(myReport); Collections.sort(valuecache.get(keyNewDay)); } createCP4Day(new LocalDate(myReport.getPit())); buildPanel(); GUITools.flashBackground(linemap.get(myReport), Color.YELLOW, 2); } catch (OptimisticLockException ole) { OPDE.warn(ole); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } else { reloadDisplay(true); } } catch (RollbackException ole) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } }); } }); btnProcess.setEnabled( OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)); pnlSingle.getRight().add(btnProcess); } /*** * __ __ * | \/ | ___ _ __ _ _ * | |\/| |/ _ \ '_ \| | | | * | | | | __/ | | | |_| | * |_| |_|\___|_| |_|\__,_| * */ final JButton btnMenu = new JButton(SYSConst.icon22menu); btnMenu.setPressedIcon(SYSConst.icon22Pressed); btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT); btnMenu.setAlignmentY(Component.TOP_ALIGNMENT); btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMenu.setContentAreaFilled(false); btnMenu.setBorder(null); btnMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JidePopup popup = new JidePopup(); popup.setMovable(false); popup.getContentPane() .setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.setOwner(btnMenu); popup.removeExcludedComponent(btnMenu); JPanel pnl = getMenu(nreport); popup.getContentPane().add(pnl); popup.setDefaultFocusComponent(pnl); GUITools.showPopup(popup, SwingConstants.WEST); } }); btnMenu.setEnabled(!nreport.isObsolete()); pnlSingle.getRight().add(btnMenu); JPanel zebra = new JPanel(); zebra.setLayout(new BoxLayout(zebra, BoxLayout.LINE_AXIS)); zebra.setOpaque(true); if (i % 2 == 0) { zebra.setBackground(SYSConst.orange1[SYSConst.light2]); } else { zebra.setBackground(Color.WHITE); } zebra.add(pnlSingle.getMain()); i++; dayPanel.add(zebra); linemap.put(nreport, pnlSingle.getMain()); } } } synchronized (contentmap) { contentmap.put(key, dayPanel); } return dayPanel; }
From source file:ucar.unidata.idv.control.chart.TimeSeriesChart.java
/** * Draw the sunrise/sunset curves/*from w ww.ja v a 2 s .co m*/ * * @param g2 the graphics area * @param plot the plot * @param dataArea the date range */ private void drawSunriseSunset(Graphics2D g2, XYPlot plot, Rectangle2D dataArea) { if (sunriseLocation == null) { return; } DateAxis domainAxis = (DateAxis) plot.getDomainAxis(); Date startDate = ((DateAxis) domainAxis).getMinimumDate(); Date endDate = ((DateAxis) domainAxis).getMaximumDate(); if ((sunriseDates == null) || !Misc.equals(startDate, lastStartDate) || !Misc.equals(endDate, lastEndDate)) { lastStartDate = startDate; lastEndDate = endDate; sunriseDates = IdvTimeline.makeSunriseDates(sunriseLocation, startDate, endDate); } int top = (int) (dataArea.getY()); int bottom = (int) (dataArea.getY() + dataArea.getHeight()); int height = bottom - top; g2.setColor(Color.yellow); Shape originalClip = g2.getClip(); g2.clip(dataArea); for (int i = 0; i < sunriseDates.size(); i += 2) { Date d1 = (Date) sunriseDates.get(i + 1); Date d2 = (Date) sunriseDates.get(i); int x1 = (int) domainAxis.valueToJava2D(d1.getTime(), dataArea, RectangleEdge.BOTTOM); int x2 = (int) domainAxis.valueToJava2D(d2.getTime(), dataArea, RectangleEdge.BOTTOM); g2.fillRect(x1, top, (x2 - x1), height); } g2.setClip(originalClip); }
From source file:org.jfree.chart.demo.DifferenceChartDemo2.java
/** * Creates a chart./* w w w .ja v a 2 s .com*/ * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Daylight Hours - London, UK", "Date", "Time", dataset, true, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); final XYDifferenceRenderer renderer = new XYDifferenceRenderer(Color.blue, Color.blue, false); renderer.setStroke(new BasicStroke(2.0f)); renderer.setSeriesPaint(0, Color.yellow); renderer.setSeriesPaint(1, Color.red); final XYPlot plot = chart.getXYPlot(); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); final DateAxis domainAxis = new DateAxis("Time"); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot.setDomainAxis(domainAxis); plot.setForegroundAlpha(0.5f); final Color c = new Color(255, 60, 24, 63); final Marker bst = new IntervalMarker(new Day(28, 3, 2004).getFirstMillisecond(), new Day(30, 10, 2004).getFirstMillisecond(), c, new BasicStroke(2.0f), null, null, 1.0f); bst.setLabel("British Summer Time"); bst.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT); bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, 10)); bst.setLabelTextAnchor(TextAnchor.BASELINE_RIGHT); plot.addDomainMarker(bst, Layer.BACKGROUND); final DateAxis rangeAxis = new DateAxis("Time"); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); plot.setRangeAxis(rangeAxis); return chart; }