List of usage examples for javax.swing JFrame setContentPane
@BeanProperty(bound = false, hidden = true, description = "The client area of the frame where child components are normally inserted.") public void setContentPane(Container contentPane)
contentPane
property. From source file:umontreal.iro.lecuyer.charts.EmpiricalChart.java
/** * Displays chart on the screen using Swing. * This method creates an application containing a chart panel displaying * the chart. The created frame is positioned on-screen, and displayed before * it is returned. The <TT>width</TT> and the <TT>height</TT> * of the chart are measured in pixels. * //from w ww . j av a 2 s . co m * @param width frame width in pixels. * * @param height frame height in pixels. * * @return frame containing the chart. * */ public JFrame view(int width, int height) { JFrame myFrame; if (chart.getTitle() != null) myFrame = new JFrame("EmpiricalChart from SSJ : " + chart.getTitle().getText()); else myFrame = new JFrame("EmpiricalChart from SSJ"); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(width, height)); myFrame.setContentPane(chartPanel); myFrame.pack(); myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); myFrame.setLocationRelativeTo(null); myFrame.setVisible(true); return myFrame; }
From source file:anslab2.AnsLab2.java
public void generateVerticalBarGraph() { JFreeChart barChart = ChartFactory.createBarChart(category + " chart", "Category", "", createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(barChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); JFrame l = new JFrame(); l.setContentPane(chartPanel); l.setSize(400, 400);/*from w w w . j ava 2 s.c o m*/ l.setVisible(true); }
From source file:anslab2.AnsLab2.java
public void generateHorizontalBarGraph() { JFreeChart barChart = ChartFactory.createBarChart(category + " chart", "Category", "", createDataset(), PlotOrientation.HORIZONTAL, true, true, false); ChartPanel chartPanel = new ChartPanel(barChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); JFrame l = new JFrame(); l.setContentPane(chartPanel); l.setSize(400, 400);//from w ww.ja v a 2 s . c o m l.setVisible(true); }
From source file:umontreal.iro.lecuyer.charts.HistogramChart.java
/** * Displays chart on the screen using Swing. * This method creates an application containing a chart panel displaying * the chart. The created frame is positioned on-screen, and displayed before * it is returned. The <TT>width</TT> and the <TT>height</TT> * of the chart are measured in pixels. * //from w w w. ja v a 2 s. co m * @param width frame width in pixels. * * @param height frame height in pixels. * * @return frame containing the chart. * */ public JFrame view(int width, int height) { JFrame myFrame; if (chart.getTitle() != null) myFrame = new JFrame("HistogramChart from SSJ: " + chart.getTitle().getText()); else myFrame = new JFrame("HistogramChart from SSJ"); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(width, height)); myFrame.setContentPane(chartPanel); myFrame.pack(); myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); myFrame.setLocationRelativeTo(null); myFrame.setVisible(true); return myFrame; }
From source file:charts.Chart.java
public static void Histogram(IntervalXYDataset dataset, String title, String x_axis_label, String y_axis_label) {/* w w w. ja v a2 s . c o m*/ JFrame chartwindow = new JFrame(title); JFreeChart jfreechart = ChartFactory.createHistogram(title, x_axis_label, y_axis_label, dataset, PlotOrientation.VERTICAL, true, false, false); JPanel jpanel = new ChartPanel(jfreechart); jpanel.setPreferredSize(new Dimension(defaultwidth, defaultheight)); chartwindow.setContentPane(jpanel); chartwindow.pack(); RefineryUtilities.centerFrameOnScreen(chartwindow); chartwindow.setVisible(true); }
From source file:umontreal.iro.lecuyer.charts.MultipleDatasetChart.java
/** * Displays chart on the screen using Swing. * This method creates an application containing a chart panel displaying * the chart. The created frame is positioned on-screen, and displayed before * it is returned. The <TT>width</TT> and the <TT>height</TT> * of the chart are measured in pixels. * /*from w w w. ja va 2s. co m*/ * @param width frame width in pixels. * * @param height frame height in pixels. * * */ public JFrame view(int width, int height) { JFrame myFrame; if (chart.getTitle() != null) myFrame = new JFrame("MultipleDatasetChart from SSJ: " + chart.getTitle().getText()); else myFrame = new JFrame("MultipleDatasetChart from SSJ"); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(width, height)); myFrame.setContentPane(chartPanel); myFrame.pack(); myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); myFrame.setLocationRelativeTo(null); myFrame.setVisible(true); return myFrame; }
From source file:umontreal.iro.lecuyer.charts.XYLineChart.java
/** * Displays chart on the screen using Swing. * This method creates an application containing a chart panel displaying * the chart. The created frame is positioned on-screen, and displayed before * it is returned. The <TT>width</TT> and the <TT>height</TT> * of the chart are measured in pixels. * //from w w w.j a v a2 s. c om * @param width frame width in pixels. * * @param height frame height in pixels. * * @return frame containing the chart.; * */ public JFrame view(int width, int height) { JFrame myFrame; if (chart.getTitle() != null) myFrame = new JFrame("XYLineChart from SSJ: " + chart.getTitle().getText()); else myFrame = new JFrame("XYLineChart from SSJ"); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(width, height)); myFrame.setContentPane(chartPanel); myFrame.pack(); myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); myFrame.setLocationRelativeTo(null); myFrame.setVisible(true); return myFrame; }
From source file:adapters.HistogramChartAdapter.java
/** * Modified method/* www .j a v a2s . c o m*/ * * Displays chart on the screen using Swing. * This method creates an application containing a chart panel displaying * the chart. The created frame is positioned on-screen, and displayed before * it is returned. The <TT>width</TT> and the <TT>height</TT> * of the chart are measured in pixels. * * @param width frame width in pixels. * * @param height frame height in pixels. * * @return frame containing the chart. * */ public JFrame view(int width, int height) { JFrame myFrame; if (chart.getTitle() != null) myFrame = new JFrame("Histogram Chart: " + chart.getTitle().getText()); else myFrame = new JFrame("Histogram Chart"); TextTitle tt = chart.getTitle(); tt.setFont(new FontUIResource("DensityChartSmallFont", Font.ITALIC, 12)); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(width, height)); myFrame.setContentPane(chartPanel); myFrame.pack(); myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); return myFrame; }
From source file:edu.ku.brc.specify.BackupAndRestoreApp.java
/** * Tries to do the login, if doAutoLogin is set to true it will try without displaying a dialog * and if the login fails then it will display the dialog * @param userName single signon username (for application) * @param password single signon password (for application) * @param usrPwdProvider the provider/*from w ww . j a v a2 s . co m*/ * @param engageUPPrefs indicates whether the username and password should be loaded and remembered by local prefs * @param doAutoLogin whether to try to automatically log the user in * @param doAutoClose whether it should automatically close the window when it is logged in successfully * @param useDialog use a Dialog or a Frame * @param listener a listener for when it is logged in or fails * @param iconName name of icon to use * @param title name * @param appName name * @param appIconName application icon name * @param helpContext help context for Help button on dialog */ public static DatabaseLoginPanel doLogin(final boolean engageUPPrefs, final MasterPasswordProviderIFace usrPwdProvider, final boolean doAutoClose, final DatabaseLoginListener listener, final String iconName, final String title, final String appName, final String appIconName, final String helpContext) //frame's icon name { ImageIcon icon = IconManager.getIcon("AppIcon", IconManager.IconSize.Std32); if (StringUtils.isNotEmpty(appIconName)) { ImageIcon imgIcon = IconManager.getIcon(appIconName); if (imgIcon != null) { icon = imgIcon; } } // else class DBListener implements DatabaseLoginListener { protected JFrame frame; protected DatabaseLoginListener frameDBListener; protected boolean doAutoCloseOfListener; public DBListener(JFrame frame, DatabaseLoginListener frameDBListener, boolean doAutoCloseOfListener) { this.frame = frame; this.frameDBListener = frameDBListener; this.doAutoCloseOfListener = doAutoCloseOfListener; } public void loggedIn(final Window window, final String databaseName, final String userNameArg) { log.debug("UIHelper.doLogin[DBListener]"); if (doAutoCloseOfListener) { frame.setVisible(false); } frameDBListener.loggedIn(window, databaseName, userNameArg); } public void cancelled() { frame.setVisible(false); frameDBListener.cancelled(); } } JFrame.setDefaultLookAndFeelDecorated(false); JFrame frame = new JFrame(title); DatabaseLoginPanel panel = new DatabaseLoginPanel(null, null, false, usrPwdProvider, new DBListener(frame, listener, doAutoClose), false, false, title, appName, iconName, helpContext); panel.setAutoClose(doAutoClose); panel.setWindow(frame); frame.setContentPane(panel); frame.setIconImage(icon.getImage()); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.pack(); UIHelper.centerAndShow(frame); return panel; }
From source file:flexflux.analyses.result.PP2DResult.java
public void plot() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); // one chart by group Map<Integer, Integer> correspGroup = new HashMap<Integer, Integer>(); XYSeriesCollection dataset = new XYSeriesCollection(); int index = 0; XYSeries series = new XYSeries(""); for (double point : fluxValues) { series.add(point, resultValues.get(point)); correspGroup.put(index, pointIndex.get(point)); index++;/*from ww w .ja v a 2s. co m*/ } dataset.addSeries(series); if (!expValues.isEmpty()) { XYSeries expSeries = new XYSeries("Experimental values"); if (!expValues.isEmpty()) { for (Double d : expValues.keySet()) { for (Double d2 : expValues.get(d)) { expSeries.add(d, d2); } } } dataset.addSeries(expSeries); } final JFreeChart chart = ChartFactory.createXYLineChart("", // chart // title reacName, // domain axis label objName, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.GRAY); plot.setDomainGridlinePaint(Color.GRAY); XYLineAndShapeRenderer renderer = new MyRenderer(true, false, correspGroup); plot.setRenderer(0, renderer); if (!expValues.isEmpty()) { renderer.setSeriesLinesVisible(1, false); renderer.setSeriesShapesVisible(1, true); renderer.setSeriesPaint(1, Color.BLUE); } ChartPanel chartPanel = new ChartPanel(chart); panel.add(chartPanel); JPanel fvaPanel = new JPanel(); fvaPanel.setLayout(new BoxLayout(fvaPanel, BoxLayout.PAGE_AXIS)); for (int i = 1; i <= groupIndex.size(); i++) { Color color = COLORLIST[i % COLORLIST.length]; JPanel groupPanel = new JPanel(); groupPanel.setLayout(new BoxLayout(groupPanel, BoxLayout.PAGE_AXIS)); List<BioEntity> newEssentialReactions = comparator.getNewEssentialEntities().get(i); List<BioEntity> noLongerEssentialReactions = comparator.getNoLongerEssentialEntities().get(i); JPanel colorPanel = new JPanel(); colorPanel.setBackground(color); groupPanel.add(colorPanel); groupPanel.add(new JLabel( "Phenotypic phase " + i + ", " + newEssentialReactions.size() + " new essential reactions")); fvaPanel.add(groupPanel); if (newEssentialReactions.size() > 0) { fvaPanel.add(new JScrollPane(comparator.getNewEssentialEntitiesPanel().get(i))); } fvaPanel.add(new JLabel("Phenotypic phase " + i + ", " + noLongerEssentialReactions.size() + " no longer essential reactions")); if (noLongerEssentialReactions.size() > 0) { fvaPanel.add(fvaPanel.add(new JScrollPane(comparator.getNoLongerEssentialEntitiesPanel().get(i)))); } } JScrollPane fvaScrollPane = new JScrollPane(fvaPanel); JFrame frame = new JFrame("Phenotypic phase analysis results"); if (expValues.size() > 0) { frame.setTitle("Pareto analysis two dimensions results"); } if (groupIndex.size() > 0) { JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel, fvaScrollPane); frame.setContentPane(splitPane); frame.setSize(600, 1000); } else { frame.setContentPane(panel); frame.setSize(600, 600); } panel.setPreferredSize(new Dimension(600, 600)); panel.setMinimumSize(new Dimension(600, 600)); RefineryUtilities.centerFrameOnScreen(frame); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }