Example usage for javax.swing JFrame setUndecorated

List of usage examples for javax.swing JFrame setUndecorated

Introduction

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

Prototype

public void setUndecorated(boolean undecorated) 

Source Link

Document

Disables or enables decorations for this frame.

Usage

From source file:Main.java

public static void main(String args[]) throws Exception {
    final JFrame frame = new JFrame();
    frame.setUndecorated(true);
    JButton button = new JButton("Minimize");
    button.addActionListener(e -> frame.setState(Frame.ICONIFIED));
    frame.add(button);/*from   ww  w  .j a  v a 2s.  c  o m*/
    frame.pack();
    frame.setVisible(true);
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.setBackground(new Color(0, 0, 0, 0));
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new ShadowPane());

    JPanel panel = new JPanel(new GridBagLayout());
    panel.add(new JLabel("Look ma, no hands"));

    frame.add(panel);//from   ww  w .  j  ava 2  s .c o  m
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            point.x = e.getX();//w  w  w.  j  a  v a2 s. c o m
            point.y = e.getY();
        }
    });
    frame.addMouseMotionListener(new MouseMotionAdapter() {
        public void mouseDragged(MouseEvent e) {
            Point p = frame.getLocation();
            frame.setLocation(p.x + e.getX() - point.x, p.y + e.getY() - point.y);
        }
    });

    frame.setSize(300, 300);
    frame.setLocation(200, 200);
    frame.setLayout(new BorderLayout());

    frame.getContentPane().add(new JLabel("Drag to move", JLabel.CENTER), BorderLayout.CENTER);

    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Menu");
    menuBar.add(menu);
    JMenuItem item = new JMenuItem("Exit");
    item.addActionListener(e -> System.exit(0));
    menu.add(item);
    frame.setJMenuBar(menuBar);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    final JFrame frame = new JFrame();
    frame.setUndecorated(true);
    JButton button = new JButton("Close Me");
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);/*from w w w.j a va2  s.  c o  m*/
        }
    });

    frame.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            point.x = e.getX();
            point.y = e.getY();
        }
    });
    frame.addMouseMotionListener(new MouseMotionAdapter() {
        public void mouseDragged(MouseEvent e) {
            Point p = frame.getLocation();
            frame.setLocation(p.x + e.getX() - point.x, p.y + e.getY() - point.y);
        }
    });

    frame.setSize(300, 300);
    frame.setLocation(200, 200);
    frame.setLayout(new BorderLayout());

    frame.getContentPane().add(button, BorderLayout.NORTH);
    frame.getContentPane().add(new JLabel("Drag Me", JLabel.CENTER), BorderLayout.CENTER);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setUndecorated(true);
    JPanel panel = new JPanel();
    panel.add(new JLabel("Stackoverflow!"));
    panel.add(new JButton(new AbstractAction("Close") {
        @Override//from   w w w  . j av  a 2  s  .  c  o m
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    }));
    f.add(panel);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("TitleLessJFrame");
    frame.getContentPane().add(new JLabel(" HEY!!!"));
    frame.setUndecorated(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(400, 200);//w  w w  .  j  a va 2 s. co m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame1 = new JFrame();
    frame1.setExtendedState(JFrame.MAXIMIZED_BOTH);
    frame1.setUndecorated(true);
    frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame1.setVisible(true);//ww  w  .  j a va 2s .  c  o  m

    JDialog nonModalDialog = new JDialog(frame1, "Non-Modal Dialog", ModalityType.MODELESS);
    nonModalDialog.add(Box.createRigidArea(new Dimension(200, 200)));
    nonModalDialog.pack();
    nonModalDialog.setVisible(true);

    JDialog modalDialog = new JDialog(frame1, "Modal Dialog", ModalityType.APPLICATION_MODAL);
    modalDialog.add(Box.createRigidArea(new Dimension(200, 200)));
    modalDialog.pack();
    modalDialog.setVisible(true);

}

From source file:AdornSample.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("Adornment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setUndecorated(true);
    frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    frame.setSize(300, 100);//from  w w w .j  ava2s.  c  o  m
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("Adornment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setUndecorated(true);
    frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    frame.setSize(300, 100);/*from   ww  w .j a  v  a  2  s.c  o m*/
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice vc = env.getDefaultScreenDevice();
    JFrame window = new JFrame();
    JPanel comp = new JPanel();
    comp.setBackground(Color.RED);
    window.add(comp);/*from   w w  w . jav a 2s  . co  m*/
    window.setUndecorated(true);
    window.setResizable(false);
    vc.setFullScreenWindow(window);
}