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:org.squidy.nodes.ReacTIVision.java

public static void showErrorPopUp(String errorMessage) {
    //get screen size
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    //create pop up
    final JFrame frame = new JFrame();
    frame.setResizable(false);/*  ww  w  .  j  a v  a2  s .  c o m*/
    frame.setAlwaysOnTop(true);
    frame.setUndecorated(true);
    JLabel text = new JLabel(" " + errorMessage + " ");
    frame.getContentPane().setBackground(Color.RED);
    text.setForeground(Color.WHITE);
    frame.add(text);
    frame.pack();
    frame.setLocation((dim.width - frame.getWidth()) / 2, (dim.height - frame.getHeight()) / 2);
    frame.setVisible(true);
    frame.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent arg0) {
            frame.dispose();
        }
    });
}

From source file:uk.chromis.pos.forms.JRootApp.java

private void poweredbyMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_poweredbyMouseClicked

    JFrame sampleFrame = new JFrame();
    final Action exit = new AbstractAction("Exit") {
        @Override/* w  w w. j  a  v a  2  s  .co  m*/
        public final void actionPerformed(final ActionEvent e) {
            sampleFrame.setVisible(false);
            sampleFrame.dispose();
        }
    };

    String currentPath = null;

    if (OSValidator.isMac()) {
        try {
            currentPath = new File(
                    JRootApp.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath())
                            .toString();
        } catch (URISyntaxException ex) {
        }
    } else {
        currentPath = System.getProperty("user.dir") + "\\chromispos.jar";
    }

    String md5 = null;
    try {
        FileInputStream fis = new FileInputStream(new File(currentPath));
        md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(fis);
        fis.close();

    } catch (FileNotFoundException ex) {
        Logger.getLogger(JRootApp.class.getName()).log(Level.SEVERE, null, ex);

    } catch (IOException ex) {
        Logger.getLogger(JRootApp.class.getName()).log(Level.SEVERE, null, ex);
    }

    /*
    int mb = 1024*1024;         
    //Getting the runtime reference from system
    Runtime runtime = Runtime.getRuntime();         
    System.out.println("##### Heap utilization statistics [MB] #####");         
    //Print used memory
    System.out.println("Used Memory:"
    + (runtime.totalMemory() - runtime.freeMemory()) / mb); 
    //Print free memory
    System.out.println("Free Memory:"
    + runtime.freeMemory() / mb);         
    //Print total available memory
    System.out.println("Total Memory:" + runtime.totalMemory() / mb); 
    //Print Maximum available memory
    System.out.println("Max Memory:" + runtime.maxMemory() / mb);
     */
    AboutDialog dialog = new AboutDialog();
    JPanel dialogPanel = new JPanel();
    MigLayout layout = new MigLayout("", "[fill]");
    DefaultTableModel model = new DefaultTableModel();
    JTable table = new JTable(model);
    model.addColumn("Details");
    model.addColumn("Value");
    model.addRow(new Object[] { "Database Version", readDataBaseVersion() });
    model.addRow(new Object[] { "Java Version", System.getProperty("java.version") });
    model.addRow(new Object[] { "Jar MD5", md5 });
    model.addRow(new Object[] { "Operating System", System.getProperty("os.name") });
    model.addRow(new Object[] { "Sync library", Sync.getVersion() });

    JScrollPane scrollPane = new JScrollPane(table);
    JPanel mainPanel = new JPanel(layout);
    JLabel label = new JLabel();
    JPanel btnPanel = new JPanel();
    dialogPanel.add(dialog);
    mainPanel.add(dialogPanel, "wrap");
    mainPanel.add(scrollPane, "wrap");
    JButton btnExit = new JButton(exit);
    btnPanel.add(btnExit, "width 100!");
    mainPanel.add(btnPanel, "right, wrap");
    mainPanel.add(new JLabel(), "wrap");
    sampleFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    sampleFrame.setPreferredSize(new Dimension(500, 300));
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    sampleFrame.setLocation(dim.width / 2 - 250, dim.height / 2 - 150);
    sampleFrame.setUndecorated(true);
    mainPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 4));
    sampleFrame.add(mainPanel);
    sampleFrame.pack();
    sampleFrame.setVisible(true);

}