List of usage examples for javax.swing JButton setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:pt.lsts.neptus.util.logdownload.LogsDownloaderWorkerUtil.java
/** * Creates a message listener for {@link EntityState} for {@link LogsDownloaderWorker}. * /* w ww . j a v a 2s. c o m*/ * @param worker * @param cameraButton * @return */ static MessageListener<MessageInfo, IMCMessage> createEntityStateMessageListener(LogsDownloaderWorker worker, JButton cameraButton) { return new MessageListener<MessageInfo, IMCMessage>() { @Override public void onMessage(MessageInfo info, IMCMessage msg) { if (msg.getAbbrev().equals("EntityState")) { // we need to check for the source match int srcIdNumber = msg.getSrc(); ImcSystem sys = ImcSystemsHolder.lookupSystem(srcIdNumber); if (sys != null && worker.getLogLabel().equalsIgnoreCase(sys.getName())) { EntityState est = (EntityState) msg; String entityName = EntitiesResolver.resolveName(worker.getLogLabel(), (int) msg.getSrcEnt()); if (entityName != null && LogsDownloaderWorker.CAMERA_CPU_LABEL.equalsIgnoreCase(entityName)) { String descStateCode = est.getDescription(); // Testing for active state code (also for the translated string) if (descStateCode != null && ("active".equalsIgnoreCase(descStateCode.trim()) || I18n.text("active").equalsIgnoreCase(descStateCode.trim()))) { cameraButton.setBackground(LogsDownloaderWorker.CAM_CPU_ON_COLOR); } else { cameraButton.setBackground(null); } } } } } }; }