List of usage examples for javax.swing JPanel updateUI
public void updateUI()
From source file:logica_controladores.controlador_estadistica.java
public static void grafica_reorden(JPanel panel_grafica_orden, Inventario inventario, JLabel lbLinea) { XYSeries serie_2 = null;/*from w w w. jav a 2 s.co m*/ XYDataset datos; JFreeChart linea; serie_2 = new XYSeries("graficas relacion gastos-reorden"); for (int i = 0; i < inventario.getGastos().size(); i++) { serie_2.add(inventario.getGastos().get(i).getReorden(), inventario.getGastos().get(i).getGastos()); } datos = new XYSeriesCollection(serie_2); linea = ChartFactory.createXYLineChart("grafica representativa de reordenes por corrida", "punto de orden", "gastos", datos, PlotOrientation.VERTICAL, true, true, true); BufferedImage graficoLinea = linea.createBufferedImage(panel_grafica_orden.getWidth(), panel_grafica_orden.getHeight()); lbLinea.setSize(panel_grafica_orden.getSize()); lbLinea.setIcon(new ImageIcon(graficoLinea)); panel_grafica_orden.updateUI(); }
From source file:graficarordenamiento.Graficador.java
public void obtenerGrafico(JPanel p) { // Crear el Panel del Grafico con ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setDisplayToolTips(true); chartPanel.setFillZoomRectangle(true); p.add(chartPanel);//from w w w. j a v a 2s . c om p.updateUI(); }
From source file:PRC6.Graficos.java
public void PieGraphF(ArrayList<Float> d, int pos, String s, String y, javax.swing.JPanel Pan, String p) { Pan.removeAll();// w w w.j av a 2s.co m // Fuente de Datos DefaultPieDataset data = new DefaultPieDataset(); int tmp = 0; for (int i = pos; i <= pos + 11; i++) { tmp += 1; data.setValue("Mes " + tmp + ": " + d.get(i) + " ", d.get(i)); } // Creando el Grafico JFreeChart chart = ChartFactory.createPieChart("Grfico de " + s + " para el ao " + y + " en " + p, data, true, true, false); // Mostrar Grafico //ChartFrame frame = new ChartFrame("JFreeChart", chart); ChartPanel panel = new ChartPanel(chart); panel.setBounds(5, 5, 450, 400); panel.repaint(); Pan.add(panel); Pan.updateUI(); //frame.pack(); //frame.setVisible(true); }
From source file:PRC6.Graficos.java
public void PieGraphI(ArrayList<Integer> d, int pos, String s, String y, javax.swing.JPanel Pan, String p) { Pan.removeAll();/*from w ww.j ava 2 s. c o m*/ //System.out.println("Estoy EN PIEGRAPH"); // Fuente de Datos DefaultPieDataset data = new DefaultPieDataset(); int tmp = 0; for (int i = pos; i <= pos + 11; i++) { tmp += 1; data.setValue("Mes " + tmp + ": " + d.get(i) + " ", d.get(i)); //data.setValue(d.get(pos), 45); //data.setValue("Python", 15); } // Creando el Grafico JFreeChart chart = ChartFactory.createPieChart("Grfico de " + s + " para el ao " + y + " en " + p, data, true, true, false); // Mostrar Grafico ChartPanel panel = new ChartPanel(chart); panel.setBounds(5, 5, 450, 400); panel.repaint(); Pan.add(panel); Pan.updateUI(); }
From source file:logica_controladores.controlador_estadistica.java
public static void grafica_orden(JPanel panel_grafica_orden, Inventario inventario, JLabel lbLinea) { XYSeries serie = null;//from w ww.j av a2s . com XYSeries serie_2 = null; JFreeChart linea; serie = new XYSeries("graficas relacion gastos-orden"); Gasto gasto_minimo = valor_minimo(inventario); Gasto gasto_max = valor_maximo(inventario); for (int i = 0; i < inventario.getGastos().size(); i = i + inventario.getReorden_max()) { serie.add(inventario.getGastos().get(i).getOrden_inicial(), inventario.getGastos().get(i).getGastos()); } serie_2 = new XYSeries("graficas relacion gastos-reorden"); for (int i = 0; i < inventario.getGastos().size(); i = i + inventario.getOrden_max()) { serie_2.add(inventario.getGastos().get(i).getReorden(), inventario.getGastos().get(i).getGastos()); } final XYSeriesCollection datos = new XYSeriesCollection(); datos.addSeries(serie); datos.addSeries(serie_2); linea = ChartFactory.createXYLineChart( "grafica representativa de ordenes por corrida, gasto_minimo(orden: " + gasto_minimo.getOrden_inicial() + "reorden: " + gasto_minimo.getReorden() + ")= " + gasto_minimo.getGastos(), "rango", "gastos", datos, PlotOrientation.VERTICAL, true, true, true); final XYPlot plot = (XYPlot) linea.getPlot(); final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); configurarDomainAxis(domainAxis, inventario); configurarRangeAxis(rangeAxis, gasto_minimo.getGastos(), gasto_max.getGastos()); BufferedImage graficoLinea = linea.createBufferedImage(600, 280); lbLinea.setSize(panel_grafica_orden.getSize()); lbLinea.setIcon(new ImageIcon(graficoLinea)); panel_grafica_orden.updateUI(); }
From source file:st.jigasoft.dbutil.view.DUReport.java
/** * Adicionar coponetes a um dado panel//from w ww . ja v a 2 s. co m * @param panel * @param chartPanels */ private void addComponestesAt(JPanel panel, JComponent... chartPanels) { panel.removeAll(); if (chartPanels == null) return; for (JComponent component : chartPanels) if (component != null) { panel.add(component); panel.updateUI(); } }
From source file:gui.MainGUI.java
public void updateKnowledgeGraph(RealAgent agent[]) { graphPanel.removeAll();/*from w w w .j ava2s . c om*/ JFreeChart chart = createKnowledgeChart(agent); JPanel chartPanel = new ChartPanel(chart); graphPanel.setLayout(new GridLayout(1, 1)); graphPanel.add(chartPanel); graphPanel.getParent().validate(); chartPanel.updateUI(); }
From source file:Componentes.TermometroMax.java
@Override public void pintar(javax.swing.JPanel p, int pos) { p.removeAll();// w w w .j a v a 2 s . c om DefaultValueDataset data = new DefaultValueDataset(new Double(ventana.getGraphdata().getTmax())); ThermometerPlot plot = new ThermometerPlot(data); chart = new JFreeChart("Temperatura Maxima, \nMES: " + Calculos.get_mes(ventana.getMonthdata().getdata()), // chart title JFreeChart.DEFAULT_TITLE_FONT, plot, // plot false); Color Darkorange = new Color(255, 140, 0); Color Crimson = new Color(220, 20, 60); Color Aquamarine = new Color(127, 255, 212); Color Darkslategray = new Color(47, 79, 79); plot.setMercuryPaint(Aquamarine); plot.setSubrange(NORMAL, 0, 10); plot.setSubrange(WARNING, 10.1, 20); plot.setSubrange(CRITICAL, 20.1, 50); plot.setSubrangePaint(NORMAL, Aquamarine); plot.setSubrangePaint(WARNING, Darkorange); plot.setSubrangePaint(CRITICAL, Crimson); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setThermometerPaint(Darkslategray); plot.setDisplayRange(5, Calculos.get_min(datos.getTmax()), Calculos.get_max(datos.getTmax())); plot.setRange(Calculos.get_min(datos.getTmax()), Calculos.get_max(datos.getTmax())); panel = new ChartPanel(chart); panel.setBounds(5, 5, 300, 300); panel.repaint(); p.add(panel); // jPanel1.repaint(); p.updateUI(); // aoIndex=aoAux; ///aoAux = 0; }
From source file:Componentes.TermometroMin.java
@Override public void pintar(javax.swing.JPanel p, int pos) { p.removeAll();//from w w w . j av a 2 s . co m DefaultValueDataset data = new DefaultValueDataset(new Double(ventana.getGraphdata().getTmin())); ThermometerPlot plot = new ThermometerPlot(data); chart = new JFreeChart("Temperatura Mnima, \nMES: " + Calculos.get_mes(ventana.getMonthdata().getdata()), // chart title JFreeChart.DEFAULT_TITLE_FONT, plot, // plot false); Color Darkorange = new Color(255, 140, 0); Color Crimson = new Color(220, 20, 60); Color Aquamarine = new Color(127, 255, 212); Color Darkslategray = new Color(47, 79, 79); plot.setMercuryPaint(Aquamarine); plot.setSubrange(NORMAL, 0, 2.5); plot.setSubrange(WARNING, 2.6, 7.5); plot.setSubrange(CRITICAL, 7.6, 20); plot.setSubrangePaint(NORMAL, Aquamarine); plot.setSubrangePaint(WARNING, Darkorange); plot.setSubrangePaint(CRITICAL, Crimson); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setThermometerPaint(Darkslategray); plot.setDisplayRange(2, Calculos.get_min(datos.getTmin()), Calculos.get_max(datos.getTmin())); plot.setRange(Calculos.get_min(datos.getTmin()), Calculos.get_max(datos.getTmin())); panel = new ChartPanel(chart); panel.setBounds(5, 5, 300, 300); panel.repaint(); p.add(panel); // jPanel1.repaint(); p.updateUI(); // aoIndex=aoAux; ///aoAux = 0; }
From source file:org.fhcrc.cpl.viewer.gui.MRMDialog.java
/** * Draw a chart in a panel. Good for precursors and daughters * @param parentPanel/*from w ww . j ava2 s . c o m*/ * @param dataset * @param domainMin * @param domainMax * @param supplier * @param wg */ protected void createChartInPanel(JPanel parentPanel, XYSeriesCollection dataset, Double domainMin, Double domainMax, DrawingSupplier supplier, whichGraph wg) { if (precursorChromatogramEmpty(transitionOnPlot) && wg == whichGraph.Precursor) { precursorContainerContainerPanel.setVisible(false); if (this.getWidth() >= 100 && this.getHeight() >= 100) this.setPreferredSize(new Dimension(this.getWidth(), this.getHeight())); pack(); return; } switch (wg) { case Precursor: clearPreviousChartJunk(oldPrecursorChart); oldPrecursorChart = null; break; case Daughter: clearPreviousChartJunk(oldProductChart); oldProductChart = null; break; } JFreeChart chart = ChartFactory.createXYLineChart(null, "seconds", null, dataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(new Color(220, 220, 220)); XYPlot xyp = (XYPlot) (chart.getPlot()); xyp.setBackgroundPaint(Color.WHITE); xyp.setDomainGridlinesVisible(true); xyp.setRangeGridlinesVisible(true); xyp.setDomainGridlinePaint(Color.LIGHT_GRAY); xyp.setRangeGridlinePaint(Color.LIGHT_GRAY); if (supplier != null) { xyp.setDrawingSupplier(supplier); } else { xyp.setDrawingSupplier(Utils.plainDrawingSupplier(Color.LIGHT_GRAY)); } xyp.setSeriesRenderingOrder(SeriesRenderingOrder.REVERSE); CenterZoomNumberAxis axisDomain = new CenterZoomNumberAxis("seconds"); axisDomain.setAutoRangeIncludesZero(false); axisDomain.setRange(Math.max(0.0, domainMin), domainMax); axisDomain.addChangeListener(new domainAxisZoomCoordinator(axisDomain)); xyp.clearAnnotations(); xyp.setDomainAxis(axisDomain); xyp.getDomainAxis().setAutoRange(false); xyp.getRangeAxis().setAutoRange(false); XYLineAndShapeRenderer xylsr = (XYLineAndShapeRenderer) xyp.getRenderer(); xylsr.setLegendLine(Utils.legendThing(16, 6)); xylsr.setShapesFilled(true); xylsr.setBaseShapesFilled(true); PanelWithChart panelWithChart = new PanelWithChart(chart); ChartPanel cp = panelWithChart.getChartPanel(); cp.removeMouseListener(cp); cp.removeMouseMotionListener(cp); if (peaksTable != null) { MRMerMouseListener mml = new MRMerMouseListener(cp, (PeaksTableModel) peaksTable.getModel()); cp.addMouseListener(mml); cp.addMouseMotionListener(mml); } cp.setPreferredSize(new Dimension(parentPanel.getWidth(), parentPanel.getHeight() - 10)); cp.setDomainZoomable(true); cp.setRangeZoomable(false); cp.setPopupMenu(null); parentPanel.removeAll(); parentPanel.add(panelWithChart); switch (wg) { case Precursor: createChartInPanelPrecursorTasksOnly(xyp); oldPrecursorChart = xyp; break; case Daughter: createChartInPanelDaughterTasksOnly(xyp); oldProductChart = xyp; break; } parentPanel.updateUI(); listTransition.requestFocus(); }