Example usage for java.awt Font getStyle

List of usage examples for java.awt Font getStyle

Introduction

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

Prototype

public int getStyle() 

Source Link

Document

Returns the style of this Font .

Usage

From source file:storybook.SbApp.java

public void setDefaultFont(Font font) {
    if (font == null) {
        return;//w  w  w. j  a  va 2 s  . co  m
    }
    defaultFont = font;
    resetUiFont();
    PrefUtil.set(PreferenceKey.DEFAULT_FONT_NAME, font.getName());
    PrefUtil.set(PreferenceKey.DEFAULT_FONT_SIZE, font.getSize());
    PrefUtil.set(PreferenceKey.DEFAULT_FONT_STYLE, font.getStyle());
}

From source file:TrabajoFinalJava.DescargaFichero.java

@Override
public void run() {

    //************************INICIO****INTERFAZ**************************************************************************

    JFrame principal = new JFrame("GESTOR DESCARGAS");
    //Colores/*from  www. j  a  v  a 2  s.  c  om*/

    Color nuevoColor = new Color(167, 220, 231);

    principal.getContentPane().setBackground(nuevoColor);

    JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS");
    JLabel tituloVentana = new JLabel("DESCARGA FICHERO FTP");
    //Recojo la fuente que se esta utilizando actualmente.
    Font auxFont = tituloPrincipal.getFont();

    //Aplico la fuente actual, y al final le doy el tamao del texto...
    tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    //tituloVentana.setAlignmentY(0);

    JLabel nombreArchivo = new JLabel("INTRODUCE EL NOMBRE DEL FICHERO A DESCARGAR.");
    JTextField nombreArchivoIn = new JTextField();
    JButton descarga = new JButton("DESCARGA FICHERO.");
    JButton atras = new JButton("ATRAS");

    JButton salir = new JButton("Salir");

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();

    //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X.
    principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Asignamos al JFrame el Layout que usaremos, GridBagLayout
    principal.setLayout(gridbag);
    //aadir botones al layout

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(tituloPrincipal, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.NONE;
    principal.add(tituloVentana, gbc);

    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(nombreArchivo, gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(nombreArchivoIn, gbc);

    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(descarga, gbc);

    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(atras, gbc);

    gbc.gridx = 1;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(salir, gbc);

    //Hace visible el panel
    principal.setVisible(true);
    principal.setSize(650, 350);
    principal.setLocationRelativeTo(null);
    principal.setResizable(false);
    //principal.pack();

    descarga.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (descargasUsuarioLog <= 9) {
                try {
                    cFtp.connect(ftpSsrver);
                    boolean login = cFtp.login(ftpUser, ftpPass);
                    System.out.print("conexion establecida");

                    cFtp.enterLocalPassiveMode();

                    nombreFichero = nombreArchivoIn.getText();
                    nombrePc = nombreArchivoIn.getText();

                    CrearListaFicheros listarFicheros = new CrearListaFicheros();
                    listarFicheros.start();

                    for (int i = 0; i < CrearListaFicheros.arrayArchivos.size(); i++) {

                        System.out.println(CrearListaFicheros.arrayArchivos.get(i));

                    }

                    if (CrearListaFicheros.arrayArchivos.contains(nombreFichero)) {
                        FTPFile file = cFtp.mlistFile(nombreFichero);
                        long size = file.getSize();
                        System.out.println("Tamao del fichero= " + size);

                        if (size > 1000000) {
                            System.out.println("El fichero es muy grande......");
                        } else {

                            FileOutputStream fos = new FileOutputStream(nombreFichero);
                            cFtp.retrieveFile(nombreFichero, fos);

                            System.out.println("");
                            System.out.println("Archivo recibido");

                            nombreArchivoIn.setBackground(Color.green);
                            descargasUsuarioLog = descargasUsuarioLog + 1;
                            System.out.println(descargasUsuarioLog);

                            //modificamos las descargas totales del usuario en la BBDD
                            Connection conn;

                            try {
                                try {
                                    Class.forName("com.mysql.jdbc.Driver");
                                } catch (Exception y) {
                                    y.printStackTrace();
                                }

                                conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/midb", "root",
                                        "");
                                System.out.println("Conn OK!");

                                stmt = conn.createStatement();

                                stmt.executeUpdate("UPDATE usuarios SET bajadas = '" + descargasUsuarioLog
                                        + "' WHERE usuario = '" + usuarioLog + "';");

                                System.out.print("Descargas modificadas correctamente.");

                                conn.close();
                            } catch (Exception i) {
                                System.out.println(e);
                            }
                        }

                    } else {
                        System.out.println("El fichero no existe...");
                        nombreArchivoIn.setText("El fichero no existe");
                    }

                } catch (IOException r) {
                    r.printStackTrace();
                }

            } else {
                System.out.println(
                        "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias.");
                nombreArchivoIn.setText(
                        "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias.");

            }

        }

    });

    atras.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp();
            accesoFtp.inicioFtp();
            principal.setVisible(false);

        }

    });

    salir.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            System.exit(1000);

        }

    });

}

From source file:TrabajoFinalJava.FormularioVerFicheros.java

public void run() {

    //************************INICIO****INTERFAZ**************************************************************************

    JFrame principal = new JFrame("GESTOR DESCARGAS");
    //Colores//from   w w  w  .  j  av a  2s . com

    Color nuevoColor = new Color(167, 220, 231);

    principal.getContentPane().setBackground(nuevoColor);

    JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS");
    JLabel tituloVentana = new JLabel("VER FICHEROS");
    JTextArea cajaFicheros = new JTextArea(12, 20);

    JButton mostrar = new JButton("MOSTRAR FICHEROS");
    JButton atras = new JButton("ATRAS");
    JButton salir = new JButton("SALIR");

    cajaFicheros.setEditable(false);

    //Recojo la fuente que se esta utilizando actualmente.
    Font auxFont = tituloPrincipal.getFont();

    //Aplico la fuente actual, y al final le doy el tamao del texto...
    tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();

    //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X.
    principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Asignamos al JFrame el Layout que usaremos, GridBagLayout

    principal.setLayout(gridbag);

    //aadir botones al layout

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(tituloPrincipal, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(tituloVentana, gbc);

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(new JScrollPane(cajaFicheros), gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(mostrar, gbc);

    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(atras, gbc);

    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(salir, gbc);

    //cajaFicheros.setEditable(false);

    //Hace visible el panel
    principal.setVisible(true);
    principal.setSize(650, 350);
    principal.setLocationRelativeTo(null);
    principal.setResizable(false);
    //principal.pack();

    mostrar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String ftpSsrver = "127.0.0.1";
            String ftpUser = "solera";
            String ftpPass = "solera";

            FTPClient cFtp = new FTPClient();

            try {

                cFtp.connect(ftpSsrver);
                boolean login = cFtp.login(ftpUser, ftpPass);
                System.out.print("conexion ftp para ver ficheros establecida");

                cFtp.enterLocalPassiveMode();

                String[] archivos = cFtp.listNames();
                FTPFile[] detalles = cFtp.listFiles();

                archivos = cFtp.listNames();

                for (int i = 0; i < archivos.length; i++) {
                    /*
                    cajaFicheros.selectAll();
                    cajaFicheros.replaceSelection("");
                    */
                    arrayArchivos.add(archivos[i].toString());
                    System.out.println(arrayArchivos.get(i));
                    cajaFicheros.append(System.getProperty("line.separator"));
                    cajaFicheros.append(arrayArchivos.get(i));

                }

                cFtp.logout();
                cFtp.disconnect();
                System.out.println("Conexion Finalizada, buenas tardes.");
            } catch (IOException ioe) {
                System.out.println("error" + ioe.toString());
            }

        }

    });

    try {
        salir.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                System.exit(0);

            }

        });
    } catch (Exception e) {
    }

    try {
        atras.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp();
                accesoFtp.inicioFtp();
                principal.setVisible(false);

            }

        });
    } catch (Exception e) {
    }

}

From source file:util.program.ProgramTextCreator.java

/**
 *
 * @param prog/*w  w  w.  j  a va  2s . c o  m*/
 *          The Program to show
 * @param doc
 *          The HTMLDocument.
 * @param fieldArr
 *          The object array with the field types.
 * @param tFont
 *          The title Font.
 * @param bFont
 *          The body Font.
 * @param settings
 *          Settings of the ProgramPanel
 * @param showHelpLinks
 *          Show the Help-Links (Quality of Data, ShowView)
 * @param zoom
 *          The zoom value for the picture.
 * @param showPluginIcons
 *          If the plugin icons should be shown.
 * @return The HTML String.
 * @since 3.0
 */
public static String createInfoText(Program prog, ExtendedHTMLDocument doc, Object[] fieldArr, Font tFont,
        Font bFont, ProgramPanelSettings settings, boolean showHelpLinks, int zoom, boolean showPluginIcons,
        boolean showPersonLinks) {
    String debugTables = "0"; //set to "1" for debugging, to "0" for no debugging
    try {
        // NOTE: All field types are included until type 25 (REPETITION_ON_TYPE)
        StringBuilder buffer = new StringBuilder(1024);

        String titleFont, titleSize, bodyFont;

        int bodyStyle;
        int titleStyle;
        if (tFont == null && bFont != null) {
            titleFont = bodyFont = bFont.getFamily();
            titleSize = mBodyFontSize = String.valueOf(bFont.getSize());
            titleStyle = bodyStyle = bFont.getStyle();
        } else if (tFont != null && bFont != null) {
            titleFont = tFont.getFamily();
            bodyFont = bFont.getFamily();
            titleSize = String.valueOf(tFont.getSize());
            mBodyFontSize = String.valueOf(bFont.getSize());
            titleStyle = tFont.getStyle();
            bodyStyle = bFont.getStyle();
        } else {
            return null;
        }

        if (fieldArr == null) {
            return null;
        }

        buffer.append("<html>");
        buffer.append("<table width=\"100%\" border=\"" + debugTables + "\" style=\"font-family:");

        buffer.append(bodyFont);

        buffer.append(";").append(getCssStyle(bodyStyle)).append("\"><tr>");
        buffer.append("<td width=\"60\">");
        buffer.append("<p \"align=center\">");

        JLabel channelLogo = new JLabel(prog.getChannel().getIcon());
        channelLogo.setToolTipText(prog.getChannel().getName());
        buffer.append(doc.createCompTag(channelLogo));

        buffer.append(
                "</p></td><td><table width=\"100%\" border=\"" + debugTables + "\" cellpadding=\"0\"><tr><td>");
        buffer.append("<div style=\"color:#ff0000; font-size:");

        buffer.append(mBodyFontSize);

        buffer.append(";\"><b>");

        Date currentDate = Date.getCurrentDate();
        Date programDate = prog.getDate();
        if (programDate.equals(currentDate.addDays(-1))) {
            buffer.append(Localizer.getLocalization(Localizer.I18N_YESTERDAY));
            buffer.append("  ");
        } else if (programDate.equals(currentDate)) {
            buffer.append(Localizer.getLocalization(Localizer.I18N_TODAY));
            buffer.append("  ");
        } else if (programDate.equals(currentDate.addDays(1))) {
            buffer.append(Localizer.getLocalization(Localizer.I18N_TOMORROW));
            buffer.append("  ");
        }
        buffer.append(prog.getDateString());

        buffer.append("  ");
        buffer.append(prog.getTimeString());
        if (prog.getLength() > 0) {
            buffer.append('-');
            buffer.append(prog.getEndTimeString());
        }
        buffer.append("  ");
        buffer.append(prog.getChannel());

        buffer.append("</b></div><div style=\"color:#003366; font-size:");

        buffer.append(titleSize);

        buffer.append("; line-height:2.5em; font-family:");
        buffer.append(titleFont).append(";").append(getCssStyle(titleStyle));
        buffer.append("\">");
        buffer.append(prog.getTitle());
        buffer.append("</div>");

        String episode = CompoundedProgramFieldType.EPISODE_COMPOSITION.getFormattedValueForProgram(prog);

        if (episode != null && episode.trim().length() > 0) {
            buffer.append("<div style=\"color:#808080; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\">");
            buffer.append(episode);
            buffer.append("</div>");
        }

        buffer.append("</td><td align=\"right\" valign=\"top\"><table border=\"" + debugTables + "\"><tr><td>");
        JButton btn = new JButton(TVBrowserIcons.left(TVBrowserIcons.SIZE_SMALL));
        buffer.append(doc.createCompTag(btn));
        btn.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ProgramInfo.getInstance().historyBack();
            }
        });
        btn.setEnabled(ProgramInfo.getInstance().canNavigateBack());
        btn.setToolTipText(ProgramInfo.getInstance().navigationBackwardText());

        buffer.append("</td><td>");
        btn = new JButton(TVBrowserIcons.right(TVBrowserIcons.SIZE_SMALL));
        buffer.append(doc.createCompTag(btn));
        btn.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ProgramInfo.getInstance().historyForward();
            }
        });
        btn.setEnabled(ProgramInfo.getInstance().canNavigateForward());
        btn.setToolTipText(ProgramInfo.getInstance().navigationForwardText());

        buffer.append("</td></tr></table></td></tr></table></td></tr>");

        boolean show = false;

        if (settings.isShowingPictureForPlugins()) {
            String[] pluginIds = settings.getPluginIds();
            Marker[] markers = prog.getMarkerArr();

            if (markers != null && pluginIds != null) {
                for (Marker marker : markers) {
                    for (String pluginId : pluginIds) {
                        if (marker.getId().compareTo(pluginId) == 0) {
                            show = true;
                            break;
                        }
                    }
                }
            }
        }

        Color foreground = Color.black;//Settings.propProgramPanelForegroundColor.getColor();

        if (settings.isShowingPictureEver()
                || (settings.isShowingPictureInTimeRange()
                        && !ProgramUtilities.isNotInTimeRange(settings.getPictureTimeRangeStart(),
                                settings.getPictureTimeRangeEnd(), prog))
                || show
                || (settings.isShowingPictureForDuration() && settings.getDuration() <= prog.getLength())) {
            byte[] image = prog.getBinaryField(ProgramFieldType.PICTURE_TYPE);
            if (image != null) {
                String line = "<tr><td></td><td valign=\"top\" style=\"color:rgb(" + foreground.getRed() + ","
                        + foreground.getGreen() + "," + foreground.getBlue() + "); font-size:0\">";
                buffer.append(line);
                try {
                    ImageIcon imageIcon = new ImageIcon(image);

                    if (zoom != 100) {
                        imageIcon = (ImageIcon) UiUtilities.scaleIcon(imageIcon,
                                imageIcon.getIconWidth() * zoom / 100);
                    }

                    StringBuilder value = new StringBuilder();

                    String textField = prog.getTextField(ProgramFieldType.PICTURE_COPYRIGHT_TYPE);
                    if (textField != null) {
                        value.append(textField);
                    }

                    if (settings.isShowingPictureDescription()) {
                        textField = prog.getTextField(ProgramFieldType.PICTURE_DESCRIPTION_TYPE);
                        if (textField != null) {
                            value.append("<br>").append(textField);
                        }
                    }

                    buffer.append(doc.createCompTag(new JLabel(imageIcon)));
                    buffer.append("<div style=\"font-size:");

                    buffer.append(mBodyFontSize);

                    buffer.append("\">");
                    buffer.append(value);
                    buffer.append("</div>");
                    buffer.append("</td></tr>");
                } catch (Exception e) {
                    // Picture was wrong;
                    buffer.delete(buffer.length() - line.length(), buffer.length());
                }
            }
        }

        Marker[] pluginArr = prog.getMarkerArr();
        if (showPluginIcons && (pluginArr != null) && (pluginArr.length != 0)) {
            addSeparator(doc, buffer);

            buffer.append("<tr><td valign=\"top\" style=\"color:#808080; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\"><b>");
            buffer.append(mLocalizer.msg("markedBy", "Marked by"));
            buffer.append("</b></td><td valign=\"middle\" style=\"font-size:4\">");
            openPara(buffer, "info");

            // Workaround: Without the &nbsp; the component are not put in one line.
            buffer.append("&nbsp;");
            for (int markerCount = pluginArr.length - 1; markerCount >= 0; markerCount--) {
                Icon[] icons = pluginArr[markerCount].getMarkIcons(prog);

                if (icons != null) {
                    for (int i = icons.length - 1; i >= 0; i--) {
                        JLabel iconLabel = new JLabel(icons[i]);
                        PluginAccess plugin = Plugin.getPluginManager()
                                .getActivatedPluginForId(pluginArr[markerCount].getId());
                        if (plugin != null) {
                            iconLabel.setToolTipText(plugin.getInfo().getName());
                        } else {
                            InternalPluginProxyIf internalPlugin = InternalPluginProxyList.getInstance()
                                    .getProxyForId(pluginArr[markerCount].getId());
                            if (internalPlugin != null) {
                                iconLabel.setToolTipText(internalPlugin.getName());
                                if (internalPlugin.equals(FavoritesPluginProxy.getInstance())) {
                                    // if this is a favorite, add the names of the favorite
                                    String favTitles = "";
                                    for (Favorite favorite : FavoriteTreeModel.getInstance()
                                            .getFavoritesContainingProgram(prog)) {
                                        if (favTitles.length() > 0) {
                                            favTitles = favTitles + ", ";
                                        }
                                        favTitles = favTitles + favorite.getName();
                                    }
                                    if (favTitles.length() > 0) {
                                        iconLabel.setToolTipText(
                                                iconLabel.getToolTipText() + " (" + favTitles + ")");
                                    }
                                }
                            } else {
                                iconLabel.setToolTipText(pluginArr[markerCount].toString());
                            }
                        }

                        buffer.append(doc.createCompTag(iconLabel));
                        buffer.append("&nbsp;&nbsp;");
                    }
                }
            }
            closePara(buffer);
            buffer.append("</td></tr>");
        }

        PluginAccess[] plugins = Plugin.getPluginManager().getActivatedPlugins();
        ArrayList<JLabel> iconLabels = new ArrayList<JLabel>();
        for (PluginAccess plugin : plugins) {
            Icon[] icons = plugin.getProgramTableIcons(prog);

            if (icons != null) {
                for (Icon icon : icons) {
                    JLabel iconLabel = new JLabel(icon);
                    iconLabel.setToolTipText(plugin.getInfo().getName());
                    iconLabels.add(iconLabel);
                }
            }
        }

        if (showPluginIcons && iconLabels.size() > 0) {
            addSeparator(doc, buffer);

            buffer.append("<tr><td valign=\"middle\" style=\"color:#808080; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\"><b>");
            buffer.append("Plugin-Icons");
            buffer.append("</b></td><td valign=\"top\" style=\"font-size:4\">");

            openPara(buffer, "info");
            // Workaround: Without the &nbsp; the component are not put in one line.
            buffer.append("&nbsp;");

            for (JLabel iconLabel : iconLabels) {
                buffer.append(doc.createCompTag(iconLabel));
                buffer.append("&nbsp;&nbsp;");
            }

            closePara(buffer);
            buffer.append("</td></tr>");
        }

        addSeparator(doc, buffer);

        for (Object id : fieldArr) {
            ProgramFieldType type = null;

            if (id instanceof String) {
                if (((String) id).matches("\\d+")) {
                    try {
                        type = ProgramFieldType.getTypeForId(Integer.parseInt((String) id, 10));
                    } catch (Exception e) {
                        // Empty Catch
                    }
                }

                if (type == null) {
                    int length = prog.getLength();
                    if (length > 0 && ((String) id).trim().length() > 0) {

                        buffer.append("<tr><td valign=\"top\" style=\"color:gray; font-size:");

                        buffer.append(mBodyFontSize);

                        buffer.append("\"><b>");
                        buffer.append(mLocalizer.msg("duration", "Program duration/<br>-end"));
                        buffer.append("</b></td><td style=\"color:rgb(" + foreground.getRed() + ","
                                + foreground.getGreen() + "," + foreground.getBlue() + "); font-size:");

                        buffer.append(mBodyFontSize);

                        buffer.append("\">");

                        openPara(buffer, "time");

                        String msg = mLocalizer.msg("minutes", "{0} min", length);
                        buffer.append(msg).append(" (");
                        buffer.append(mLocalizer.msg("until", "until {0}", prog.getEndTimeString()));

                        int netLength = prog.getIntField(ProgramFieldType.NET_PLAYING_TIME_TYPE);
                        if (netLength != -1) {
                            msg = mLocalizer.msg("netMinuted", "{0} min net", netLength);
                            buffer.append(" - ").append(msg);
                        }
                        buffer.append(')');

                        closePara(buffer);

                        buffer.append("</td></tr>");
                        addSeparator(doc, buffer);
                    }
                }
            } else if (id instanceof CompoundedProgramFieldType) {
                CompoundedProgramFieldType value = (CompoundedProgramFieldType) id;
                String entry = value.getFormattedValueForProgram(prog);

                if (entry != null) {
                    startInfoSection(buffer, value.getName());
                    buffer.append(HTMLTextHelper.convertTextToHtml(entry, false));

                    addSeparator(doc, buffer);
                }
            } else {
                type = (ProgramFieldType) id;

                if (type == ProgramFieldType.DESCRIPTION_TYPE) {
                    String description = checkDescription(prog.getDescription());
                    if (description != null && description.length() > 0) {
                        addEntry(doc, buffer, prog, ProgramFieldType.DESCRIPTION_TYPE, true, showHelpLinks,
                                showPersonLinks);
                    } else {
                        addEntry(doc, buffer, prog, ProgramFieldType.SHORT_DESCRIPTION_TYPE, true,
                                showHelpLinks, showPersonLinks);
                    }
                } else if (type == ProgramFieldType.INFO_TYPE) {
                    int info = prog.getInfo();
                    if ((info != -1) && (info != 0)) {
                        buffer.append("<tr><td valign=\"top\" style=\"color:gray; font-size:");

                        buffer.append(mBodyFontSize);

                        buffer.append("\"><b>");
                        buffer.append(type.getLocalizedName());
                        buffer.append("</b></td><td valign=\"middle\" style=\"font-size:5\">");

                        openPara(buffer, "info");
                        // Workaround: Without the &nbsp; the component are not put in one
                        // line.
                        buffer.append("&nbsp;");

                        int[] infoBitArr = ProgramInfoHelper.getInfoBits();
                        Icon[] infoIconArr = ProgramInfoHelper.getInfoIcons();
                        String[] infoMsgArr = ProgramInfoHelper.getInfoIconMessages();

                        for (int i = 0; i < infoBitArr.length; i++) {
                            if (ProgramInfoHelper.bitSet(info, infoBitArr[i])) {
                                JLabel iconLabel;

                                if (infoIconArr[i] != null) {
                                    iconLabel = new JLabel(infoIconArr[i]);
                                } else {
                                    iconLabel = new JLabel(infoMsgArr[i]);
                                }

                                iconLabel.setToolTipText(infoMsgArr[i]);
                                buffer.append(doc.createCompTag(iconLabel));

                                buffer.append("&nbsp;&nbsp;");
                            }
                        }

                        closePara(buffer);

                        buffer.append("</td></tr>");
                        addSeparator(doc, buffer);
                    }
                } else if (type == ProgramFieldType.URL_TYPE) {
                    addEntry(doc, buffer, prog, ProgramFieldType.URL_TYPE, true, showHelpLinks,
                            showPersonLinks);
                } else if (type == ProgramFieldType.ACTOR_LIST_TYPE) {
                    ArrayList<String> knownNames = new ArrayList<String>();
                    String[] recognizedActors = ProgramUtilities.getActorNames(prog);
                    if (recognizedActors != null) {
                        knownNames.addAll(Arrays.asList(recognizedActors));
                    }
                    String actorField = prog.getTextField(type);
                    if (actorField != null) {
                        ArrayList<String>[] lists = ProgramUtilities.splitActors(prog);
                        if (lists == null) {
                            lists = splitActorsSimple(prog);
                        }
                        if (lists != null && lists[0].size() > 0) {
                            startInfoSection(buffer, type.getLocalizedName());
                            buffer.append("<table border=\"0\" cellpadding=\"0\" style=\"font-family:");
                            buffer.append(bodyFont);
                            buffer.append(";\">");
                            for (int i = 0; i < lists[0].size(); i++) {
                                String[] parts = new String[2];
                                parts[0] = lists[0].get(i);
                                parts[1] = "";
                                if (i < lists[1].size()) {
                                    parts[1] = lists[1].get(i);
                                }
                                int actorIndex = 0;
                                if (showPersonLinks) {
                                    if (knownNames.contains(parts[0])) {
                                        parts[0] = addPersonLink(parts[0]);
                                    } else if (knownNames.contains(parts[1])) {
                                        parts[1] = addPersonLink(parts[1]);
                                        actorIndex = 1;
                                    }
                                }
                                buffer.append("<tr><td valign=\"top\">&#8226;&nbsp;</td><td valign=\"top\">");
                                buffer.append(parts[actorIndex]);
                                buffer.append("</td><td width=\"10\">&nbsp;</td>");

                                if (parts[1 - actorIndex].length() > 0) {
                                    buffer.append("<td valign=\"top\">");
                                    buffer.append(parts[1 - actorIndex]);
                                    buffer.append("</td>");
                                } else {
                                    // if roles are missing add next actor in the same line
                                    if (i + 1 < lists[0].size() && lists[1].size() == 0) {
                                        i++;
                                        buffer.append(
                                                "<td valign=\"top\">&#8226;&nbsp;</td><td valign=\"top\">");
                                        if (showPersonLinks) {
                                            buffer.append(addSearchLink(lists[0].get(i)));
                                        } else {
                                            buffer.append(lists[0].get(i));
                                        }
                                        buffer.append("</td>");
                                    }
                                }
                                buffer.append("</td></tr>");
                            }
                            buffer.append("</table>");
                            buffer.append("</td></tr>");
                            addSeparator(doc, buffer);
                        } else {
                            addEntry(doc, buffer, prog, type, showHelpLinks, showPersonLinks);
                        }
                    }
                } else {
                    addEntry(doc, buffer, prog, type, showHelpLinks, showPersonLinks);
                }
            }
        }

        if (showHelpLinks) {
            buffer.append(
                    "<tr><td colspan=\"2\" valign=\"top\" align=\"center\" style=\"color:#808080; font-size:");
            buffer.append(mBodyFontSize).append("\">");
            buffer.append("<a href=\"");
            buffer.append(
                    mLocalizer.msg("dataInfo", "http://wiki.tvbrowser.org/index.php/Qualit%C3%A4t_der_Daten"))
                    .append("\">");
            buffer.append(mLocalizer.msg("dataQuality", "Details of the data quality"));
            buffer.append("</a>");
            buffer.append("</td></tr>");
        }
        buffer.append("</table></html>");

        return buffer.toString();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}