Example usage for javax.swing JDialog setDefaultLookAndFeelDecorated

List of usage examples for javax.swing JDialog setDefaultLookAndFeelDecorated

Introduction

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

Prototype

public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated) 

Source Link

Document

Provides a hint as to whether or not newly created JDialog s 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:JOptionPaneTest3.java

public static void main(String[] args) {
    JDialog.setDefaultLookAndFeelDecorated(true);
    Object[] selectionValues = { "Pandas", "Dogs", "Horses" };
    String initialSelection = "Dogs";
    Object selection = JOptionPane.showInputDialog(null, "What are your favorite animals?", "Zoo Quiz",
            JOptionPane.QUESTION_MESSAGE, null, selectionValues, initialSelection);
    System.out.println(selection);
}

From source file:JOptionPaneTest2.java

public static void main(String[] args) {
    JDialog.setDefaultLookAndFeelDecorated(true);
    int response = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm",
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    if (response == JOptionPane.NO_OPTION) {
        System.out.println("No button clicked");
    } else if (response == JOptionPane.YES_OPTION) {
        System.out.println("Yes button clicked");
    } else if (response == JOptionPane.CLOSED_OPTION) {
        System.out.println("JOptionPane closed");
    }/*from   www .j av a  2s . com*/
}

From source file:JFileChooserTest.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("JComboBox Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton button = new JButton("Select File");
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            JFileChooser fileChooser = new JFileChooser();
            int returnValue = fileChooser.showOpenDialog(null);
            if (returnValue == JFileChooser.APPROVE_OPTION) {
                File selectedFile = fileChooser.getSelectedFile();
                System.out.println(selectedFile.getName());
            }// ww w .j a v a 2s .  c om
        }
    });
    frame.add(button);
    frame.pack();
    frame.setVisible(true);
}

From source file:MyActionListener.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("ActionListener Test 1");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton button = new JButton("Register");
    button.addActionListener(new MyActionListener());
    frame.getContentPane().add(button);/*from   w ww  .j  a va2  s  .  c o m*/
    frame.pack();
    frame.setVisible(true);
}

From source file:AddressDialog.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JDialogTest frame = new JDialogTest();
    frame.pack();//  w  w  w . j  a  v  a2s.  com
    frame.setVisible(true);
}

From source file:Main.java

/**
 * Workaround for Bug#5063999./*w ww  .  j a  v a2  s  .  c o  m*/
 */
public static void installDefaults() {
    String defaultlaf = System.getProperty("swing.defaultlaf");
    if (defaultlaf == null || defaultlaf.length() == 0) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | UnsupportedLookAndFeelException | IllegalAccessException
                | InstantiationException ex) {
            // NO-OP
        }
    }
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    UIManager.put(FORMATTED_TEXTFIELD_FONT_KEY, UIManager.get(TEXTFIELD_FONT_KEY));
    UIManager.put(FORMATTED_TEXTFIELD_INACTIVE_BACKGROUND_KEY,
            UIManager.get(TEXTFIELD_INACTIVE_BACKGROUND_KEY));
    UIManager.put(PASSWORDFIELD_FONT_KEY, UIManager.get(TEXTFIELD_FONT_KEY));
    //    try {
    //      UIManager.put(LafWidget.TABBED_PANE_PREVIEW_PAINTER,
    //          new DefaultTabPreviewPainter() {
    //
    //            /**
    //             * {@inheritDoc}
    //             */
    //            @Override
    //            public TabOverviewKind getOverviewKind(JTabbedPane tabPane) {
    //              return TabOverviewKind.ROUND_CAROUSEL;
    //              // return TabOverviewKind.MENU_CAROUSEL;
    //            }
    //          });
    //      UIManager.put(LafWidget.COMPONENT_PREVIEW_PAINTER,
    //          new DefaultPreviewPainter());
    //      UIManager.put(LafWidget.TEXT_EDIT_CONTEXT_MENU, Boolean.TRUE);
    //      // UIManager.put(LafWidget.COMBO_BOX_NO_AUTOCOMPLETION, Boolean.TRUE);
    //    } catch (Throwable ignored) {
    //      // substance may not be available.
    //    }
}

From source file:com.haulmont.cuba.desktop.theme.impl.DesktopThemeImpl.java

@Override
public void init() {
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);

    try {//  www  . j a  v  a 2s. c o m
        UIManager.setLookAndFeel(lookAndFeel);
        initUIDefaults();
        initButtonsKeyBinding();
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
            | UnsupportedLookAndFeelException e) {
        throw new RuntimeException(e);
    }

    if (marginSize != null) {
        UnitValue marginValue = new UnitValue(marginSize);
        PlatformDefaults.setPanelInsets(marginValue, marginValue, marginValue, marginValue);
    }

    if (spacingSize != null) {
        UnitValue spacingValue = new UnitValue(spacingSize);
        PlatformDefaults.setGridCellGap(spacingValue, spacingValue);
    }
}

From source file:SplitPaneDemo2.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *//*from   w  ww .j a va  2 s. c  o  m*/
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new SplitPaneDemo2();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:SwingFileChooserDemo.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *///from ww w  . j a va2s.c om
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SwingFileChooserDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new SwingFileChooserDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:de.unidue.inf.is.ezdl.gframedl.EzDL.java

private static void initDesktopSystem() {
    RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());

    Dispatcher.logEventDispatch = false;
    Dispatcher.logIncomingEvents = false;
    Dispatcher.logRegistration = false;/*from w w  w  . ja  v  a2s . c  om*/
    Dispatcher.logWithThreadInfo = false;

    JFrame.setDefaultLookAndFeelDecorated(false);
    JDialog.setDefaultLookAndFeelDecorated(false);

    I18nSupport.getInstance().init(Config.getInstance().getUserProperty("desktop.language", "en"));

    try {
        if (SystemUtils.OS == OperatingSystem.MAC_OS) {
            System.setProperty("apple.laf.useScreenMenuBar", "true");
        } else {
            checkJavaVersion();

            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        }
    } catch (UnsupportedLookAndFeelException e) {
        logger.error(e.getMessage(), e);
    } catch (ClassNotFoundException e) {
        logger.error(e.getMessage(), e);
    } catch (InstantiationException e) {
        logger.error(e.getMessage(), e);
    } catch (IllegalAccessException e) {
        logger.error(e.getMessage(), e);
    }
}