List of usage examples for org.jfree.chart ChartPanel validate
public void validate()
From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java
/** * Gets and visualizes the chart of the Local Cluster Coefficient * Distribution/* www . j av a 2s . c o m*/ * * @param evt */ private void clusterDistributionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterDistributionButtonActionPerformed try { mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (jTextArea1.getText() == null) { throw new IllegalArgumentException("No file was chosen!\nPlease choose a valid .gml file"); } if (!jTextArea1.getText().contains(".gml")) { throw new IllegalArgumentException( "The chosen file doesn't have the right format!\nPlease choose a valid .gml file"); } distributionFrame.setVisible(false); distributionFrame = new JFrame(); scgc = new LocalClusterCoefficientSignalCollectGephiConnectorImpl(fileName); JFreeChart chart = scgc.createClusterDistributionChart(scgc.getClusterDistribution()); ChartPanel chartPanel = new ChartPanel(chart); Dimension dim = new Dimension(750, 450); distributionFrame.setMinimumSize(dim); chartPanel.setVisible(true); chartPanel.validate(); distributionFrame.add(chartPanel); distributionFrame.pack(); distributionFrame.setVisible(true); } catch (IllegalArgumentException exception) { messageFrame = new JFrame(); JOptionPane.showMessageDialog(messageFrame, exception.getMessage(), "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } catch (Exception exception) { messageFrame = new JFrame(); exception.printStackTrace(); JOptionPane.showMessageDialog(messageFrame, "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } finally { mainPanel.setCursor(Cursor.getDefaultCursor()); } }
From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java
/** * Gets and visualizes the chart of the Degree Distribution * * @param evt// ww w.j av a2 s. c om */ private void degreeDistributionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_degreeDistributionButtonActionPerformed try { mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (jTextArea1.getText() == null) { throw new IllegalArgumentException("No file was chosen!\nPlease choose a valid .gml file"); } if (!jTextArea1.getText().contains(".gml")) { throw new IllegalArgumentException( "The chosen file doesn't have the right format!\nPlease choose a valid .gml file"); } distributionFrame.setVisible(false); distributionFrame = new JFrame(); scgc = new DegreeSignalCollectGephiConnectorImpl(fileName); JFreeChart chart = scgc.createDegreeDistributionChart(scgc.getDegreeDistribution()); ChartPanel chartPanel = new ChartPanel(chart); Dimension dim = new Dimension(750, 450); distributionFrame.setMinimumSize(dim); distributionFrame.add(chartPanel); chartPanel.setVisible(true); chartPanel.validate(); distributionFrame.pack(); distributionFrame.setVisible(true); } catch (IllegalArgumentException exception) { messageFrame = new JFrame(); JOptionPane.showMessageDialog(messageFrame, exception.getMessage(), "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } catch (Exception exception) { messageFrame = new JFrame(); exception.printStackTrace(); JOptionPane.showMessageDialog(messageFrame, "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } finally { mainPanel.setCursor(Cursor.getDefaultCursor()); } }