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

    JFileChooser fileChooser = new JFileChooser(".");

    FileFilter f = fileChooser.getFileFilter();
    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//from   w w  w . j a  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(".");

    FileView fileView = fileChooser.getFileView();
    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//from ww w . j  a  va  2s  .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(".");

    Icon icon = fileChooser.getIcon(new File("."));
    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//w  w  w  .  ja  v a2  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(".");
    ActionListener[] lis = fileChooser.getActionListeners();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//w  ww  .j  a  v  a 2s .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(".");

    String name = fileChooser.getName(new File("."));
    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();// ww  w .  ja va  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(".");

    boolean b = fileChooser.getControlButtonsAreShown();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//from  w ww  .  java2s .c  om
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    String[] items = new String[] { "One", "Two", "Three", "Four" };
    JList<String> list = new JList<>(items);
    JFrame f = new JFrame();
    f.add(list, BorderLayout.CENTER);
    JButton btn = new JButton("Get selected");
    btn.addActionListener(new ActionListener() {
        @Override//from ww w . j  a  v  a 2 s.  c  o m
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showConfirmDialog(f, "You Selected : " + list.getSelectedValue(), "Display",
                    JOptionPane.PLAIN_MESSAGE);
        }
    });

    f.add(btn, BorderLayout.SOUTH);
    f.pack();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.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(".");

    FileFilter[] filters = fileChooser.getChoosableFileFilters();

    frame.add(fileChooser, BorderLayout.CENTER);

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

From source file:CreatingSerifItalicFont.java

public static void main(String args[]) {
    JFrame f = new JFrame("JColorChooser Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final JButton button = new JButton("Pick to Change Background");

    Font myFont = new Font("Serif", Font.ITALIC, 12);

    button.setFont(myFont);/* w  ww.j  a  v a  2 s.c o m*/

    f.add(button, BorderLayout.CENTER);
    f.setSize(300, 200);
    f.setVisible(true);
}

From source file:Main.java

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

    JTextArea textArea = new JTextArea();
    f.add(new JScrollPane(textArea), BorderLayout.CENTER);

    Timer timer = new Timer(1000, new ActionListener() {
        @Override//from w ww  .  j  av a 2 s . c o m
        public void actionPerformed(ActionEvent e) {
            textArea.append("bla");
        }
    });
    timer.setRepeats(true);
    timer.start();
    JButton button = new JButton("Click me");
    button.addActionListener(e -> {
        System.out.println("Before option pane");
        JOptionPane.showMessageDialog(f, "A message dialog");
        System.out.println("After option pane");
    });
    f.add(button, BorderLayout.SOUTH);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setVisible(true);
}