/* (@)JInternalFrameMinimizeTestGui.java */
/* Copyright 2010 Sebastian Haufe
* 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
[url]http://www.apache.org/licenses/LICENSE-2.0[/url]
* 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 com.ebenius;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.*;
/**
* Test Gui for simple JInternalFrame fun.
*
* @version $Revision$ as of $Date$
* @author Sebastian Haufe
* @since Playground-3.8
*/
public class JInternalFrameMinimizeTestGui {
/** Creates the GUI. Call on EDT, only! */
static void createAndShowGui() {
/* internal frame 1 */
final JInternalFrame internalFrame1 =
new JInternalFrame("Internal 1", true, true, true, true);
internalFrame1.setContentPane(new JScrollPane(new JTable(30, 10)));
internalFrame1.pack();
internalFrame1.setLocation(170, 90);
internalFrame1.setVisible(true);
/* internal frame 2 */
final JInternalFrame internalFrame2 =
new JInternalFrame("Internal 2", true, true, true, true);
internalFrame2.setContentPane(new JScrollPane(new JTree()));
internalFrame2.pack();
internalFrame2.setLocation(30, 30);
internalFrame2.setVisible(true);
/* desktop pane with internal frames */
final JDesktopPane desktopPane = new JDesktopPane();
desktopPane.add(internalFrame1);
desktopPane.add(internalFrame2);
desktopPane.setPreferredSize(new Dimension(800, 600));
/* test frame */
final JPanel contentPane = new JPanel(new BorderLayout(6, 6));
contentPane.add(desktopPane);
final JFrame f = new JFrame("Test Frame: JInternalFrameMinimizeTestGui"); //$NON-NLS-1$
f.setContentPane(contentPane);
f.pack();
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setVisible(true);
}
/** @param args ignored */
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {
System.err.println("System Look and Feel not loaded!");
ex.printStackTrace();
}
createAndShowGui();
}
});
}
}