Example usage for java.awt Container add

List of usage examples for java.awt Container add

Introduction

In this page you can find the example usage for java.awt Container add.

Prototype

public Component add(Component comp) 

Source Link

Document

Appends the specified component to the end of this container.

Usage

From source file:Cal.java

/** For testing, a main program */
public static void main(String[] av) {
    JFrame f = new JFrame("Cal");
    Container c = f.getContentPane();
    c.setLayout(new FlowLayout());

    // for this test driver, hardcode 1995/02/10.
    c.add(new Cal(1995, 2 - 1, 10));

    // and beside it, the current month.
    c.add(new Cal());

    f.pack();//from   ww  w. ja v  a  2s  .  c om
    f.setVisible(true);
}

From source file:com.robertolosanno.cdt_maven.Cdt.java

public static void main(String[] args) {
    JFrame frame = new JFrame("CDT Viewer");
    Container content = frame.getContentPane();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    content.add(new Cdt());
    frame.pack();/*from w ww  .  j  av  a2s  . com*/
    frame.setVisible(true);
}

From source file:EditorPaneSample.java

public static void main(String args[]) throws IOException {
    JFrame frame = new JFrame("EditorPane Example");
    Container content = frame.getContentPane();

    JEditorPane editorPane = new JEditorPane("http://www.apress.com");
    editorPane.setEditable(false);/*from  ww w  . jav  a2 s.  co m*/

    HyperlinkListener hyperlinkListener = new ActivatedHyperlinkListener(frame, editorPane);
    editorPane.addHyperlinkListener(hyperlinkListener);

    JScrollPane scrollPane = new JScrollPane(editorPane);
    content.add(scrollPane);

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:com.declarativa.interprolog.gui.Testo1.java

/**
 * a driver for this demo/*w  w  w .  jav  a  2 s .  com*/
 */
public static void main(String[] args) {
    JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    content.add(new Testo1());
    frame.pack();
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JFrame frame = new JFrame();
    Container container = frame.getContentPane();

    GridBagLayout gbl = new GridBagLayout();

    container.setLayout(gbl);//from  www  . j  a  v a2s .co  m

    // Place a component at cell location (1,1)
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;

    JButton component = new JButton("a");

    // Associate the gridbag constraints with the component
    gbl.setConstraints(component, gbc);

    container.add(component);

    frame.pack();
    frame.setVisible(true);
}

From source file:lu.lippmann.cdb.lab.mds.UniversalMDS.java

public static void main(String[] args) throws Exception {

    final Instances ds = WekaDataAccessUtil.loadInstancesFromARFFOrCSVFile(
            //new File("./samples/csv/uci/zoo.csv"));
            //new File("./samples/arff/UCI/cmc.arff"));
            //new File("./samples/csv/direct-marketing-bank-reduced.csv"));
            //new File("./samples/csv/bank.csv"));
            //new File("./samples/csv/preswissroll.csv"));
            //new File("./samples/csv/preswissroll-mod4.csv"));
            new File("./samples/csv/lines.csv"));

    /*/*from w  w  w. j  av a  2  s .  c o  m*/
    Resample rs = new Resample();
    rs.setInputFormat(dsOrder);
    rs.setSampleSizePercent(50);
    Instances ds = Filter.useFilter(dsOrder,rs);
     */

    final MDSTypeEnum type = MDSTypeEnum.CLASSIC;

    final UniversalMDS mds = new UniversalMDS(ds, MDSDistancesEnum.EUCLIDEAN, type);
    final JXPanel panel = mds.buildMDSViewFromDataSet(ds, type);

    final JXFrame f = new JXFrame();
    final Container c = f.getContentPane();
    c.add(panel);
    f.setVisible(true);
    f.setDefaultCloseOperation(JXFrame.EXIT_ON_CLOSE);
    f.pack();

}

From source file:com.google.code.facebook.graph.sna.applet.TreeCollapseDemo.java

/**
 * a driver for this demo//  ww w. j a v a2s. c  om
 */
public static void main(String[] args) {
    JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    content.add(new TreeCollapseDemo());
    frame.pack();
    frame.setVisible(true);
}

From source file:demos.TreeCollapse.java

/**
 * a driver for this demo//w  ww.  ja  v a 2  s.  c o  m
 */
public static void main(String[] args) {
    JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    content.add(new TreeCollapse());
    frame.pack();
    frame.setVisible(true);
}

From source file:LabelTextPos.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Label Text Pos");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container content = frame.getContentPane();
    content.setLayout(new GridLayout(2, 2));

    Border border = LineBorder.createGrayLineBorder();
    Icon warnIcon = new ImageIcon("Warn.gif");

    JLabel label1 = new JLabel(warnIcon);
    label1.setText("Left-Bottom");
    label1.setHorizontalTextPosition(JLabel.LEFT);
    label1.setVerticalTextPosition(JLabel.BOTTOM);
    label1.setBorder(border);/*from ww  w  .  j  av a2 s  .co m*/
    content.add(label1);

    JLabel label2 = new JLabel(warnIcon);
    label2.setText("Right-TOP");
    label2.setHorizontalTextPosition(JLabel.RIGHT);
    label2.setVerticalTextPosition(JLabel.TOP);
    label2.setBorder(border);
    content.add(label2);

    JLabel label3 = new JLabel(warnIcon);
    label3.setText("Center-Center");
    label3.setHorizontalTextPosition(JLabel.CENTER);
    label3.setVerticalTextPosition(JLabel.CENTER);
    label3.setBorder(border);
    content.add(label3);

    JLabel label4 = new JLabel(warnIcon);
    label4.setText("Center-Bottom");
    label4.setHorizontalTextPosition(JLabel.CENTER);
    label4.setVerticalTextPosition(JLabel.BOTTOM);
    label4.setBorder(border);
    content.add(label4);

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:edu.uci.ics.jung.samples.HyperbolicVertexImageShaperDemo.java

/**
 * a driver for this demo//from w ww. j  av  a  2 s  .c o  m
 */
public static void main(String[] args) {
    JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    content.add(new HyperbolicVertexImageShaperDemo());
    frame.pack();
    frame.setVisible(true);
}