Example usage for javax.swing JFrame getContentPane

List of usage examples for javax.swing JFrame getContentPane

Introduction

In this page you can find the example usage for javax.swing JFrame getContentPane.

Prototype

public Container getContentPane() 

Source Link

Document

Returns the contentPane object for this frame.

Usage

From source file:LineMetricsIllustration.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new LineMetricsIllustration());
    f.setSize(850, 250);/*from  ww  w.j a  v  a  2 s  .  c  o m*/
    f.show();

}

From source file:TexturedText.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new TexturedText());
    f.setSize(800, 250);/*from  w w  w  .j a v  a2  s  . c o m*/
    f.show();

}

From source file:ButtonTipTest.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Tool Tips");
    Container contentPane = frame.getContentPane();
    JButton b = new JButton("Button");
    b.setToolTipText("Go Away");
    contentPane.add(b, BorderLayout.NORTH);
    frame.setSize(300, 200);/*w  w  w.  j a va  2 s .com*/
    frame.show();
}

From source file:Main.java

public static void main(String args[]) {
    Object rowData[][] = { { "Row1-Column1", "Row1-Column2", "Row1-Column3" },
            { "Row2-Column1", "Row2-Column2", "Row2-Column3" } };
    Object columnNames[] = { "Column 1", "Column 2", "Column 3" };

    JTable table = new JTable(rowData, columnNames);
    table.setTableHeader(null);//  ww w  .  j  ava 2 s  . c o  m
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setColumnHeaderView(null);
    JFrame frame = new JFrame();
    frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    DocumentFilter dfilter = new UpperCaseFilter();

    JTextArea jta = new JTextArea();
    ((AbstractDocument) jta.getDocument()).setDocumentFilter(dfilter);

    JFrame frame = new JFrame("UpcaseFilter");
    frame.getContentPane().add(jta, java.awt.BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 120);/*from   w  ww . j  a v a  2 s.c  o m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new Main());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();/*from  w  w  w . j av a  2s .co  m*/
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:RollingText.java

public static void main(String[] args) {
    JFrame f = new JFrame("RollingText v1.0");
    f.getContentPane().add(new RollingText());
    f.setSize(600, 300);//from   w  w  w.ja  va  2 s . c om
    f.setVisible(true);
}

From source file:FormattedTest.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Formatted");
    Container contentPane = frame.getContentPane();
    JFormattedTextField ftf1 = new JFormattedTextField(new Integer(0));
    contentPane.add(ftf1, BorderLayout.NORTH);
    JFormattedTextField ftf2 = new JFormattedTextField(new Date());
    contentPane.add(ftf2, BorderLayout.SOUTH);
    frame.setSize(200, 100);// w w w  .  j a va  2s  . c  om
    frame.show();
}

From source file:UpcaseFilter.java

public static void main(String[] args) {
    DocumentFilter dfilter = new UpcaseFilter();

    JTextArea jta = new JTextArea();
    JTextField jtf = new JTextField();
    ((AbstractDocument) jta.getDocument()).setDocumentFilter(dfilter);
    ((AbstractDocument) jtf.getDocument()).setDocumentFilter(dfilter);

    JFrame frame = new JFrame("UpcaseFilter");
    frame.getContentPane().add(jta, java.awt.BorderLayout.CENTER);
    frame.getContentPane().add(jtf, java.awt.BorderLayout.SOUTH);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 120);/*ww  w . j  a v  a 2s. co  m*/
    frame.setVisible(true);
}

From source file:Slice.java

public static void main(String[] argv) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new MyComponent());
    frame.setSize(300, 200);/*from   w  w  w .  j  a  v  a2 s.  c  om*/
    frame.setVisible(true);

}