Example usage for java.awt Font ITALIC

List of usage examples for java.awt Font ITALIC

Introduction

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

Prototype

int ITALIC

To view the source code for java.awt Font ITALIC.

Click Source Link

Document

The italicized style constant.

Usage

From source file:com.planetmayo.debrief.satc_rcp.views.MaintainContributionsView.java

protected void redoStraightLegs() {
    // ok, clear any leg markers
    if (legPlot != null) {
        if (!graphTabs.isDisposed())
            graphTabs.setSelection(legTab);

        // hmm, actually we have to remove any target leg markers
        @SuppressWarnings("unchecked")
        Collection<IntervalMarker> markers = legPlot.getDomainMarkers(Layer.FOREGROUND);
        if (markers != null) {
            ArrayList<IntervalMarker> markersToDelete = new ArrayList<IntervalMarker>(markers);
            Iterator<IntervalMarker> mIter = markersToDelete.iterator();
            while (mIter.hasNext()) {
                IntervalMarker im = mIter.next();
                legPlot.removeDomainMarker(im);
            }/* w w  w  .  j  a  v a  2 s .  co m*/
        }

        Iterator<BaseContribution> conts = activeSolver.getContributions().iterator();
        while (conts.hasNext()) {
            BaseContribution baseC = conts.next();
            if (baseC.isActive())
                if (baseC instanceof StraightLegForecastContribution) {
                    StraightLegForecastContribution slf = (StraightLegForecastContribution) baseC;
                    java.awt.Color thisCol = slf.getColor();

                    // hmm, has it been given a color (initialised) yet?
                    if (thisCol == null)
                        continue;

                    long thisStart = baseC.getStartDate().getTime();
                    long thisFinish = baseC.getFinishDate().getTime();

                    java.awt.Color transCol = new java.awt.Color(255, 0, 0, 22);

                    final Marker bst = new IntervalMarker(thisStart, thisFinish, transCol,
                            new BasicStroke(2.0f), null, null, 1.0f);
                    bst.setLabel(baseC.getName());
                    bst.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
                    bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, 10));
                    bst.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
                    legPlot.addDomainMarker(bst, Layer.FOREGROUND);
                } else {
                    if (baseC instanceof BearingMeasurementContribution) {

                    }
                }
        }

    }

}

From source file:skoa.helpers.Graficos.java

/*********************************************************************************************************
 * FUNCIONES PARA CREAR LOS GRFICOS DE LA CONSULTA D! MANIPULANDO LOS DATOS OBTENIDOS DE LAS CONSULTAS.*
 *********************************************************************************************************/
private void difPorc() {
    //Aplicarle la frmula a los valores de las dos direcciones, obteniendo un slo fichero.
    aplicarFormula(1); //Se le aplica con porcentajes.
    //En este tipo de consultas, buscamos el tipo que es y la unidad, para que se vean.
    String tipo = unidad.substring(0, unidad.indexOf("\t"));
    unidad = unidad.substring(unidad.indexOf("\t") + 1);
    if (unidad.indexOf("C") >= 0)
        unidad = "C";
    TimeSeries serie = obtenerSerieEvolucion2(); //Reutilizamos este cdigo.
    TimeSeriesCollection dataset = new TimeSeriesCollection(serie); //Slo se obtiene una curva.
    JFreeChart grafica = ChartFactory.createTimeSeriesChart("Valores medidos de las direcciones de grupo", //titulo
            "Fechas", //titulo eje x
            "Mediciones en " + tipo + " " + "(" + unidad + ")", //titulo eje y
            dataset, //dataset
            true, //leyenda
            true, //tooltips
            false); //configure chart to generate URLs?

    //Dar color a cada categoria
    grafica.setBackgroundPaint(Color.WHITE); //Color del fondo del grfico
    if (fechaInicial.equals("") & fechaFinal.equals("")) { //Si estn vacas es porque no hay resultados para ese intervalo.
        fechaInicial = " ? ";
        fechaFinal = " ? ";
    }/*from ww w .j  av  a  2  s .  c o m*/
    TextTitle t = new TextTitle("desde " + fechaInicial + " hasta " + fechaFinal,
            new Font("SanSerif", Font.ITALIC, 12));
    grafica.addSubtitle(t);
    try {
        ChartUtilities.saveChartAsJPEG(new File(ruta + "DiferenciasSmall.jpg"), grafica, 400, 300);
        ChartUtilities.saveChartAsJPEG(new File(ruta + "DiferenciasBig.jpg"), grafica, 900, 600);
    } catch (IOException e1) {
        System.err.println("Problem occurred creating chart.");
    }
}

From source file:skoa.helpers.Graficos.java

private void difAbs() {
    //Aplicarle la frmula a los valores de las dos direcciones, obteniendo un slo fichero.
    aplicarFormula(2); //Se le aplica con porcentajes.
    String tipo = unidad.substring(0, unidad.indexOf("\t"));
    if (tipo.contentEquals("ABS"))
        tipo = "DIF";
    unidad = unidad.substring(unidad.indexOf("\t") + 1);
    if (unidad.indexOf("C") >= 0)
        unidad = "C";
    TimeSeries serie = obtenerSerieEvolucion2(); //Reutilizamos este cdigo.
    TimeSeriesCollection dataset = new TimeSeriesCollection(serie); //Slo se obtiene una curva.
    JFreeChart grafica = ChartFactory.createTimeSeriesChart("Valores medidos de las direcciones de grupo", //titulo
            "Fechas", //titulo eje x
            "Mediciones en " + tipo + " " + "(" + unidad + ")", //titulo eje y
            dataset, //dataset
            true, //leyenda
            true, //tooltips
            false); //configure chart to generate URLs?
    //Dar color a cada categoria
    grafica.setBackgroundPaint(Color.WHITE); //Color del fondo del grafico
    if (fechaInicial.equals("") & fechaFinal.equals("")) { //Si estan vacas es porque no hay resultados para ese intervalo.
        fechaInicial = " ? ";
        fechaFinal = " ? ";
    }//w  w  w .ja  v a2s. c o  m
    TextTitle t = new TextTitle("desde " + fechaInicial + " hasta " + fechaFinal,
            new Font("SanSerif", Font.ITALIC, 12));
    grafica.addSubtitle(t);
    try {
        ChartUtilities.saveChartAsJPEG(new File(ruta + "DiferenciasSmall.jpg"), grafica, 400, 300);
        ChartUtilities.saveChartAsJPEG(new File(ruta + "DiferenciasBig.jpg"), grafica, 900, 600);
    } catch (IOException e1) {
        System.err.println("Problem occurred creating chart.");
    }
}

From source file:us.daveread.basicquery.BasicQuery.java

/**
 * Set the fonts for the interface from the configuration in the properties
 * collection//from  w w  w .  j  a  va2s .co m
 * 
 * @param props
 *          The properties collection with font information
 */
private void setFontFromConfig(Properties props) {
    String fontFamily;
    int fontSize, fontStyle;
    boolean bold, italic;

    try {
        fontFamily = props.getProperty(PROP_FONT_FAMILY, "Arial");
        fontSize = Integer.parseInt(props.getProperty(PROP_FONT_SIZE, "12"));
        bold = props.getProperty(PROP_FONT_BOLD, "NO").equals("YES");
        italic = props.getProperty(PROP_FONT_ITALIC, "NO").equals("YES");

        fontStyle = 0;
        if (bold) {
            fontStyle |= Font.BOLD;
        }

        if (italic) {
            fontStyle |= Font.ITALIC;
        }

        setupFont(new Font(fontFamily, fontStyle, fontSize));
    } catch (Throwable any) {
        // Probably font is not configured in property file - just ignore
        // and use system default font
        LOGGER.info("Failed to setup a font from the properties file", any);
    }
}

From source file:JVMSimulator.java

StackMemoryViewTitlePanel() {

    int[] hComponentCellWidths = new int[4];
    hComponentCellWidths[0] = 2;/*from  w w  w . j  a va  2s  .c om*/
    hComponentCellWidths[1] = 2;
    hComponentCellWidths[2] = 2;
    hComponentCellWidths[3] = 3;
    setLayout(new GridSnapLayout(1, 9, hComponentCellWidths));

    setFont(new Font("Helvetica", Font.ITALIC, 11));

    add(new Label("", Label.CENTER));
    add(new Label(StringTable.address, Label.CENTER));
    add(new Label(StringTable.hexValue, Label.CENTER));
    add(new Label(StringTable.value, Label.CENTER));
}

From source file:org.pentaho.platform.uifoundation.chart.JFreeChartEngine.java

/**
 * Creates a java.awt.TexturePaint object from an XML node from the dial definition document
 * /*from  ww  w.ja  va2 s .co m*/
 * @param XML
 *          Node from the dial definition
 * @param width
 *          of the chart
 * @param height
 *          of the chart
 * @return Paint object defined by the node / public static Paint getTexturePaint( Node node, int width, int
 *         height ) {
 * 
 *         if( node == null ) { return null; } int rectWidth=width; int rectHeight=height; int x=0; int y=0; //
 *         Get Image try{ Node imageNode = node.selectSingleNode( "background-image" ); //$NON-NLS-1$ if(
 *         imageNode != null ) { String imageName = imageNode.getText().toString(); String fileName =
 *         PentahoSystem.getApplicationContext().getSolutionPath( imageName ); int offset = fileName.lastIndexOf(
 *         "." ); //$NON-NLS-1$ String type = offset == -1 ? "jpg" : fileName.substring(offset + 1);
 *         //$NON-NLS-1$
 * 
 *         BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB);
 * 
 *         ImageIO.write(image, type, new File( fileName ));
 * 
 *         Node rectangle= node.selectSingleNode("rectangle"); //$NON-NLS-1$ if( rectangle != null ) { Node
 *         tmpNode = rectangle.selectSingleNode("width"); //$NON-NLS-1$ if( tmpNode != null ) {
 *         rectWidth=Integer.parseInt(tmpNode.getText().toString().trim()); //$NON-NLS-1$ } tmpNode =
 *         rectangle.selectSingleNode("height"); //$NON-NLS-1$ if( tmpNode != null ) {
 *         rectHeight=Integer.parseInt(tmpNode.getText().toString().trim()); //$NON-NLS-1$ } tmpNode =
 *         rectangle.selectSingleNode("x"); //$NON-NLS-1$ if( tmpNode != null ) {
 *         x=Integer.parseInt(tmpNode.getText().toString().trim()); //$NON-NLS-1$ } tmpNode =
 *         rectangle.selectSingleNode("y"); //$NON-NLS-1$ if( tmpNode != null ) {
 *         y=Integer.parseInt(tmpNode.getText().toString().trim()); //$NON-NLS-1$ } }
 * 
 *         Rectangle2D rect = new Rectangle2D.Double(x,y,rectWidth,rectHeight);
 * 
 *         return new TexturePaint(image,rect); }
 * 
 *         }catch(Exception e){e.printStackTrace();} return null; }
 */
public static Font getFont(final Node fontNode) {
    Font font = null;
    if (fontNode != null) {
        String fontFamily = TextTitle.DEFAULT_FONT.getFamily();
        int fontStyle = Font.PLAIN;
        int fontSize = TextTitle.DEFAULT_FONT.getSize();

        Node fontFamilyNode = fontNode.selectSingleNode(JFreeChartEngine.FONT_FAMILY_NODE_NAME);
        if ((fontFamilyNode != null) && (fontFamilyNode.getText().length() > 0)) {
            fontFamily = fontFamilyNode.getText();
        }
        Node isBoldNode = fontNode.selectSingleNode(JFreeChartEngine.IS_BOLD_NODE_NAME);
        if (isBoldNode != null) {
            boolean bold = Boolean.valueOf(isBoldNode.getText()).booleanValue();
            if (bold) {
                fontStyle += Font.BOLD;
            }
        }
        Node isItalicNode = fontNode.selectSingleNode(JFreeChartEngine.IS_ITALIC_NODE_NAME);
        if (isItalicNode != null) {
            boolean italic = Boolean.valueOf(isItalicNode.getText()).booleanValue();
            if (italic) {
                fontStyle += Font.ITALIC;
            }
        }
        Node sizeNode = fontNode.selectSingleNode(JFreeChartEngine.SIZE_NODE_NAME);
        if ((sizeNode != null) && (sizeNode.getText().length() > 0)) {
            fontSize = Integer.parseInt(sizeNode.getText());
        }
        font = new Font(fontFamily, fontStyle, fontSize);
    }
    return font;
}

From source file:VASSAL.tools.imports.adc2.MapBoard.java

/**
 * Get a font based on size and font index. If this font has not already been created, then it will be generated.
 * Can be reused later if the same font was already created.
 *
 * @param size Font size.//from   w  ww .  j ava 2s  .co  m
 * @param font Font index. See MapBoard.java for format.
 */

/* Binary format for fonts:
 *
 *             00000000
 *                 ||||_ Font name index (between 1 and 9).
 *                |_____ Bold flag.
 *               |______ Italics flag.
 *              |_______ Underline flag.
 */
protected static Font getDefaultFont(int size, int font) {
    final Integer key = Integer.valueOf((size << 8) + font);
    Font f = defaultFonts.get(key);
    if (f == null) {
        int fontIndex = font & 0xf;
        assert (fontIndex >= 1 && fontIndex <= 9);
        boolean isBold = (font & 0x0010) > 0;
        boolean isItalic = (font & 0x0020) > 0;
        boolean isUnderline = (font & 0x0040) > 0;
        String fontName = defaultFontNames[fontIndex - 1];
        int fontStyle = Font.PLAIN;
        if (isItalic)
            fontStyle |= Font.ITALIC;
        if (isBold)
            fontStyle |= Font.BOLD;
        f = new Font(fontName, fontStyle, size);
        if (isUnderline) {
            // TODO: why doesn't underlining doesn't work? Why why why?
            Hashtable<TextAttribute, Object> hash = new Hashtable<TextAttribute, Object>();
            hash.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
            f = f.deriveFont(hash);
        }
        defaultFonts.put(key, f);
    }
    return f;
}

From source file:org.openmicroscopy.shoola.agents.util.EditorUtil.java

/**
 * Initializes a <code>JComboBox</code>.
 * /*from   w ww  .j a v a 2 s.  c o m*/
 * @param values The values to display.
 * @param decrement The value by which the font size is reduced.
 * @param backgoundColor The backgoundColor of the combo box.
 * @return See above.
 */
public static OMEComboBox createComboBox(Object[] values, int decrement, Color backgoundColor) {
    OMEComboBox box = new OMEComboBox(values);
    box.setOpaque(true);
    if (backgoundColor != null)
        box.setBackground(backgoundColor);
    OMEComboBoxUI ui = new OMEComboBoxUI();
    ui.setBackgroundColor(box.getBackground());
    ui.installUI(box);
    box.setUI(ui);
    Font f = box.getFont();
    int size = f.getSize() - decrement;
    box.setBorder(null);
    box.setFont(f.deriveFont(Font.ITALIC, size));
    return box;
}

From source file:org.yccheok.jstock.gui.IndicatorPanel.java

private ListCellRenderer getListCellRenderer(final IndicatorProjectManager projectManager) {
    return new DefaultListCellRenderer() {
        @Override/*  ww  w .  j  a v a  2s  .  c om*/
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            Component component = super.getListCellRendererComponent(list, value, index, isSelected,
                    cellHasFocus);
            if (component != null && value != null) {
                final OperatorIndicator operatorIndicator = projectManager
                        .getOperatorIndicator(value.toString());
                if (operatorIndicator != null
                        && operatorIndicator.getType() != projectManager.getPreferredOperatorIndicatorType()) {
                    final Font oldFont = component.getFont();
                    component.setFont(oldFont.deriveFont(oldFont.getStyle() | Font.ITALIC));
                }
            }
            return component;
        }
    };
}

From source file:SeedGenerator.MainForm.java

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    final JLabel directoryLabel = new JLabel(" ");
    directoryLabel.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 36));
    contentPane.add(directoryLabel, BorderLayout.NORTH);

    final JLabel filenameLabel = new JLabel(" ");
    filenameLabel.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 36));
    contentPane.add(filenameLabel, BorderLayout.SOUTH);

    JFileChooser fileChooser = new JFileChooser(".");
    fileChooser.setControlButtonsAreShown(true);
    contentPane.add(fileChooser, BorderLayout.CENTER);

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            JFileChooser theFileChooser = (JFileChooser) actionEvent.getSource();
            String command = actionEvent.getActionCommand();
            if (command.equals(JFileChooser.APPROVE_SELECTION)) {
                File selectedFile = theFileChooser.getSelectedFile();
                directoryLabel.setText(selectedFile.getParent());
                filenameLabel.setText(selectedFile.getName());
            } else if (command.equals(JFileChooser.CANCEL_SELECTION)) {
                directoryLabel.setText(" ");
                filenameLabel.setText(" ");
            }//from   ww w  .ja  va  2  s .c o m
            frame.setVisible(false);
        }
    };
    fileChooser.addActionListener(actionListener);

    frame.pack();
    frame.setVisible(true); // TODO add your handling code here:
}