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:uk.ac.lkl.cram.ui.chart.TLALearningTypeChartFactory.java
/** * For testing purposes only//from ww w .ja v a 2s. c o m * @param args the command line arguments (ignored) */ public static void main(String[] args) { JFrame frame = new JFrame("TLA Learning Type Test"); TLActivity tla = AELMTest.populateModule().getTLALineItems().get(0).getActivity(); ChartPanel chartPanel = createChartPanel(tla); frame.setContentPane(chartPanel); frame.setVisible(true); }
From source file:Paints.java
public static void main(String[] a) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);/*from w w w . ja v a 2s . c om*/ } }); f.setContentPane(new Paints()); f.setSize(800, 375); f.setVisible(true); }
From source file:ImageOps.java
public static void main(String[] a) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);//from w w w .j a v a2 s. co m } }); f.setContentPane(new ImageOps()); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel label1 = new JLabel("BottomRight", SwingConstants.RIGHT); JLabel label2 = new JLabel("CenterLeft", SwingConstants.LEFT); JLabel label3 = new JLabel("TopCenter", SwingConstants.CENTER); label1.setVerticalAlignment(SwingConstants.BOTTOM); label2.setVerticalAlignment(SwingConstants.CENTER); label3.setVerticalAlignment(SwingConstants.TOP); label1.setBorder(BorderFactory.createLineBorder(Color.black)); label2.setBorder(BorderFactory.createLineBorder(Color.black)); label3.setBorder(BorderFactory.createLineBorder(Color.black)); JFrame frame = new JFrame("AlignmentExample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel(new GridLayout(3, 1, 8, 8)); p.add(label1);//from w w w .ja va2s.c o m p.add(label2); p.add(label3); p.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); frame.setContentPane(p); frame.setSize(200, 200); frame.setVisible(true); }
From source file:ColorGradient.java
public static void main(String[] a) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);/*from ww w.j av a 2 s.c om*/ } }); ColorGradient g = new ColorGradient(); g.init(); f.setContentPane(g); f.setSize(600, 200); f.setVisible(true); }
From source file:visualize.Visualize.java
public static void main(String[] args) throws NotEnoughDataPointsException, IllDefinedDataPointsException { XYSeries seriesQ = new XYSeries("quadratic"); XYSeries seriesL = new XYSeries("linear"); XYSeries seriesI = new XYSeries("intepolated"); final ArrayList<Point> pointsQ = new ArrayList<Point>(); for (double x = -5.0; x <= 5.0; x = x + 0.5) pointsQ.add(new Point(new double[] { x, 2.0 * x * x * x - 10 * x * x })); final LinearFunction fl = new LinearFunction(); final HigherOrderPolynomialFunction fq = new HigherOrderPolynomialFunction(3); final InterpolatedPolynomial<LinearFunction, HigherOrderPolynomialFunction> fi = new InterpolatedPolynomial<LinearFunction, HigherOrderPolynomialFunction>( new LinearFunction(), fq.copy(), 0.5); fl.fitFunction(pointsQ);/*from ww w .j av a 2 s .c om*/ fq.fitFunction(pointsQ); fi.fitFunction(pointsQ); System.out.println(fl); System.out.println(fq); System.out.println(fi.interpolatedFunction); for (double x = -5.0; x <= 5.0; x = x + 0.5) { seriesQ.add(x, fq.predict(x)); seriesL.add(x, fl.predict(x)); seriesI.add(x, fi.predict(x)); } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(seriesQ); dataset.addSeries(seriesL); dataset.addSeries(seriesI); JFreeChart chart = ChartFactory.createXYLineChart("XY Chart", "x-axis", "y-axis", dataset, PlotOrientation.VERTICAL, true, true, false); final XYPlot plot = chart.getXYPlot(); final XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, new Color(0, 0, 255)); renderer.setSeriesStroke(0, new BasicStroke(0.5f)); renderer.setSeriesPaint(1, new Color(255, 0, 0)); renderer.setSeriesStroke(1, new BasicStroke(0.5f)); renderer.setSeriesPaint(2, new Color(0, 200, 40)); renderer.setSeriesStroke(2, new BasicStroke(1.5f)); //chart.getXYPlot().setRenderer(new XYSplineRenderer(100)); JPanel panel = new JPanel(); ChartPanel chartPanel = new ChartPanel(chart); panel.add(chartPanel); JFrame frame = new JFrame(); frame.setContentPane(panel); frame.validate(); Dimension d = new Dimension(800, 500); frame.setSize(d); frame.setVisible(true); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("starting"); for (int lambda = 0; lambda <= 100; ++lambda) { fi.setLambda(lambda / 100.0); fi.fitFunction(pointsQ); System.out.println(fi.interpolatedFunction); dataset.getSeries(2).clear(); for (double x = -5.0; x <= 5.0; x = x + 0.5) seriesI.add(x, fi.predict(x)); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } // makeScreenshot( lambda ); } }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent newContentPane = new Main(); newContentPane.setOpaque(true);//from w ww.j ava 2s . c o m frame.setContentPane(newContentPane); frame.pack(); frame.setVisible(true); }
From source file:CompositeEffects.java
public static void main(String[] a) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);//from w w w . j a va 2 s.c o m } }); f.setContentPane(new CompositeEffects()); f.setSize(700, 250); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); URL url = new URL("http://www.java2s.com/style/download.png"); Image image = ImageIO.read(url); ImagePanel ip = new ImagePanel(new GridLayout(4, 4, 20, 20)); ip.setPreferredSize(new Dimension(640, 480)); f.setContentPane(ip); f.pack();/*from w w w . java 2 s . com*/ f.setVisible(true); ip.setImage(new ImageIcon(image)); }
From source file:uk.ac.lkl.cram.ui.chart.FeedbackChartMaker.java
/** * For testing purposes only/*from w ww .j av a 2 s .co m*/ * @param args the command line arguments (ignored) */ public static void main(String[] args) { JFrame frame = new JFrame("Feedback Chart Test"); Module m = AELMTest.populateModule(); FeedbackChartMaker maker = new FeedbackChartMaker(m); frame.setContentPane(maker.getChartPanel()); frame.setSize(300, 300); frame.setVisible(true); }