Example usage for java.awt Font getSize

List of usage examples for java.awt Font getSize

Introduction

In this page you can find the example usage for java.awt Font getSize.

Prototype

public int getSize() 

Source Link

Document

Returns the point size of this Font , rounded to an integer.

Usage

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

public void setSelectedFont(Font selectedFont) {
    this.selectedFont = selectedFont;

    fontNameTextLabel.setText(selectedFont.getFamily());
    fontSizeTextLabel.setText("" + selectedFont.getSize());
    setFontStyleText(selectedFont.getStyle());

    invalidate();//  ww w. j a v a2 s .c o  m
    validate();
    repaint();
}

From source file:VASSAL.launch.ModuleManagerWindow.java

public ModuleManagerWindow() {
    setTitle("VASSAL");
    setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));

    ApplicationIcons.setFor(this);

    final AbstractAction shutDownAction = new AbstractAction() {
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
            if (!AbstractLaunchAction.shutDown())
                return;

            final Prefs gl = Prefs.getGlobalPrefs();
            try {
                gl.write();//from  w ww.  j av a  2s.co  m
                gl.close();
            } catch (IOException ex) {
                WriteErrorDialog.error(ex, gl.getFile());
            } finally {
                IOUtils.closeQuietly(gl);
            }

            logger.info("Exiting");
            System.exit(0);
        }
    };
    shutDownAction.putValue(Action.NAME, Resources.getString(Resources.QUIT));

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            shutDownAction.actionPerformed(null);
        }
    });

    // setup menubar and actions
    final MenuManager mm = MenuManager.getInstance();
    final MenuBarProxy mb = mm.getMenuBarProxyFor(this);

    // file menu
    final MenuProxy fileMenu = new MenuProxy(Resources.getString("General.file"));
    fileMenu.setMnemonic(Resources.getString("General.file.shortcut").charAt(0));

    fileMenu.add(mm.addKey("Main.play_module"));
    fileMenu.add(mm.addKey("Main.edit_module"));
    fileMenu.add(mm.addKey("Main.new_module"));
    fileMenu.add(mm.addKey("Main.import_module"));
    fileMenu.addSeparator();

    if (!SystemUtils.IS_OS_MAC_OSX) {
        fileMenu.add(mm.addKey("Prefs.edit_preferences"));
        fileMenu.addSeparator();
        fileMenu.add(mm.addKey("General.quit"));
    }

    // tools menu
    final MenuProxy toolsMenu = new MenuProxy(Resources.getString("General.tools"));

    // Initialize Global Preferences
    Prefs.getGlobalPrefs().getEditor().initDialog(this);
    Prefs.initSharedGlobalPrefs();

    final BooleanConfigurer serverStatusConfig = new BooleanConfigurer(SHOW_STATUS_KEY, null, Boolean.FALSE);
    Prefs.getGlobalPrefs().addOption(null, serverStatusConfig);

    dividerLocationConfig = new IntConfigurer(DIVIDER_LOCATION_KEY, null, -10);
    Prefs.getGlobalPrefs().addOption(null, dividerLocationConfig);

    toolsMenu.add(new CheckBoxMenuItemProxy(new AbstractAction(Resources.getString("Chat.server_status")) {
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
            serverStatusView.toggleVisibility();
            serverStatusConfig.setValue(serverStatusConfig.booleanValue() ? Boolean.FALSE : Boolean.TRUE);
            if (serverStatusView.isVisible()) {
                setDividerLocation(getPreferredDividerLocation());
            }
        }
    }, serverStatusConfig.booleanValue()));

    // help menu
    final MenuProxy helpMenu = new MenuProxy(Resources.getString("General.help"));
    helpMenu.setMnemonic(Resources.getString("General.help.shortcut").charAt(0));

    helpMenu.add(mm.addKey("General.help"));
    helpMenu.add(mm.addKey("Main.tour"));
    helpMenu.addSeparator();
    helpMenu.add(mm.addKey("UpdateCheckAction.update_check"));
    helpMenu.add(mm.addKey("Help.error_log"));

    if (!SystemUtils.IS_OS_MAC_OSX) {
        helpMenu.addSeparator();
        helpMenu.add(mm.addKey("AboutScreen.about_vassal"));
    }

    mb.add(fileMenu);
    mb.add(toolsMenu);
    mb.add(helpMenu);

    // add actions
    mm.addAction("Main.play_module", new Player.PromptLaunchAction(this));
    mm.addAction("Main.edit_module", new Editor.PromptLaunchAction(this));
    mm.addAction("Main.new_module", new Editor.NewModuleLaunchAction(this));
    mm.addAction("Main.import_module", new Editor.PromptImportLaunchAction(this));
    mm.addAction("Prefs.edit_preferences", Prefs.getGlobalPrefs().getEditor().getEditAction());
    mm.addAction("General.quit", shutDownAction);

    URL url = null;
    try {
        url = new File(Documentation.getDocumentationBaseDir(), "README.html").toURI().toURL();
    } catch (MalformedURLException e) {
        ErrorDialog.bug(e);
    }
    mm.addAction("General.help", new ShowHelpAction(url, null));

    mm.addAction("Main.tour", new LaunchTourAction(this));
    mm.addAction("AboutScreen.about_vassal", new AboutVASSALAction(this));
    mm.addAction("UpdateCheckAction.update_check", new UpdateCheckAction(this));
    mm.addAction("Help.error_log", new ShowErrorLogAction(this));

    setJMenuBar(mm.getMenuBarFor(this));

    // Load Icons
    moduleIcon = new ImageIcon(getClass().getResource("/images/mm-module.png"));
    activeExtensionIcon = new ImageIcon(getClass().getResource("/images/mm-extension-active.png"));
    inactiveExtensionIcon = new ImageIcon(getClass().getResource("/images/mm-extension-inactive.png"));
    openGameFolderIcon = new ImageIcon(getClass().getResource("/images/mm-gamefolder-open.png"));
    closedGameFolderIcon = new ImageIcon(getClass().getResource("/images/mm-gamefolder-closed.png"));
    fileIcon = new ImageIcon(getClass().getResource("/images/mm-file.png"));

    // build module controls
    final JPanel moduleControls = new JPanel(new BorderLayout());
    modulePanelLayout = new CardLayout();
    moduleView = new JPanel(modulePanelLayout);
    buildTree();
    final JScrollPane scroll = new JScrollPane(tree);
    moduleView.add(scroll, "modules");

    final JEditorPane l = new JEditorPane("text/html", Resources.getString("ModuleManager.quickstart"));
    l.setEditable(false);

    // Try to get background color and font from LookAndFeel;
    // otherwise, use dummy JLabel to get color and font.
    Color bg = UIManager.getColor("control");
    Font font = UIManager.getFont("Label.font");

    if (bg == null || font == null) {
        final JLabel dummy = new JLabel();
        if (bg == null)
            bg = dummy.getBackground();
        if (font == null)
            font = dummy.getFont();
    }

    l.setBackground(bg);
    ((HTMLEditorKit) l.getEditorKit()).getStyleSheet()
            .addRule("body { font: " + font.getFamily() + " " + font.getSize() + "pt }");

    l.addHyperlinkListener(BrowserSupport.getListener());

    // FIXME: use MigLayout for this!
    // this is necessary to get proper vertical alignment
    final JPanel p = new JPanel(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.CENTER;
    p.add(l, c);

    moduleView.add(p, "quickStart");
    modulePanelLayout.show(moduleView, getModuleCount() == 0 ? "quickStart" : "modules");
    moduleControls.add(moduleView, BorderLayout.CENTER);
    moduleControls.setBorder(new TitledBorder(Resources.getString("ModuleManager.recent_modules")));

    add(moduleControls);

    // build server status controls
    final ServerStatusView serverStatusControls = new ServerStatusView(new CgiServerStatus());
    serverStatusControls.setBorder(new TitledBorder(Resources.getString("Chat.server_status")));

    serverStatusView = new ComponentSplitter().splitRight(moduleControls, serverStatusControls, false);
    serverStatusView.revalidate();

    // show the server status controls according to the prefs
    if (serverStatusConfig.booleanValue()) {
        serverStatusView.showComponent();
    }

    setDividerLocation(getPreferredDividerLocation());
    serverStatusView.addPropertyChangeListener("dividerLocation", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            setPreferredDividerLocation((Integer) e.getNewValue());
        }
    });

    final Rectangle r = Info.getScreenBounds(this);
    serverStatusControls.setPreferredSize(new Dimension((int) (r.width / 3.5), 0));

    setSize(3 * r.width / 4, 3 * r.height / 4);

    // Save/load the window position and size in prefs
    final PositionOption option = new PositionOption(PositionOption.key + "ModuleManager", this);
    Prefs.getGlobalPrefs().addOption(option);
}

From source file:GUI.MainWindow.java

/**
 * Reduces the font size to a minimum of 10.
 *
 * This is also saved in the properties file and persists on next run
 *
 * @param evt//from ww  w . j av a  2s .  c om
 */
private void decreaseFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_decreaseFontActionPerformed
    System.out.println("Decrease Font Selected");
    // Get the current size from the title.
    Font currentfont = this.VulnTitleTextField.getFont();
    int currentsize = currentfont.getSize();
    System.out.println("The current font size was: " + currentsize);
    int newsize = currentsize - 2;
    System.out.println("The new size looks a bit like: " + newsize);
    if (newsize >= 10) {

        // Save this into the preferences
        this.properties.setProperty("Font_Size", newsize + "");
        savePreferences();
        // Update GUI
        helper.setFontSize(currentfont, this.getRootPane());

    } else {
        System.out.println("Minimum font size is 10");
    }
}

From source file:GUI.MainWindow.java

/**
 * This increases the font size up to a range of 30. It was smaller but then
 * I saw a 4k monitor and found that java does *not* scale well at all. Best
 * solution seemed to be to simply allow a more generous text size.
 *
 * This also is saved in the properties file and persists on next run
 *
 * @param evt//  w w  w .ja  va 2  s . c  om
 */
private void increaseFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_increaseFontActionPerformed
    System.out.println("Increase Font Selected");
    // Get the current size from the title.
    Font currentfont = this.VulnTitleTextField.getFont();
    int currentsize = currentfont.getSize();
    System.out.println("The current font size was: " + currentsize);
    int newsize = currentsize + 2;
    System.out.println("The new size looks a bit like: " + newsize);
    if (newsize <= 30) {

        // Save this into the preferences
        this.properties.setProperty("Font_Size", newsize + "");
        savePreferences();
        // Update GUI
        helper.setFontSize(currentfont, this.getRootPane());

    } else {
        System.out.println("Maximum font size is 30");
    }

}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * @param key/*from   w  w w . j ava 2 s .  c  o  m*/
 * @return
 */
public static JButton createMiniI18NBtn(final String key) {
    JButton btn;
    if (isMacOS()) {
        btn = createButton(getResourceString(key));
        btn.putClientProperty("JComponent.sizeVariant", CONTROLSIZE.mini.toString());

    } else {
        btn = createButton(getResourceString(key));
        Font defFont = UIRegistry.getDefaultFont();
        Font baseFont = UIRegistry.getDefaultFont();
        Font btnFont = baseFont.getSize() < defFont.getSize() ? baseFont
                : baseFont.deriveFont(defFont.getSize() - 2f);
        btn.setFont(btnFont);
    }
    return btn;
}

From source file:at.tuwien.ifs.somtoolbox.apps.viewer.GeneralUnitPNode.java

/**
 * Initializes text labels for this node. The labels are displayed in a virtual table like structure.
 * /*www .ja va 2s . c o  m*/
 * @param numLabels Number of labels to be shown. If '-1' the limit is set to the number of labels in unit
 *            description file.
 * @param numCol Number of table columns. Setting to '1' means row table.
 * @param fontSize Font size to use for drawing labels
 * @param length Maximum label length, longer labels will be trunkated
 */
private PNode initLabels(int numLabels, final int numCol, final int fontSize, final int length) {
    // -1 means we want to show all labels. additionally check if we have enough labels...
    if (numLabels == -1 || u.getLabels().length < numLabels) {
        numLabels = u.getLabels().length;
    }

    PNode labelsNode = new PNode();
    if (u.getLabels() != null) {
        Font labelsFont = new Font("Sans", Font.PLAIN, fontSize);

        double xOffset[] = new double[numCol];
        for (int i = 0; i < numCol; i++) {
            xOffset[i] = 2 + i * width / numCol;
        }
        double yOffset = 2;
        int columnIndex = 0;

        for (int i = 0; i < numLabels; i++) {
            PText label = new PText(u.getLabels()[i].getName());
            label.setPickable(false);
            // TODO: find a better way to set the colour. maybe the current palette can give the preferred label
            // colour?
            if (state.exactUnitPlacement && getMapPNode().getCurrentVisualization() == null) { // white labels for
                // sky vis
                label.setTextPaint(Color.WHITE);
            } else {
                label.setTextPaint(Color.BLACK);
            }
            label.setFont(labelsFont);
            label.setOffset(xOffset[columnIndex], yOffset); // (i * labelsFont.getSize()) + 2
            label.addAttribute("tooltip",
                    u.getLabels()[i].getName() + "\nqe: " + StringUtils.format(u.getLabels()[i].getQe(), 3)
                            + "\nmean: " + StringUtils.format(u.getLabels()[i].getValue(), 3));
            label.addAttribute("type", "label");
            labelsNode.addChild(label);

            if (label.getBoundsReference().getWidth() > width / numCol) {
                label.setText(label.getText().substring(0, Math.min(length, label.getText().length())) + "...");
            }

            if ((i + 1) % numCol == 0) { // Next row
                yOffset += labelsFont.getSize() + 2;
                columnIndex = 0;
            } else { // Next column
                columnIndex++;
            }
        }
    }
    return labelsNode;
}

From source file:spinworld.gui.RadarPlot.java

/**
 * Draws the label for one axis.//  w  ww.java2s  . co m
 *
 * @param g2  the graphics device.
 * @param plotArea  whole plot drawing area (e.g. including space for labels)
 * @param plotDrawingArea  the plot drawing area (just spanning of axis)
 * @param value  the value of the label (ignored).
 * @param cat  the category (zero-based index).
 * @param startAngle  the starting angle.
 * @param extent  the extent of the arc.
 */
protected void drawLabel(Graphics2D g2, Rectangle2D plotArea, Rectangle2D plotDrawingArea, double value,
        int cat, double startAngle, double extent) {
    FontRenderContext frc = g2.getFontRenderContext();

    String label = null;
    if (this.dataExtractOrder == TableOrder.BY_ROW) {
        // if series are in rows, then the categories are the column keys
        label = this.labelGenerator.generateColumnLabel(this.dataset, cat);
    } else {
        // if series are in columns, then the categories are the row keys
        label = this.labelGenerator.generateRowLabel(this.dataset, cat);
    }

    double angle = normalize(startAngle);

    Font font = getLabelFont();
    Point2D labelLocation;
    do {
        Rectangle2D labelBounds = font.getStringBounds(label, frc);
        LineMetrics lm = font.getLineMetrics(label, frc);
        double ascent = lm.getAscent();

        labelLocation = calculateLabelLocation(labelBounds, ascent, plotDrawingArea, startAngle);

        boolean leftOut = angle > 90 && angle < 270 && labelLocation.getX() < plotArea.getX();
        boolean rightOut = (angle < 90 || angle > 270)
                && labelLocation.getX() + labelBounds.getWidth() > plotArea.getX() + plotArea.getWidth();

        if (leftOut || rightOut) {
            font = font.deriveFont(font.getSize2D() - 1);
        } else {
            break;
        }
    } while (font.getSize() > 8);

    Composite saveComposite = g2.getComposite();

    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
    g2.setPaint(getLabelPaint());
    g2.setFont(font);
    g2.drawString(label, (float) labelLocation.getX(), (float) labelLocation.getY());
    g2.setComposite(saveComposite);
}

From source file:pl.edu.icm.visnow.geometries.viewer3d.Display3DPanel.java

public void drawLocal2D(J3DGraphics2D vGraphics, LocalToWindow ltw, int w, int h) {
    if (titles == null || titles.isEmpty()) {
        return;/*from  w  w  w  .j av a 2s.  c o m*/
    }
    Font f = vGraphics.getFont();
    Color c = vGraphics.getColor();
    for (Title title : titles) {
        float fh = h * title.getFontHeight();
        if (fh < 5) {
            fh = 5;
        }
        Font actualFont = title.getFont().deriveFont(fh);
        vGraphics.setFont(actualFont);
        FontMetrics fm = vGraphics.getFontMetrics();
        int strWidth = fm.stringWidth(title.getTitle());
        vGraphics.setColor(title.getColor());
        int xPos = w / 50;
        if (title.getHorizontalPosition() == Title.CENTER) {
            xPos = (w - strWidth) / 2;
        }
        if (title.getHorizontalPosition() == Title.RIGHT) {
            xPos = w - strWidth - getWidth() / 50;
        }
        vGraphics.drawString(title.getTitle(), xPos,
                (int) (effectiveHeight * title.getVerticalPosition()) + actualFont.getSize());
    }
    vGraphics.setFont(f);
    vGraphics.setColor(c);
}

From source file:org.rapidcontext.app.ui.ControlPanel.java

/**
 * Initializes the panel UI.//from   w ww.  j a va2  s. co  m
 */
private void initialize() {
    Rectangle bounds = new Rectangle();
    GridBagConstraints c;
    JLabel label;
    Font font;
    Properties info;
    String str;

    // Set system UI looks
    if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_WINDOWS) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception ignore) {
            // Ah well... at least we tried.
        }
    }

    // Set title, menu & layout
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("RapidContext Server");
    setMenuBar(menuBar);
    initializeMenu();
    getContentPane().setLayout(new GridBagLayout());
    try {
        logotype = ImageIO.read(getClass().getResource("logotype.png"));
        Image img = ImageIO.read(getClass().getResource("logotype-icon-256x256.png"));
        setIconImage(img);
        if (SystemUtils.IS_OS_MAC_OSX) {
            MacApplication.get().setDockIconImage(img);
        }
    } catch (Exception ignore) {
        // Again, we only do our best effort here
    }

    // Add logotype
    c = new GridBagConstraints();
    c.gridheight = 5;
    c.insets = new Insets(6, 15, 10, 10);
    c.anchor = GridBagConstraints.NORTHWEST;
    Image small = logotype.getScaledInstance(128, 128, Image.SCALE_SMOOTH);
    getContentPane().add(new JLabel(new ImageIcon(small)), c);

    // Add link label
    c = new GridBagConstraints();
    c.gridx = 1;
    c.insets = new Insets(10, 10, 2, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(new JLabel("Server URL:"), c);
    serverLink.setText("http://localhost:" + server.port + "/");
    serverLink.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            try {
                AppUtils.openURL(serverLink.getText());
            } catch (Exception e) {
                error(e.getMessage());
            }
        }
    });
    c = new GridBagConstraints();
    c.gridx = 2;
    c.weightx = 1.0;
    c.insets = new Insets(10, 0, 2, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(serverLink, c);

    // Add login info label
    label = new JLabel("Login as 'admin' on a new server.");
    font = label.getFont();
    font = font.deriveFont(Font.ITALIC, font.getSize() - 2);
    label.setFont(font);
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 1;
    c.gridwidth = 2;
    c.insets = new Insets(0, 0, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(label, c);

    // Add status label
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 2;
    c.insets = new Insets(0, 10, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(new JLabel("Status:"), c);
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 2;
    c.insets = new Insets(0, 0, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(statusLabel, c);

    // Add version label
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 3;
    c.insets = new Insets(0, 10, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(new JLabel("Version:"), c);
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 3;
    c.insets = new Insets(0, 0, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    info = Main.buildInfo();
    str = info.getProperty("build.version") + " (built " + info.getProperty("build.date") + ")";
    getContentPane().add(new JLabel(str), c);

    // Add buttons
    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            start();
        }
    });
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 4;
    c.weighty = 1.0;
    c.insets = new Insets(0, 10, 10, 10);
    c.anchor = GridBagConstraints.SOUTH;
    getContentPane().add(startButton, c);
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            stop();
        }
    });
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 4;
    c.weighty = 1.0;
    c.insets = new Insets(0, 0, 10, 0);
    c.anchor = GridBagConstraints.SOUTHWEST;
    getContentPane().add(stopButton, c);

    // Set size & position
    pack();
    bounds = this.getBounds();
    bounds.width = 470;
    bounds.x = 100;
    bounds.y = 100;
    setBounds(bounds);
}

From source file:com.nikonhacker.gui.EmulatorUI.java

private void showAboutDialog() {
    // for copying style
    JLabel label = new JLabel();
    Font font = label.getFont();

    // create some css from the label's font
    String style = "font-family:" + font.getFamily() + ";" + "font-weight:"
            + (font.isBold() ? "bold" : "normal") + ";" + "font-size:" + font.getSize() + "pt;";

    // html content
    JEditorPane editorPane = new JEditorPane("text/html", "<html><body style=\"" + style + "\">"
            + "<font size=\"+1\">" + ApplicationInfo.getNameVersion() + "</font><br/>"
            + "<i>A dual (Fujitsu FR + Toshiba TX) microcontroller emulator in Java, aimed at mimicking the behaviour of Nikon DSLRs</i><br/>"
            + "<font size=\"-2\">Built on " + ApplicationInfo.getBuildTime() + "</font><br/><br/>"
            + "This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.<br/>"
            + "This software is provided under the GNU General Public License, version 3 - "
            + makeLink("http://www.gnu.org/licenses/gpl-3.0.txt") + "<br/>"
            + "This software is based on, or makes use of, the following works:<ul>\n"
            + "<li>Simeon Pilgrim's deciphering of firmware encoding and lots of information shared on his blog - "
            + makeLink("http://simeonpilgrim.com/blog/") + "</li>"
            + "<li>Dfr Fujitsu FR diassembler Copyright (c) Kevin Schoedel - "
            + makeLink("http://scratchpad.wikia.com/wiki/Disassemblers/DFR")
            + "<br/>and its port to C# by Simeon Pilgrim</li>"
            + "<li>\"How To Write a Computer Emulator\" article by Marat Fayzullin - "
            + makeLink("http://fms.komkon.org/EMUL8/HOWTO.html") + "</li>"
            + "<li>The PearColator x86 emulator project - "
            + makeLink("http://apt.cs.man.ac.uk/projects/jamaica/tools/PearColator/") + "</li>"
            + "<li>The Jacksum checksum library Copyright (c) Dipl.-Inf. (FH) Johann Nepomuk Lfflmann  - "
            + makeLink("http://www.jonelo.de/java/jacksum/") + "</li>"
            + "<li>HexEditor & RSyntaxTextArea swing components, Copyright (c) Robert Futrell - "
            + makeLink("http://fifesoft.com/hexeditor/") + "</li>"
            + "<li>JGraphX graph drawing library, Copyright (c) JGraph Ltd - "
            + makeLink("http://www.jgraph.com/jgraph.html") + "</li>"
            + "<li>Apache commons libraries, Copyright (c) The Apache Software Foundation - "
            + makeLink("http://commons.apache.org/") + "</li>"
            + "<li>VerticalLayout, Copyright (c) Cellspark - " + makeLink("http://www.cellspark.com/vl.html")
            + "</li>" + "<li>MigLayout, Copyright (c) MigInfoCom - " + makeLink("http://www.miginfocom.com/")
            + "</li>" + "<li>Glazed Lists, Copyright (c) 2003-2006, publicobject.com, O'Dell Engineering Ltd - "
            + makeLink("http://www.glazedlists.com/") + "</li>"
            + "<li>Samples from the Java Tutorial (c) Sun Microsystems / Oracle - "
            + makeLink("http://docs.oracle.com/javase/tutorial") + "</li>"
            + "<li>MARS, MIPS Assembler and Runtime Simulator (c) 2003-2011, Pete Sanderson and Kenneth Vollmar - "
            + makeLink("http://courses.missouristate.edu/KenVollmar/MARS") + "</li>"
            + "<li>SteelSeries (and SteelCheckBox) Swing components (c) 2010, Gerrit Grunwald - "
            + makeLink("http://harmoniccode.blogspot.be/search/label/steelseries") + "</li>" + "</ul>"
            + "License terms for all included code are available in the 'licenses' folder of the distribution."
            + "<p>For more information, help or ideas, please join us at " + makeLink("http://nikonhacker.com")
            + "</p></body></html>");

    // handle link events
    editorPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (Exception e1) {
                    // noop
                }/*from www .j  av a  2 s  . co  m*/
            }
        }
    });
    editorPane.setEditable(false);
    Color greyLayer = new Color(label.getBackground().getRed(), label.getBackground().getGreen(),
            label.getBackground().getBlue(), 192);
    editorPane.setBackground(greyLayer);
    //editorPane.setOpaque(false);

    // show
    //        JOptionPane.showMessageDialog(this, editorPane, "About", JOptionPane.PLAIN_MESSAGE);

    final JDialog dialog = new JDialog(this, "About", true);

    JPanel contentPane = new BackgroundImagePanel(new BorderLayout(),
            Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_full.jpg")));
    contentPane.add(editorPane, BorderLayout.CENTER);

    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
        }
    });
    JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    bottomPanel.add(okButton);
    bottomPanel.setBackground(greyLayer);
    // bottomPanel.setOpaque(false);

    contentPane.add(bottomPanel, BorderLayout.SOUTH);

    dialog.setContentPane(contentPane);
    dialog.pack();
    dialog.setLocationRelativeTo(this);
    dialog.setResizable(false);
    dialog.setVisible(true);
}