001: package Schmortopf.Main.MainUIComponents;
002:
003: import javax.swing.*;
004: import javax.swing.border.*;
005: import javax.swing.event.*;
006: import javax.swing.text.*;
007: import java.applet.*;
008: import java.awt.*;
009: import java.io.*;
010: import java.net.*;
011: import java.util.*;
012: import java.awt.event.*;
013: import java.beans.*;
014:
015: import Schmortopf.Utility.gui.*;
016: import Schmortopf.Main.IDE_MainFrameProvider;
017:
018: // IDE development test only:
019: //import Schmortopf.Main.MainUIComponents.TestDirectory.TestObject;
020:
021: public class AboutFrame extends JInternalFrame {
022:
023: public AboutFrame(final JFrame parentFrame,
024: final IDE_MainFrameProvider mainFrameProvider) {
025: super (" About", true, true, true, false);
026:
027: //Set the icon of this frame
028: ImageIcon frameIcon = mainFrameProvider
029: .loadImageIcon("pics/schmortopf_frame.jpg");
030: if (frameIcon != null)
031: this .setFrameIcon(frameIcon);
032: final JPanel topBackgroundPanel = new EFCNSmoothBackgroundPanel(
033: new BorderLayout(0, 0),
034: EFCNSmoothBackgroundPanel.PanelBackGroundColorIdentifier,
035: EFCNSmoothBackgroundPanel.SmoothCenterMode);
036: JPanel topPanel = new JPanel(new FlowLayout());
037: JPanel centerPanel = new JPanel(new BorderLayout());
038: EFCNVerticalBackgroundPanel bottomPanel = new EFCNVerticalBackgroundPanel(
039: new FlowLayout());
040:
041: topPanel.setOpaque(false);
042: topBackgroundPanel.add(topPanel, BorderLayout.CENTER);
043:
044: // make the first route to the Close button, so it should get
045: // initial focus :
046:
047: this .getContentPane().setLayout(new BorderLayout());
048: this .getContentPane().add(bottomPanel, BorderLayout.SOUTH);
049: this .getContentPane().add(topBackgroundPanel,
050: BorderLayout.NORTH);
051: this .getContentPane().add(centerPanel, BorderLayout.CENTER);
052:
053: JSenseButton closeButton = new JSenseButton(" Close ",
054: true, mainFrameProvider);
055: closeButton.setIcon(mainFrameProvider
056: .loadImageIcon("pics/menupics/ok.gif"));
057: closeButton.addActionListener(new ActionListener() {
058: public void actionPerformed(ActionEvent e) {
059: setVisible(false);
060: dispose();
061: }
062: });
063: bottomPanel.add(closeButton);
064:
065: int gap = parentFrame.getFont().getSize();
066:
067: JLabel imageLabel = new JLabel();
068: ImageIcon imageLogo = mainFrameProvider
069: .loadImageIcon("pics/about.jpg");
070: imageLabel.setIcon(imageLogo);
071: // Give more packed size by adding some width here :
072: imageLabel.setBorder(BorderFactory.createEmptyBorder(gap,
073: 10 * gap, gap, 10 * gap));
074: topPanel.add(imageLabel);
075:
076: NonFocusBackgroundTextArea textArea = new NonFocusBackgroundTextArea();
077: textArea.setEditable(false);
078: textArea.setLineWrap(true);
079: textArea.setWrapStyleWord(true);
080: textArea.setPreferredSize(new Dimension(44 * gap, 18 * gap));
081: Border outb = BorderFactory.createLoweredBevelBorder();
082: Border inb = BorderFactory.createEmptyBorder(0, gap, 0, gap);
083: textArea.setBorder(BorderFactory
084: .createCompoundBorder(outb, inb));
085: JScrollPane scrollPane = new JScrollPane(textArea);
086: centerPanel.add(scrollPane, BorderLayout.CENTER);
087:
088: // Now fill in the textArea content :
089: textArea
090: .append("Schmortopf is a freeware Java Development Environment. ");
091: textArea
092: .append("It can be downloaded from http://www.snowraver.org . The complete source code also is available for free.\n\n");
093: textArea.append("Contact: jplaz@bluewin.ch [et.al]\n\n");
094: textArea.append("No copyrights | No rights reserved.");
095:
096: // FIRST set the size with pack :
097: //int s = UIManager.getFont("TextField.font").getSize();
098: //this.setSize( 40*s, 36*s );
099:
100: this .pack();
101:
102: this .setVisible(true);
103:
104: // THEN center the dialog on the screen :
105: int pWidth = parentFrame.getContentPane().getWidth();
106: int pHeight = parentFrame.getContentPane().getHeight();
107: int x = (pWidth - this .getWidth()) / 2;
108: int y = (pHeight - this .getHeight()) / 2;
109: this .setLocation(x, y);
110:
111: //final FocusManager f = FocusManager.getCurrentManager();
112: //f.focusNextComponent(closeButton);
113:
114: closeButton.requestFocus();
115:
116: ActionListener escapeActionListener = new ActionListener() {
117: public void actionPerformed(ActionEvent e) {
118: setVisible(false);
119: }
120: };
121: this .getRootPane().registerKeyboardAction(escapeActionListener,
122: KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true),
123: JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
124: } // constructor
125:
126: } // AboutFrame
|