Java Utililty Methods JFrame

List of utility methods to do JFrame

Description

The list of methods to do JFrame are organized into topic(s).

Method

voiddispErrore(JFrame frame, String task, String mess)
visualizzazione errori HTML
JOptionPane.showMessageDialog(frame, formattaHTML(mess), ERR_TITLE, JOptionPane.ERROR_MESSAGE);
voiddisplay(JFrame parent, JInternalFrame dialog)
Display a dialog centered within the given frame.
center(parent, dialog);
parent.getLayeredPane().add(dialog, JLayeredPane.POPUP_LAYER);
dialog.setVisible(true);
intdisplayConfirmationMessage(JFrame parent, String message, String title)
display Confirmation Message
Object[] options = { "Yes", "No" };
return JOptionPane.showOptionDialog(parent, message, title, JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
voiddisplayError(Exception e, JFrame jFrame)
display Error
if (DEBUG) {
    e.printStackTrace();
} else {
    JOptionPane.showMessageDialog(jFrame, "Error Occurred: " + e.getMessage());
voiddisplayWindow(final JFrame window)
display Window
SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
        window.setVisible(true);
});
voiddispose(final JFrame frame)
Schedule disposal of a frame (async).
SwingUtilities.invokeLater(new Runnable() {
    public void run() {
        if (frame.isDisplayable())
            frame.dispose();
});
voiddoDisableActiveRenderingInEDT(final JFrame jFrame)
do Disable Active Rendering In EDT
jFrame.getRootPane().setOpaque(true);
jFrame.setFocusTraversalKeysEnabled(true);
jFrame.setIgnoreRepaint(false);
doSetIgnoreRepaint(jFrame, false);
voiddrawHelpPanel(String helpToDisplay, final JFrame frame)
draw Help Panel
JPanel panel = new JPanel();
panel.setBackground(Color.black);
panel.setBounds(10, 500, 780, 50);
frame.getContentPane().removeAll();
JLabel helpLabel = new JLabel(helpToDisplay);
helpLabel.setForeground(Color.white);
panel.add(helpLabel);
frame.add(panel);
...
voidenable(final JFrame frame)
Enable.
frame.setGlassPane(new JPanel());
frame.getGlassPane().setVisible(false);
voidenterFullScreenIfPossible(JFrame mainAppFrame)
enter Full Screen If Possible
final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice defaultScreenDevice = ge.getDefaultScreenDevice();
if (defaultScreenDevice.isFullScreenSupported()) {
    try {
        mainAppFrame.dispose();
        fsFrameSize = mainAppFrame.getSize();
        mainAppFrame.setSize(getScreenSize());
        fsFrameUndecorated = mainAppFrame.isUndecorated();
...