Example usage for javax.swing JFrame setDefaultLookAndFeelDecorated

List of usage examples for javax.swing JFrame setDefaultLookAndFeelDecorated

Introduction

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

Prototype

public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated) 

Source Link

Document

Provides a hint as to whether or not newly created JFrames should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel.

Usage

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Adornment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 100);/*from   ww w .  j a v a 2s  . com*/
    frame.setVisible(true);
}

From source file:JFramePack.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame();
    frame.setTitle("My First Swing Application");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel("Welcome");
    frame.add(label);/*from w w w .ja v  a  2s .  c  o m*/
    frame.pack();
    frame.setVisible(true);
}

From source file:JComboBoxTest.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("JComboBox Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    String[] selections = { "green", "red", "orange", "dark blue" };
    JComboBox comboBox = new JComboBox(selections);
    comboBox.setSelectedIndex(1);/*w ww.j  av a 2s. c o m*/
    System.out.println(comboBox.getSelectedItem());
    frame.add(comboBox);
    frame.pack();
    frame.setVisible(true);
}

From source file:GridLayoutTest.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("GridLayout Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new GridLayout(3, 2));
    frame.add(new JButton("Button 1"));
    frame.add(new JButton("Button 2"));
    frame.add(new JButton("Button 3"));
    frame.add(new JButton("Button 4"));
    frame.add(new JButton("Button 5"));
    frame.add(new JButton("Button 6"));
    frame.add(new JButton("Button 7"));
    frame.add(new JButton("Button 8"));
    frame.pack();//from w w w .j  a v a  2 s .  c o  m
    frame.setVisible(true);
}

From source file:NoLayoutTest.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("NoLayout Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(null);//from  w  w  w. j  a  va 2s .  c o  m
    JLabel label = new JLabel("First Name:");
    label.setBounds(20, 20, 100, 20);
    JTextField textField = new JTextField();
    textField.setBounds(124, 25, 100, 20);
    frame.add(label);
    frame.add(textField);
    frame.setSize(300, 100);
    frame.setVisible(true);
}

From source file:JListTest.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("JList Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    String[] selections = { "green", "red", "orange", "dark blue" };
    JList list = new JList(selections);
    list.setSelectedIndex(1);/*from  w ww.j  a v  a 2s . c  o m*/
    System.out.println(list.getSelectedValue());
    frame.add(new JScrollPane(list));
    frame.pack();

    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame();
    frame.setTitle("JLabel Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel("First Name");
    label.setFont(new Font("Courier New", Font.ITALIC, 12));
    label.setForeground(Color.GRAY);

    frame.add(label);//from  ww w.  java 2s.c  o  m
    frame.pack();
    frame.setVisible(true);
}

From source file:JCheckBoxTest.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("JCheckBox Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox ac = new JCheckBox("A/C");
    ac.setSelected(true);/*from  w  w  w  . ja  v  a 2  s .c om*/
    JCheckBox cdPlayer = new JCheckBox("A");
    JCheckBox cruiseControl = new JCheckBox("B");
    JCheckBox keylessEntry = new JCheckBox("C");
    JCheckBox antiTheft = new JCheckBox("D");
    JCheckBox centralLock = new JCheckBox("E");

    frame.add(new JLabel("Car Features"));
    frame.add(ac);
    frame.add(cdPlayer);
    frame.add(cruiseControl);
    frame.add(keylessEntry);
    frame.add(antiTheft);
    frame.add(centralLock);
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame();
    frame.setTitle("JLabel Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ImageIcon imageIcon = new ImageIcon("yourFile.gif");

    JLabel label = new JLabel("Mixed", imageIcon, SwingConstants.RIGHT);

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

From source file:FlowLayoutTest.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("FlowLayout Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    String text = "A JTextArea object represents" + "a multiline area for displaying text."
            + "You can change the number of lines" + "that can be displayed at a time.";
    JTextArea textArea1 = new JTextArea(text, 5, 10);
    textArea1.setPreferredSize(new Dimension(100, 100));
    JTextArea textArea2 = new JTextArea(text, 5, 10);
    textArea2.setPreferredSize(new Dimension(100, 100));
    JScrollPane scrollPane = new JScrollPane(textArea2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    textArea1.setLineWrap(true);//from w ww.j a  v a  2s  .co  m
    textArea2.setLineWrap(true);
    frame.add(textArea1);
    frame.add(scrollPane);
    frame.pack();
    frame.setVisible(true);
}