Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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 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 org.apache.cayenne.modeler.dialog;
 import java.awt.Color;
 import  org.apache.cayenne.util.LocalizedStringsHandler;
 import  org.apache.cayenne.util.Util;
 import  org.scopemvc.util.UIStrings;

Displays the Cayenne license and build information.
 // Implementation note - the data displayed here is 
 // static and very simple, so there is no need to implement complex Scope MVC 
 // triad, though it might be beneficial to use strings file
 public class AboutDialog extends JFrame implements FocusListenerKeyListenerMouseListener {
     private JLabel licenseinfo;
     private static String infoString;
     private static ImageIcon logoImage;
     static synchronized ImageIcon getLogoImage() {
         if ( == null) {
              = ModelerUtil.buildIcon("logo.jpg");
         return ;

Builds and returns CayenneModeler info string.
     static synchronized String getInfoString() {
         if ( == null) {
             StringBuffer buffer = new StringBuffer();
             buffer.append("<font size='-1' face='Arial,Helvetica'>");
             buffer.append("<font size='-2' face='Arial,Helvetica'>");
             buffer.append("<br>JVM: " + System.getProperty("") + " " + 
             String version = LocalizedStringsHandler.getString("cayenne.version");
             if (version != null) {
                 buffer.append("<br>Version: ").append(version);
             String buildDate = LocalizedStringsHandler.getString("");
             if (!Util.isEmptyString(buildDate)) {
                 buffer.append(" (").append(buildDate).append(")");
              = buffer.toString();
         return ;
     public AboutDialog() {
        final FlowLayout flowLayout = new FlowLayout();
        setLocationRelativeTo(null); // centre on screen
        final JPanel panel = new JPanel();
        panel.setLayout(new GridBagLayout());
        JLabel image = new JLabel(getLogoImage());
        panel.add(imagenew GridBagConstraints());
         = new JLabel();
        final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
        gridBagConstraints_1.fill = .;
        gridBagConstraints_1.anchor = .;
        gridBagConstraints_1.gridx = 0;
        gridBagConstraints_1.gridy = 1;
        gridBagConstraints_1.insets = new Insets(0, 12, 0, 0);
        .setText("<html><font size='-1' face='Arial,Helvetica'>Available under the Apache license.</font></html>");
         = new JLabel();
        final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
        gridBagConstraints_2.fill = .;
        gridBagConstraints_2.anchor = .;
        gridBagConstraints_2.gridx = 0;
        gridBagConstraints_2.gridy = 2;
        gridBagConstraints_2.insets = new Insets(6, 12, 12, 12);
    public void keyPressed(KeyEvent e) {
    public void focusLost(FocusEvent e) {
    public void focusGained(FocusEvent e) {
    public void keyReleased(KeyEvent e) {
    public void keyTyped(KeyEvent e) {
    public void mouseClicked(MouseEvent e) {
    public void mouseEntered(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    public void mousePressed(MouseEvent e) {
    public void mouseReleased(MouseEvent e) {
New to GrepCode? Check out our FAQ X