本文整理汇总了Java中org.jfree.ui.ApplicationFrame.pack方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationFrame.pack方法的具体用法?Java ApplicationFrame.pack怎么用?Java ApplicationFrame.pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.ui.ApplicationFrame
的用法示例。
在下文中一共展示了ApplicationFrame.pack方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayChart
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
/**
* Displays a chart in a frame.
* @param chart the chart to be displayed
*/
private static void displayChart(JFreeChart chart) {
// Chart panel
ChartPanel panel = new ChartPanel(chart);
panel.setFillZoomRectangle(true);
panel.setMouseWheelEnabled(true);
panel.setPreferredSize(new Dimension(1024, 400));
// Application frame
ApplicationFrame frame = new ApplicationFrame("Ta4j example - Cash flow to chart");
frame.setContentPane(panel);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
示例2: showGraph
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
private void showGraph() {
final JFreeChart chart = ChartFactory.createScatterPlot(
title, // chart title
xValue, // x axis label
yValue, // y axis label
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);
XYPlot plot = (XYPlot) chart.getPlot();
DemoRenderer renderer = new DemoRenderer();
// renderer.setBasePaint(Color.blue);
// renderer.setSeriesLinesVisible(0, true);
plot.setRenderer(renderer);
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(640, 480));
final ApplicationFrame frame = new ApplicationFrame(title);
frame.setContentPane(chartPanel);
frame.pack();
frame.setVisible(true);
}
示例3: showChart
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
/**
* Starting point for the demonstration application.
*/
public static void showChart(
String name, String xAxis, String yAxis1, XYDataset dataset1, String yAxis2,
XYDataset dataset2
) {
final JFreeChart chart = createChart(name, xAxis, yAxis1, dataset1, yAxis2, dataset2);
final ChartPanel chartPanel = createPanel(chart);
final ApplicationFrame app = new ApplicationFrame(name);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
app.setContentPane(chartPanel);
app.pack();
RefineryUtilities.centerFrameOnScreen(app);
app.setVisible(true);
}
示例4: run
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
@Override
public void run(final String arg0) {
// http://www.math.hu-berlin.de/~ccafm/lehre_BZQ_Numerik/allg/JAVA_Pakete/JFreeChart/JFreeChart-Tutorial.html
final String title = "Contrast Transfer Function";
final XYSplineRenderer spline = new XYSplineRenderer();
spline.setSeriesPaint(0, Color.RED);
spline.setSeriesPaint(1, Color.BLUE);
spline.setSeriesShapesVisible(0, false);
spline.setSeriesShapesVisible(1, false);
final NumberAxis xax = new NumberAxis("q in 1/nm");
final NumberAxis yax = new NumberAxis("CTF");
final XYPlot plot = new XYPlot(createDataset(), xax, yax, spline);
final JFreeChart chart = new JFreeChart(plot);
final ChartPanel chartPanel = new ChartPanel(chart);
final ApplicationFrame chartFrame = new ApplicationFrame(title);
chartFrame.setContentPane(chartPanel);
chartFrame.pack();
RefineryUtilities.centerFrameOnScreen(chartFrame);
chartFrame.setVisible(true);
}
示例5: displayChart
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
/**
* Displays a chart in a frame.
* @param chart the chart to be displayed
*/
private static void displayChart(JFreeChart chart) {
// Chart panel
ChartPanel panel = new ChartPanel(chart);
panel.setFillZoomRectangle(true);
panel.setMouseWheelEnabled(true);
panel.setPreferredSize(new Dimension(1024, 400));
// Application frame
ApplicationFrame frame = new ApplicationFrame("Ta4j example - Buy and sell signals to chart");
frame.setContentPane(panel);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
示例6: displayChart
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
/**
* Displays a chart in a frame.
* @param chart the chart to be displayed
*/
private static void displayChart(JFreeChart chart) {
// Chart panel
ChartPanel panel = new ChartPanel(chart);
panel.setFillZoomRectangle(true);
panel.setMouseWheelEnabled(true);
panel.setPreferredSize(new java.awt.Dimension(740, 300));
// Application frame
ApplicationFrame frame = new ApplicationFrame("Ta4j example - Candlestick chart");
frame.setContentPane(panel);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
示例7: displayChart
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
/**
* Displays a chart in a frame.
* @param chart the chart to be displayed
*/
private static void displayChart(JFreeChart chart) {
// Chart panel
ChartPanel panel = new ChartPanel(chart);
panel.setFillZoomRectangle(true);
panel.setMouseWheelEnabled(true);
panel.setPreferredSize(new java.awt.Dimension(500, 270));
// Application frame
ApplicationFrame frame = new ApplicationFrame("Ta4j example - Indicators to chart");
frame.setContentPane(panel);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
示例8: displayChart
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
/**
* Displays a chart in a frame.
*
* @param chart
* the chart to be displayed
*/
private static void displayChart(JFreeChart chart) {
// Chart panel
ChartPanel panel = new ChartPanel(chart);
panel.setFillZoomRectangle(true);
panel.setMouseWheelEnabled(true);
panel.setPreferredSize(new Dimension(1024, 400));
// Application frame
ApplicationFrame frame = new ApplicationFrame("Ta4j example - Buy and sell signals to chart");
frame.setContentPane(panel);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
示例9: displayChart
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
/**
* Displays a chart in a frame.
*
* @param chart the chart to be displayed
*/
private static void displayChart(JFreeChart chart) {
// Chart panel
ChartPanel panel = new ChartPanel(chart);
panel.setFillZoomRectangle(true);
panel.setMouseWheelEnabled(true);
panel.setPreferredSize(new java.awt.Dimension(500, 270));
// Application frame
ApplicationFrame frame = new ApplicationFrame("BTC/USD with Chande " +
"Moving Oscillator");
frame.setContentPane(panel);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
示例10: display
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
public static void display(JFreeChart plot) {
ApplicationFrame frame = new ApplicationFrame(plot.getTitle().getText());
ChartPanel plotPanel = new ChartPanel(plot);
plotPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT));
frame.setContentPane(plotPanel);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
示例11: main
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
final File inputcsv = new File("/Volumes/SSD/training_latlng");
final List<double[]> data = new ArrayList<double[]>(10000000);
// read in images
final BufferedReader br = new BufferedReader(new FileReader(inputcsv));
String line;
int i = 0;
br.readLine();
while ((line = br.readLine()) != null) {
final String[] parts = line.split(" ");
final double longitude = Double.parseDouble(parts[2]);
final double latitude = Double.parseDouble(parts[1]);
data.add(new double[] { longitude, latitude });
if (longitude >= -0.1 && longitude < 0 && latitude > 50 && latitude < 54)
System.out.println(parts[0] + " " + latitude + " " + longitude);
// if (i++ % 10000 == 0)
// System.out.println(i);
}
br.close();
System.out.println("Done reading");
final float[][] dataArr = new float[2][data.size()];
for (i = 0; i < data.size(); i++) {
dataArr[0][i] = (float) data.get(i)[0];
dataArr[1][i] = (float) data.get(i)[1];
}
final NumberAxis domainAxis = new NumberAxis("X");
domainAxis.setRange(-180, 180);
final NumberAxis rangeAxis = new NumberAxis("Y");
rangeAxis.setRange(-90, 90);
final FastScatterPlot plot = new FastScatterPlot(dataArr, domainAxis, rangeAxis);
final JFreeChart chart = new JFreeChart("Fast Scatter Plot", plot);
chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
final ApplicationFrame frame = new ApplicationFrame("Title");
frame.setContentPane(chartPanel);
frame.pack();
frame.setVisible(true);
}
示例12: run
import org.jfree.ui.ApplicationFrame; //导入方法依赖的package包/类
@Override
public void run(final String arg0) {
// http://www.tutorialspoint.com/jfreechart/index.htm
final ApplicationFrame chart = new ApplicationFrame("Angular aperture");
final JFreeChart xyChart = ChartFactory.createXYLineChart(
"Angular aperture", "aperture diameter in µm", "delta in nm",
createDataset(), PlotOrientation.VERTICAL, true, true, false);
final ChartPanel chartPanel = new ChartPanel(xyChart);
chartPanel.setPreferredSize(new java.awt.Dimension(800, 600));
final XYPlot plot = xyChart.getXYPlot();
final ValueAxis axis = plot.getRangeAxis();
axis.setAutoRange(false);
axis.setUpperBound(2.0);
final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, Color.GREEN);
renderer.setSeriesPaint(2, Color.BLUE);
renderer.setSeriesStroke(0, new BasicStroke(2f));
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesShapesVisible(1, false);
renderer.setSeriesShapesVisible(2, false);
plot.setRenderer(renderer);
final double x_opt = mrad2µm(alpha_opt);
final double y_opt = 0.9 * Math.pow(C_s * Math.pow(lambda, 3), 0.25) * 1e9;
final XYLineAnnotation line = new XYLineAnnotation(0, y_opt, mrad2µm(Math
.ceil(2 * alpha_opt)), y_opt);
plot.addAnnotation(line);
final XYPointerAnnotation pointer = new XYPointerAnnotation(String.format(
"Smallest error disc: %.2g nm @ %.1f µm", y_opt, x_opt), x_opt, y_opt,
5.0 * Math.PI / 4.0);
stylePointer(pointer);
plot.addAnnotation(pointer);
final double aperture_alpha = 0.5 * 20 * 1e-6 / fl;
final XYPointerAnnotation resolution = new XYPointerAnnotation(String
.format("Resolution with %.0f µm aperture: %.2f nm", mrad2µm(
aperture_alpha * 1e3), delta(aperture_alpha) * 1e9), mrad2µm(
aperture_alpha * 1e3), delta(aperture_alpha) * 1e9, 1.0 * Math.PI /
4.0);
stylePointer(resolution);
plot.addAnnotation(resolution);
chart.setContentPane(chartPanel);
chart.pack();
RefineryUtilities.centerFrameOnScreen(chart);
chart.setVisible(true);
}