/* * * Copyright 2014 http://Bither.net * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * / */ package net.bither.viewsystem.dialogs; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import net.bither.BitherUI; import net.bither.viewsystem.themes.Themes; import javax.swing.*; import java.awt.*; public class MessageDialog extends BitherDialog { private JPanel contentPane; private JLabel labMsg; private static final int show_time = 1800; public MessageDialog(String msg) { setContentPane(contentPane); setModal(false); labMsg.setText(msg); initDialog(); setBackground(Themes.currentTheme.warningAlertBackground()); contentPane.setBackground(Themes.currentTheme.warningAlertBackground()); Dimension dimension = new Dimension(BitherUI.WIZARD_MIN_WIDTH, BitherUI.MESSAGE_HEIGHT); setMinimumSize(dimension); setPreferredSize(dimension); setMaximumSize(dimension); } public void showMsg() { new Thread(new Runnable() { @Override public void run() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { pack(); setVisible(true); } }); try { Thread.sleep(show_time); } catch (InterruptedException e) { e.printStackTrace(); } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dispose(); } }); } }).start(); } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); contentPane.setBackground(new Color(-328966)); contentPane.setMinimumSize(new Dimension(57, 10)); contentPane.setOpaque(true); contentPane.setPreferredSize(new Dimension(57, 10)); labMsg = new JLabel(); labMsg.setText("Label"); contentPane.add(labMsg, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }