List of usage examples for javax.swing JCheckBox setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JCheckBox getIntelCheckBox(String text) { JCheckBox box = new JCheckBox(text); box.setIcon(UIImages.EMPTY_BOX_ICON.getImageIcon()); box.setSelectedIcon(UIImages.CHECK_BOX_ICON.getImageIcon()); box.setBackground(Color.WHITE); return box;/*from www .j av a2 s.c o m*/ }
From source file:es.emergya.ui.plugins.LayerSelectionDialog.java
private void initOptions(final JPanel list) { SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() { @Override/*ww w.j a v a2s . co m*/ protected Object doInBackground() throws Exception { publish(new Object[0]); for (CapaInformacion ci : CapaConsultas.getAllOrderedByOrden()) { if (ci.getOpcional() && ci.getHabilitada()) { layers.add(new LayerElement(ci.getNombre(), ci.getUrl(), wasVisible(ci))); } } return null; } @Override protected void process(List<Object> chunks) { actualizando.setIcon(es.emergya.cliente.constants.LogicConstants.getIcon("anim_actualizando")); } @Override protected void done() { super.done(); actualizando.setIcon(null); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); for (LayerElement le : layers) { JCheckBox cb = new JCheckBox(le.name, le.active); cb.setBackground(Color.WHITE); cb.addActionListener(LayerSelectionDialog.this); list.add(cb); list.revalidate(); } // self.pack(); } }; sw.execute(); }
From source file:es.emergya.ui.gis.popups.ListaCapas.java
private void addCapa(final GpxLayer layer) { final JPanel capaP = new JPanel(); capaP.setOpaque(false);/*from www .java 2 s . com*/ layer.visible = true; mapView.addLayer(layer, false, capasActuales.size()); capasActuales.add(layer); capaP.setLayout(new BoxLayout(capaP, BoxLayout.X_AXIS)); final JCheckBox capa = new JCheckBox(layer.getAssociatedFile().getAbsolutePath()); capa.setSelected(layer.visible); capa.setBackground(Color.WHITE); capa.setToolTipText(i18n.getString("window.gpx.checkbox.show.tooltip")); capa.setActionCommand(layer.name); capa.addActionListener(this); capaP.add(capa); capaP.add(Box.createHorizontalGlue()); JButton eliminar = new JButton(LogicConstants.getIcon("button_delone")); eliminar.setToolTipText(i18n.getString("window.gpx.button.delete.tooltip")); eliminar.setBorderPainted(false); eliminar.setContentAreaFilled(false); capaP.add(eliminar); eliminar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mapView.removeLayer(layer); mapView.repaint(); capasGpx.remove(capaP); capasGpx.updateUI(); capasActuales.remove(layer); } }); capasGpx.add(capaP); capasGpx.updateUI(); }
From source file:com.sec.ose.osi.ui.frm.main.manage.ManagedProjectTableModel.java
public void setColumnType(JTable table) { table.setShowVerticalLines(false);// w w w . jav a 2 s . com table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setColumnSelectionAllowed(false); table.setRowSelectionAllowed(false); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setRowHeight(30); JTableHeader header = table.getTableHeader(); header.setPreferredSize(new java.awt.Dimension(table.getTableHeader().getWidth(), 30)); header.setFont(new Font("Arial", Font.BOLD, 12)); header.setReorderingAllowed(false); TableColumnModel cm = table.getColumnModel(); TableColumn col = null; analyzeHeader = new CheckBoxHeader(new CheckboxHeaderItemListener(table, COL_ANALYZE_TARGET), "Analyze Target"); col = cm.getColumn(COL_ANALYZE_TARGET); col.setHeaderRenderer(analyzeHeader); JCheckBox chkbox = new JCheckBox(); chkbox.setBackground(Color.white); chkbox.setHorizontalAlignment(JLabel.CENTER); col.setCellRenderer(new DefaultTableCellRenderer() { private static final long serialVersionUID = 1L; public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { ManagedProjectTableModel model = (ManagedProjectTableModel) table.getModel(); String sPrjName = (String) table.getValueAt(row, ManagedProjectTableModel.COL_PROJECT_NAME); OSIProjectInfo item = model.getProjectInfo(sPrjName); JCheckBox chkbox = new JCheckBox(); chkbox.setSelected(((Boolean) value).booleanValue()); if (item != null) { chkbox.setEnabled(item.isLocationValid()); } chkbox.setHorizontalAlignment(JLabel.CENTER); chkbox.setBackground(Color.white); return (Component) chkbox; } }); col.setCellEditor(new DefaultCellEditor(chkbox)); col = cm.getColumn(COL_ANALYZE_STATUS); col.setCellRenderer(new StatusIconCellRenderer()); col = cm.getColumn(COL_SOURCE_LOCATION); col.setCellRenderer(new FileBrowseCellRenderer()); col.setCellEditor(new FileBrowseCellEditor()); }
From source file:utilities.GraphViewer.java
public void addSensor(String fichier) { // ajouter le graphe ajouterFichier(fichier);//from ww w.jav a 2s . c om // this.paneGraphe.add(graphe()); graphe.revalidate(); db.add(this.getSensorName(fichier), fichier); // ajouter un element a la list JCheckBox chckbxNewCheckBox = new JCheckBox(this.getSensorName(fichier)); this.sensors.add(chckbxNewCheckBox); this.sensors1.add(chckbxNewCheckBox); chckbxNewCheckBox.setBackground(new Color(200, 200, 255)); chckbxNewCheckBox.setBorder(new LineBorder(Color.BLACK)); chckbxNewCheckBox.setSelected(true); chckbxNewCheckBox.addActionListener(this); JLabel l = new JLabel(" "); l.setPreferredSize(new Dimension(50, 5)); this.sensorsList.add(l); this.sensorsList.add(chckbxNewCheckBox); this.sensorsList.validate(); }
From source file:org.jfree.chart.demo.Bottom_panel.java
/** * Create the panel.//from www. ja v a 2s. c o m */ public Bottom_panel(ArrayList<Graphic> Grafs, ArrayList<XYSeries> series, int x, int y, int width, int height) { graf = Grafs.get(8); serie = series; setBounds(x, y, width, height); setLayout(new GridLayout(0, 4, 2, 0)); final JCheckBox chckbxNewCheckBox_5 = new JCheckBox("Graph 1"); chckbxNewCheckBox_5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { XYSeries sr = serie.get(0); if (chckbxNewCheckBox_5.isSelected() == true) { graf.change_data(serie.get(0), true); } else { graf.change_data(serie.get(0), false); } } }); chckbxNewCheckBox_5.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox_5); final JCheckBox chckbxNewCheckBox_1 = new JCheckBox("Graph2"); chckbxNewCheckBox_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { XYSeries sr = serie.get(1); if (chckbxNewCheckBox_1.isSelected() == true) { graf.change_data(serie.get(1), true); } else { graf.change_data(serie.get(1), false); } } }); chckbxNewCheckBox_1.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox_1); final JCheckBox chckbxNewCheckBox_2 = new JCheckBox("Graph 3"); chckbxNewCheckBox_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { XYSeries sr = serie.get(2); if (chckbxNewCheckBox_2.isSelected() == true) { graf.change_data(serie.get(2), true); } else { graf.change_data(serie.get(2), false); } } }); chckbxNewCheckBox_2.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox_2); final JCheckBox chckbxNewCheckBox = new JCheckBox("Graph 4"); chckbxNewCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { XYSeries sr = serie.get(3); if (chckbxNewCheckBox.isSelected() == true) { graf.change_data(serie.get(3), true); } else { graf.change_data(serie.get(3), false); } } }); chckbxNewCheckBox.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox); final JCheckBox chckbxNewCheckBox_3 = new JCheckBox("Graph 5"); chckbxNewCheckBox_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { XYSeries sr = serie.get(4); if (chckbxNewCheckBox_3.isSelected() == true) { graf.change_data(serie.get(4), true); } else { graf.change_data(serie.get(4), false); } } }); chckbxNewCheckBox_3.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox_3); final JCheckBox chckbxNewCheckBox_4 = new JCheckBox("Graph 6"); chckbxNewCheckBox_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { XYSeries sr = serie.get(5); if (chckbxNewCheckBox_4.isSelected() == true) { graf.change_data(serie.get(5), true); } else { graf.change_data(serie.get(5), false); } } }); chckbxNewCheckBox_4.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox_4); final JCheckBox chckbxNewCheckBox_6 = new JCheckBox("Graph 7"); chckbxNewCheckBox_6.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { XYSeries sr = serie.get(6); if (chckbxNewCheckBox_6.isSelected() == true) { graf.change_data(serie.get(6), true); } else { graf.change_data(serie.get(6), false); } } }); chckbxNewCheckBox_6.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox_6); final JCheckBox chckbxNewCheckBox_7 = new JCheckBox("Graph 8"); chckbxNewCheckBox_7.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { XYSeries sr = serie.get(7); if (chckbxNewCheckBox_6.isSelected() == true) { graf.change_data(serie.get(7), true); } else { graf.change_data(serie.get(7), false); } } }); chckbxNewCheckBox_7.setBackground(new Color(176, 199, 246)); add(chckbxNewCheckBox_7); }
From source file:greenfoot.gui.export.ExportPublishPane.java
/** * Creates the tag display with popular tags and an option to add tags *///from ww w . j av a2s . co m private JComponent getTagDisplay() { JComponent tagPanel = new JPanel(new MiksGridLayout(3, 1, 8, 8)); { tagPanel.setBackground(background); JComponent popPanel = new JPanel(new MiksGridLayout(8, 1, 8, 0)); popPanel.setBackground(background); JLabel popLabel = new JLabel(Config.getString("export.publish.tags.popular"), SwingConstants.LEADING); popLabel.setFont(font); popPanel.add(popLabel); for (int i = 0; i < popTags.length; i++) { JCheckBox popTag = new JCheckBox(Config.getString("export.publish.tags.loading")); popTag.setBackground(background); popTag.setFont(font); popTag.setEnabled(false); popTags[i] = popTag; popPanel.add(popTag); } tagPanel.add(popPanel); Box textPanel = new Box(BoxLayout.Y_AXIS); { JLabel additionalLabel = new JLabel(Config.getString("export.publish.tags.additional1"), SwingConstants.LEADING); additionalLabel.setFont(font); textPanel.add(additionalLabel); JLabel additionalLabel2 = new JLabel(Config.getString("export.publish.tags.additional2"), SwingConstants.CENTER); additionalLabel2.setFont(font); textPanel.add(additionalLabel2); } tagPanel.add(textPanel); tagArea = new JTextArea(); tagArea.setRows(3); JScrollPane tagScroller = new JScrollPane(tagArea); tagPanel.add(tagScroller); } return tagPanel; }
From source file:logdruid.ui.chart.GraphPanel.java
public void load(JPanel panel_2) { startDateJSpinner = (JSpinner) panel_2.getComponent(2); endDateJSPinner = (JSpinner) panel_2.getComponent(3); // scrollPane.setV panel.removeAll();// ww w .ja v a2 s . c o m Dimension panelSize = this.getSize(); add(scrollPane, BorderLayout.CENTER); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); // scrollPane.set trying to replace scroll where it was JCheckBox relativeCheckBox = (JCheckBox) panel_2.getComponent(5); estimatedTime = System.currentTimeMillis() - startTime; logger.info("gathering time: " + estimatedTime); startTime = System.currentTimeMillis(); // Map<Source, Map<String, MineResult>> Map<Source, Map<String, MineResult>> treeMap = new TreeMap<Source, Map<String, MineResult>>( mineResultSet.mineResults); Iterator mineResultSetIterator = treeMap.entrySet().iterator(); int ite = 0; logger.debug("mineResultSet size: " + mineResultSet.mineResults.size()); while (mineResultSetIterator.hasNext()) { final Map.Entry pairs = (Map.Entry) mineResultSetIterator.next(); logger.debug("mineResultSet key/source: " + ((Source) pairs.getKey()).getSourceName()); JCheckBox checkBox = (JCheckBox) panel_1.getComponent(ite++); logger.debug("checkbox: " + checkBox.getText() + ", " + checkBox.isSelected()); if (checkBox.isSelected()) { Map mrArrayList = (Map<String, MineResult>) pairs.getValue(); ArrayList<String> mineResultGroup = new ArrayList<String>(); Set<String> mrss = mrArrayList.keySet(); mineResultGroup.addAll(mrss); Collections.sort(mineResultGroup, new AlphanumComparator()); Iterator mrArrayListIterator = mineResultGroup.iterator(); while (mrArrayListIterator.hasNext()) { String key = (String) mrArrayListIterator.next(); logger.debug(key); final MineResult mr = (MineResult) mrArrayList.get(key); Map<String, ExtendedTimeSeries> statMap = mr.getStatTimeseriesMap(); Map<String, ExtendedTimeSeries> eventMap = mr.getEventTimeseriesMap(); // logger.info("mineResultSet hash size: " // +mr.getTimeseriesMap().size()); // logger.info("mineResultSet hash content: " + // mr.getStatTimeseriesMap()); logger.debug("mineResultSet mr.getStartDate(): " + mr.getStartDate() + " mineResultSet mr.getEndDate(): " + mr.getEndDate()); logger.debug("mineResultSet (Date)jsp.getValue(): " + (Date) startDateJSpinner.getValue()); logger.debug("mineResultSet (Date)jsp2.getValue(): " + (Date) endDateJSPinner.getValue()); if (mr.getStartDate() != null && mr.getEndDate() != null) { if ((mr.getStartDate().before((Date) endDateJSPinner.getValue())) && (mr.getEndDate().after((Date) startDateJSpinner.getValue()))) { ArrayList<String> mineResultGroup2 = new ArrayList<String>(); Set<String> mrss2 = statMap.keySet(); mineResultGroup2.addAll(mrss2); Collections.sort(mineResultGroup2, new AlphanumComparator()); Iterator statMapIterator = mineResultGroup2.iterator(); // Iterator statMapIterator = statMap.entrySet().iterator(); if (!statMap.entrySet().isEmpty() || !eventMap.entrySet().isEmpty()) { JPanel checkboxPanel = new JPanel(new WrapLayout()); checkboxPanel.setBackground(Color.white); int count = 1; chart = ChartFactory.createXYAreaChart(// Title mr.getSourceID() + " " + mr.getGroup(), // + null, // X-Axis // label null, // Y-Axis label null, // Dataset PlotOrientation.VERTICAL, false, // Show // legend true, // tooltips false // url ); TextTitle my_Chart_title = new TextTitle(mr.getSourceID() + " " + mr.getGroup(), new Font("Verdana", Font.BOLD, 17)); chart.setTitle(my_Chart_title); XYPlot plot = (XYPlot) chart.getPlot(); ValueAxis range = plot.getRangeAxis(); range.setVisible(false); final DateAxis domainAxis1 = new DateAxis(); domainAxis1.setTickLabelsVisible(true); // domainAxis1.setTickMarksVisible(true); logger.debug("getRange: " + domainAxis1.getRange()); if (relativeCheckBox.isSelected()) { domainAxis1.setRange((Date) startDateJSpinner.getValue(), (Date) endDateJSPinner.getValue()); } else { Date startDate = mr.getStartDate(); Date endDate = mr.getEndDate(); if (mr.getStartDate().before((Date) startDateJSpinner.getValue())) { startDate = (Date) startDateJSpinner.getValue(); logger.debug("setMinimumDate: " + (Date) startDateJSpinner.getValue()); } if (mr.getEndDate().after((Date) endDateJSPinner.getValue())) { endDate = (Date) endDateJSPinner.getValue(); logger.debug("setMaximumDate: " + (Date) endDateJSPinner.getValue()); } if (startDate.before(endDate)) { domainAxis1.setRange(startDate, endDate); } } XYToolTipGenerator tt1 = new XYToolTipGenerator() { public String generateToolTip(XYDataset dataset, int series, int item) { StringBuffer sb = new StringBuffer(); String htmlStr = "<html>"; Number x; FastDateFormat sdf = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss"); x = dataset.getX(series, item); sb.append(htmlStr); if (x != null) { sb.append("<p style='color:#000000;'>" + (sdf.format(x)) + "</p>"); sb.append("<p style='color:#000000;'>" + dataset.getSeriesKey(series).toString() + ": " + form.format(dataset.getYValue(0, item)) + "</p>"); if (mr.getFileLineForDate(new Date(x.longValue()), dataset.getSeriesKey(series).toString()) != null) { sb.append( "<p style='color:#0000FF;'>" + cd.sourceFileArrayListMap .get(pairs.getKey()).get(mr .getFileLineForDate( new Date(x.longValue()), dataset.getSeriesKey(series) .toString()) .getFileId()) .getFile().getName() + ":" + mr.getFileLineForDate(new Date(x.longValue()), dataset.getSeriesKey(series).toString()) .getLineNumber() + "</p>"); } } return sb.toString(); } }; while (statMapIterator.hasNext()) { TimeSeriesCollection dataset = new TimeSeriesCollection(); String me = (String) statMapIterator.next(); ExtendedTimeSeries ts = (ExtendedTimeSeries) statMap.get(me); // logger.info(((TimeSeries) // me.getValue()).getMaxY()); if (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY() > 0) dataset.addSeries(ts.getTimeSeries()); logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me + " nb records: " + ((ExtendedTimeSeries) statMap.get(me)) .getTimeSeries().getItemCount()); logger.debug("(((TimeSeries) me.getValue()).getMaxY(): " + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY())); logger.debug("(((TimeSeries) me.getValue()).getMinY(): " + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY())); XYPlot plot1 = chart.getXYPlot(); // LogarithmicAxis axis4 = new LogarithmicAxis(me.toString()); NumberAxis axis4 = new NumberAxis(me.toString()); axis4.setAutoRange(true); axis4.setAxisLineVisible(true); axis4.setAutoRangeIncludesZero(false); plot1.setDomainCrosshairVisible(true); plot1.setRangeCrosshairVisible(true); axis4.setRange(new Range( ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY(), ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY())); axis4.setLabelPaint(colors[count]); axis4.setTickLabelPaint(colors[count]); plot1.setRangeAxis(count, axis4); final ValueAxis domainAxis = domainAxis1; domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot1.setDomainAxis(domainAxis); plot1.setForegroundAlpha(0.5f); plot1.setDataset(count, dataset); plot1.mapDatasetToRangeAxis(count, count); final XYAreaRenderer renderer = new XYAreaRenderer(); // XYAreaRenderer2 // also // nice if ((((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY() - ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries() .getMinY()) > 0) { // renderer.setToolTipGenerator(new // StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,new // FastDateFormat("d-MMM-yyyy HH:mm:ss"), // new DecimalFormat("#,##0.00"))); } renderer.setSeriesPaint(0, colors[count]); renderer.setSeriesVisible(0, true); renderer.setSeriesToolTipGenerator(0, tt1); plot1.setRenderer(count, renderer); int hits = 0; // ts.getStat()[1] int matchs = 0; if (((ExtendedTimeSeries) statMap.get(me)).getStat() != null) { hits = ((ExtendedTimeSeries) statMap.get(me)).getStat()[1]; // matchs= ((ExtendedTimeSeries) statMap.get(me)).getStat()[0]; } JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4, me.toString() + "(" + hits + ")", 0)); Boolean selected = true; jcb.setSelected(true); jcb.setBackground(Color.white); jcb.setBorderPainted(true); jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true)); jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize())); checkboxPanel.add(jcb); count++; } Iterator eventMapIterator = eventMap.entrySet().iterator(); while (eventMapIterator.hasNext()) { // HistogramDataset histoDataSet=new HistogramDataset(); TimeSeriesCollection dataset = new TimeSeriesCollection(); Map.Entry me = (Map.Entry) eventMapIterator.next(); // if (dataset.getEndXValue(series, item)) if (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY() > 0) dataset.addSeries(((ExtendedTimeSeries) me.getValue()).getTimeSeries()); logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me.getKey() + " nb records: " + ((ExtendedTimeSeries) me.getValue()).getTimeSeries().getItemCount()); logger.debug("mineResultSet hash content: " + mr.getEventTimeseriesMap()); logger.debug("(((TimeSeries) me.getValue()).getMaxY(): " + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY())); logger.debug("(((TimeSeries) me.getValue()).getMinY(): " + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMinY())); XYPlot plot2 = chart.getXYPlot(); // LogarithmicAxis axis4 = new LogarithmicAxis(me.toString()); NumberAxis axis4 = new NumberAxis(me.getKey().toString()); axis4.setAutoRange(true); // axis4.setInverted(true); axis4.setAxisLineVisible(true); axis4.setAutoRangeIncludesZero(true); // axis4.setRange(new Range(((TimeSeries) // axis4.setRange(new Range(((TimeSeries) // me.getValue()).getMinY(), ((TimeSeries) // me.getValue()).getMaxY())); axis4.setLabelPaint(colors[count]); axis4.setTickLabelPaint(colors[count]); plot2.setRangeAxis(count, axis4); final ValueAxis domainAxis = domainAxis1; // domainAxis.setLowerMargin(0.001); // domainAxis.setUpperMargin(0.0); plot2.setDomainCrosshairVisible(true); plot2.setRangeCrosshairVisible(true); //plot2.setRangeCrosshairLockedOnData(true); plot2.setDomainAxis(domainAxis); plot2.setForegroundAlpha(0.5f); plot2.setDataset(count, dataset); plot2.mapDatasetToRangeAxis(count, count); XYBarRenderer rend = new XYBarRenderer(); // XYErrorRenderer rend.setShadowVisible(false); rend.setDrawBarOutline(true); Stroke stroke = new BasicStroke(5); rend.setBaseStroke(stroke); final XYItemRenderer renderer = rend; renderer.setSeriesToolTipGenerator(0, tt1); // renderer.setItemLabelsVisible(true); renderer.setSeriesPaint(0, colors[count]); renderer.setSeriesVisible(0, true); plot2.setRenderer(count, renderer); int hits = 0; int matchs = 0; if (((ExtendedTimeSeries) me.getValue()).getStat() != null) { hits = ((ExtendedTimeSeries) me.getValue()).getStat()[1]; // matchs= ((ExtendedTimeSeries) me.getValue()).getStat()[0]; } JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4, me.getKey().toString() + "(" + hits + ")", 0)); jcb.setSelected(true); jcb.setBackground(Color.white); jcb.setBorderPainted(true); jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true)); jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize())); checkboxPanel.add(jcb); count++; } JPanel pan = new JPanel(); pan.setLayout(new BorderLayout()); pan.setPreferredSize(new Dimension(600, Integer.parseInt((String) Preferences.getPreference("chartSize")))); // pan.setPreferredSize(panelSize); panel.add(pan); final ChartPanel cpanel = new ChartPanel(chart); cpanel.setMinimumDrawWidth(0); cpanel.setMinimumDrawHeight(0); cpanel.setMaximumDrawWidth(1920); cpanel.setMaximumDrawHeight(1200); // cpanel.setInitialDelay(0); cpanel.setDismissDelay(9999999); cpanel.setInitialDelay(50); cpanel.setReshowDelay(200); cpanel.setPreferredSize(new Dimension(600, 350)); // cpanel.restoreAutoBounds(); fix the tooltip // missing problem but then relative display is // broken panel.add(new JSeparator(SwingConstants.HORIZONTAL)); pan.add(cpanel, BorderLayout.CENTER); // checkboxPanel.setPreferredSize(new Dimension(600, // 0)); cpanel.addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent chartmouseevent) { // chartmouseevent.getEntity(). ChartEntity entity = chartmouseevent.getEntity(); if (entity instanceof XYItemEntity) { XYItemEntity item = ((XYItemEntity) entity); if (item.getDataset() instanceof TimeSeriesCollection) { TimeSeriesCollection data = (TimeSeriesCollection) item .getDataset(); TimeSeries series = data.getSeries(item.getSeriesIndex()); TimeSeriesDataItem dataitem = series.getDataItem(item.getItem()); // logger.info(" Serie: "+series.getKey().toString() // + // " Period : "+dataitem.getPeriod().toString()); // mr.getFileForDate(new Date // (x.longValue()) ; int x = chartmouseevent.getTrigger().getX(); // logger.info(mr.getFileForDate(dataitem.getPeriod().getEnd())); int y = chartmouseevent.getTrigger().getY(); String myString = ""; if (dataitem.getPeriod() != null) { logger.info(dataitem.getPeriod().getEnd()); // myString = mr.getFileForDate(dataitem.getPeriod().getEnd()).toString(); String lineString = "" + mr.getFileLineForDate(dataitem.getPeriod().getEnd(), item.getDataset() .getSeriesKey(item.getSeriesIndex()) .toString()) .getLineNumber(); String fileString = cd.sourceFileArrayListMap .get(pairs.getKey()) .get(mr.getFileLineForDate( dataitem.getPeriod().getEnd(), item.getDataset() .getSeriesKey(item.getSeriesIndex()) .toString()) .getFileId()) .getFile().getAbsolutePath(); String command = Preferences.getPreference("editorCommand"); command = command.replace("$line", lineString); command = command.replace("$file", fileString); logger.info(command); Runtime rt = Runtime.getRuntime(); try { rt.exec(command); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } StringSelection stringSelection = new StringSelection( fileString); Clipboard clpbrd = Toolkit.getDefaultToolkit() .getSystemClipboard(); clpbrd.setContents(stringSelection, null); // cpanel.getGraphics().drawString("file name copied", x - 5, y - 5); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch // block e.printStackTrace(); } } // logger.info(mr.getFileForDate(dataitem.getPeriod().getStart())); } } } public void chartMouseMoved(ChartMouseEvent e) { } }); pan.add(checkboxPanel, BorderLayout.SOUTH); } } } else { logger.debug("mr dates null: " + mr.getGroup() + mr.getSourceID() + mr.getLogFiles()); } } } } // Map=miner.mine(sourceFiles,repo); estimatedTime = System.currentTimeMillis() - startTime; revalidate(); logger.info("display time: " + estimatedTime); }
From source file:org.forester.archaeopteryx.ControlPanel.java
void addJCheckBox(final JCheckBox jcb, final JPanel p) { jcb.setFocusPainted(false);/*from w w w .j a v a 2 s .c o m*/ jcb.setFont(ControlPanel.jcb_font); if (!_configuration.isUseNativeUI()) { jcb.setBackground(ControlPanel.jcb_background_color); jcb.setForeground(ControlPanel.jcb_text_color); } p.add(jcb, "Center"); jcb.addActionListener(this); }
From source file:org.forester.archaeopteryx.ControlPanel.java
void addSecondLevelJCheckBox(final JCheckBox jcb, final JPanel p) { jcb.setFocusPainted(false);//from w w w.jav a 2 s . c o m jcb.setFont(ControlPanel.jcb_font); if (!_configuration.isUseNativeUI()) { jcb.setBackground(ControlPanel.jcb_background_color); jcb.setForeground(ControlPanel.jcb_text_color); } Box box = Box.createHorizontalBox(); p.setBackground(background_color); box.add(Box.createRigidArea(new Dimension(12, 0))); jcb.setVisible(_color_branches_cb.isSelected()); box.add(jcb); p.add(box, "Center"); jcb.addActionListener(this); }