Example usage for java.awt BorderLayout CENTER

List of usage examples for java.awt BorderLayout CENTER

Introduction

In this page you can find the example usage for java.awt BorderLayout CENTER.

Prototype

String CENTER

To view the source code for java.awt BorderLayout CENTER.

Click Source Link

Document

The center layout constraint (middle of container).

Usage

From source file:Main.java

public static void main(String[] args) throws InterruptedException {
    JFrame f = new JFrame();

    DefaultTableModel m = new DefaultTableModel();
    JTable t = new JTable(m);

    f.add(new JScrollPane(t), BorderLayout.CENTER);
    f.setVisible(true);/*from w w  w .  j  a va 2s  .c o  m*/
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    m.addColumn("A");
    m.addRow(new String[] { "A1" });

    Thread.sleep(2000);

    m.addColumn("B");
    m.addRow(new String[] { "A2", "B2" });
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");

    String text = fileChooser.getApproveButtonToolTipText();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//  w w  w  . j  a  va 2s .  com
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    int type = fileChooser.getDialogType();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*from   w  w  w .  j a  v a  2 s.  c o m*/
    frame.setVisible(true);
}

From source file:SwingSplitSample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("JSplitPane Sample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    frame.getContentPane().add(splitPane, BorderLayout.CENTER);
    frame.setSize(300, 200);/*from w  w w  .j  av a  2 s.c  o m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    String f = fileChooser.getDialogTitle();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//from  w  w  w .ja v a  2 s .co m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    boolean f = fileChooser.getDragEnabled();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*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[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    fileChooser.ensureFileIsVisible(new File("."));

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*  w  ww  .j a  v  a 2s  .  c  om*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame parentFrame = new JFrame();
    parentFrame.setSize(500, 150);/*from   w  w  w. j a  v  a 2s  .  com*/
    JLabel jl = new JLabel();
    jl.setText("Count : 0");

    parentFrame.add(BorderLayout.CENTER, jl);
    parentFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    parentFrame.setVisible(true);

    final JDialog dlg = new JDialog(parentFrame, "Progress Dialog", true);
    JProgressBar dpb = new JProgressBar(0, 500);
    dlg.add(BorderLayout.CENTER, dpb);
    dlg.add(BorderLayout.NORTH, new JLabel("Progress..."));
    dlg.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    dlg.setSize(300, 75);
    dlg.setLocationRelativeTo(parentFrame);

    Thread t = new Thread(new Runnable() {
        public void run() {
            dlg.setVisible(true);
        }
    });
    t.start();
    for (int i = 0; i <= 500; i++) {
        jl.setText("Count : " + i);
        dpb.setValue(i);
        if (dpb.getValue() == 500) {
            dlg.setVisible(false);
            System.exit(0);

        }
        try {
            Thread.sleep(25);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    dlg.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    String f = fileChooser.getDescription(new File("."));

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//from  w w w .  j av a  2  s  . c om
    frame.setVisible(true);
}

From source file:SplitPaneSample.java

public static void main(String args[]) {
    JFrame vFrame = new JFrame("JSplitPane Sample");
    vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JSplitPane vSplitPane = new JSplitPane();
    vSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    vFrame.getContentPane().add(vSplitPane, BorderLayout.CENTER);
    vFrame.setSize(300, 150);/*  www .  j  a va  2  s .c  o m*/
    vFrame.setVisible(true);

    JFrame hFrame = new JFrame("JSplitPane Sample");
    JSplitPane hSplitPane = new JSplitPane();
    hFrame.getContentPane().add(hSplitPane, BorderLayout.CENTER);
    hFrame.setSize(300, 150);
    hFrame.setVisible(true);
}