Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/

import java.awt.Component;

import javax.swing.JDialog;
import javax.swing.JOptionPane;

public class Main {
    /**
     * JOption panes static methods are not swing-conform and not decoratable.
     * <p>
     * This utility function corrects this by giving the dialog/rootPane the name "Synth.Dialog"
     */
    public static void showMessageDialogSynthCapable(Component parentComponent, Object message, String title,
            int messageType) {
        JOptionPane pane = new JOptionPane(message, messageType);
        JDialog dlg = pane.createDialog(parentComponent, title);
        dlg.getRootPane().setName("Synth.Dialog");
        dlg.pack();
        dlg.setVisible(true);
    }
}