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:org.perfrepo.web.controller.reports.testgroup.TestGroupChartBean.java

public void drawChart(OutputStream out, Object data) throws IOException {
    if (data instanceof ChartData) {
        ChartData chartData = (ChartData) data;
        JFreeChart chart = ChartFactory.createBarChart(chartData.getTitle(), "Test", "%",
                processDataSet(chartData), PlotOrientation.HORIZONTAL, false, true, false);
        chart.addSubtitle(new TextTitle("Comparison", new Font("Dialog", Font.ITALIC, 10)));
        chart.setBackgroundPaint(Color.white);
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        CustomRenderer renderer = new CustomRenderer();

        plot.setBackgroundPaint(Color.white);
        plot.setRangeGridlinePaint(Color.white);
        plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
        renderer.setBaseItemLabelGenerator(
                new StandardCategoryItemLabelGenerator("{2}%", NumberFormat.getInstance()));
        renderer.setBaseItemLabelsVisible(true);
        renderer.setDrawBarOutline(false);
        renderer.setMaximumBarWidth(1d / (chartData.getTests().length + 4.0));
        plot.setRenderer(renderer);//from  w w w  .  ja  v a  2 s  .com

        CategoryAxis categoryAxis = plot.getDomainAxis();
        categoryAxis.setCategoryMargin(0.1);

        categoryAxis.setUpperMargin(0.1);
        categoryAxis.setLowerMargin(0.1);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        rangeAxis.setUpperMargin(0.10);
        BufferedImage buffImg = chart.createBufferedImage(640, chartData.getTests().length * 100 + 100);
        ImageIO.write(buffImg, "gif", out);
    }
}

From source file:edu.ucla.stat.SOCR.chart.demo.PieChartDemo3.java

/**
 * Creates a demo chart.//from  ww  w . jav a 2  s.co m
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
protected JFreeChart createChart(PieDataset dataset) {
    dataset = null;

    JFreeChart chart = ChartFactory.createPieChart(chartTitle, // chart title
            dataset, // data
            !legendPanelOn, // include legend
            true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setNoDataMessage("No data available so we go into this really "
            + "long spiel about what that means and it runs off the end of the "
            + "line but what can you do about that!");
    plot.setNoDataMessageFont(new Font("Serif", Font.ITALIC, 10));
    plot.setNoDataMessagePaint(Color.red);
    for (int i = 0; i < pulloutFlag.length; i++) {
        //System.out.println("\""+pulloutFlag[i]+"\"");
        if (isPullout(i)) {
            Comparable key = dataset.getKey(i);
            plot.setExplodePercent(key, 0.30);
        }
    }

    if (rotateOn) {
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }

    setCategorySummary(dataset);
    return chart;
}

From source file:Text2DApp.java

public BranchGroup createSceneGraph() {

    // Create the root of the branch graph
    BranchGroup objRoot = new BranchGroup();

    // Create the transform group node and initialize it to the
    // identity. Add it to the root of the subgraph.
    TransformGroup objSpin = new TransformGroup();
    objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objRoot.addChild(objSpin);//from  ww w  . jav a 2 s . co  m

    // Create a simple Text2D leaf node, add it to the scene graph.
    Text2D text2d = new Text2D("2D text in Java 3D", new Color3f(0.9f, 1.0f, 1.0f), "Helvetica", 24,
            Font.ITALIC);

    objSpin.addChild(text2d);

    Appearance textAppear = text2d.getAppearance();

    // The following 4 lines of code (commented out) make the Text2D object
    // 2-sided.
    // This code depends on the line of code above that sets TextAppear.
    //         PolygonAttributes polyAttrib = new PolygonAttributes();
    //         polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
    //         polyAttrib.setBackFaceNormalFlip(true);
    //         textAppear.setPolygonAttributes(polyAttrib);

    // The following 12 lines of code (commented out) use the texture from
    // the previous Text2D object on another object.
    // This code depends on the line of code above that sets TextAppear.
    //         QuadArray qa = new QuadArray(4, QuadArray.COORDINATES |
    //                                         QuadArray.TEXTURE_COORDINATE_2);
    //         qa.setCoordinate(0, new Point3f(-10.0f, 1.0f, -5.0f));
    //         qa.setCoordinate(1, new Point3f(-10.0f, -1.0f, -5.0f));
    //         qa.setCoordinate(2, new Point3f(10.0f, -1.0f, -5.0f));
    //         qa.setCoordinate(3, new Point3f(10.0f, 1.0f, -5.0f));
    //         qa.setTextureCoordinate(0, new Point2f(0.0f, 1.0f));
    //         qa.setTextureCoordinate(1, new Point2f(0.0f, 0.0f));
    //         qa.setTextureCoordinate(2, new Point2f(1.0f, 0.0f));
    //         qa.setTextureCoordinate(3, new Point2f(1.0f, 1.0f));
    //
    //         objRoot.addChild(new Shape3D(qa, textAppear));

    // Create a new Behavior object that will perform the desired
    // operation on the specified transform object and add it into
    // the scene graph.
    Alpha rotationAlpha = new Alpha(-1, 8000);

    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objSpin);

    // a bounding sphere specifies a region a behavior is active
    // create a sphere centered at the origin with radius of 100
    BoundingSphere bounds = new BoundingSphere();
    rotator.setSchedulingBounds(bounds);
    objSpin.addChild(rotator);

    Background backg = new Background();
    backg.setColor(0.4f, 0.4f, 1.0f);
    backg.setApplicationBounds(new BoundingSphere());
    objRoot.addChild(backg);

    return objRoot;
}

From source file:components.CrayonPanel.java

protected JToggleButton createCrayon(String name, Border normalBorder) {
    JToggleButton crayon = new JToggleButton();
    crayon.setActionCommand(name);//  w  w w  .j  a v  a 2s.  c  o m
    crayon.addActionListener(this);

    //Set the image or, if that's invalid, equivalent text.
    ImageIcon icon = createImageIcon("images/" + name + ".gif");
    if (icon != null) {
        crayon.setIcon(icon);
        crayon.setToolTipText("The " + name + " crayon");
        crayon.setBorder(normalBorder);
    } else {
        crayon.setText("Image not found. This is the " + name + " button.");
        crayon.setFont(crayon.getFont().deriveFont(Font.ITALIC));
        crayon.setHorizontalAlignment(JButton.HORIZONTAL);
        crayon.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    }

    return crayon;
}

From source file:components.SliderDemo.java

public SliderDemo() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    delay = 1000 / FPS_INIT;/*from www . j av  a2  s .  co m*/

    //Create the label.
    JLabel sliderLabel = new JLabel("Frames Per Second", JLabel.CENTER);
    sliderLabel.setAlignmentX(Component.CENTER_ALIGNMENT);

    //Create the slider.
    JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL, FPS_MIN, FPS_MAX, FPS_INIT);

    framesPerSecond.addChangeListener(this);

    //Turn on labels at major tick marks.

    framesPerSecond.setMajorTickSpacing(10);
    framesPerSecond.setMinorTickSpacing(1);
    framesPerSecond.setPaintTicks(true);
    framesPerSecond.setPaintLabels(true);
    framesPerSecond.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    Font font = new Font("Serif", Font.ITALIC, 15);
    framesPerSecond.setFont(font);

    //Create the label that displays the animation.
    picture = new JLabel();
    picture.setHorizontalAlignment(JLabel.CENTER);
    picture.setAlignmentX(Component.CENTER_ALIGNMENT);
    picture.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    updatePicture(0); //display first frame

    //Put everything together.
    add(sliderLabel);
    add(framesPerSecond);
    add(picture);
    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    //Set up a timer that calls this object's action handler.
    timer = new Timer(delay, this);
    timer.setInitialDelay(delay * 7); //We pause animation twice per cycle
                                      //by restarting the timer
    timer.setCoalesce(true);
}

From source file:FontDemoLabel.java

public FontDemoLabel() {
    super("Font Demo - Label");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container cp = getContentPane();

    // get font name list
    fl = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

    // IGNORE the setLayout and North/South stuff...
    // we will discuss it in a few pages!

    cp.setLayout(new BorderLayout());
    cp.add(BorderLayout.NORTH, new Label("Number of Fonts = " + fl.length, Label.CENTER));
    cp.add(BorderLayout.CENTER, p = new JPanel());
    p.setLayout(new GridLayout(5, 0, 5, 5));

    for (int i = 0; i < fl.length; i++) {
        JLabel lab;//from  ww w . ja v  a 2  s.co m

        // The crux of the matter: for each font name,
        // create a label using the name as the text,
        // AND set the font to be the named font!
        p.add(lab = new JLabel(fl[i]));
        lab.setFont(new Font(fl[i], Font.ITALIC | Font.BOLD, 14));
    }
    pack();
}

From source file:net.sf.jasperreports.customizers.marker.CategoryMarkerCustomizer.java

protected CategoryMarker createMarker(JRChart jrc) {
    Comparable<?> value = getProperty(PROPERTY_CATEGORY);

    if (value == null) {
        return null;
    }/*from www  .  j a v a  2 s  . c  o m*/

    CategoryMarker marker = new CategoryMarker(value);

    configureMarker(marker);

    configureStroke(marker);

    Boolean drawAsLine = getBooleanProperty(PROPERTY_DRAW_AS_LINE);
    if (drawAsLine != null) {
        marker.setDrawAsLine(drawAsLine);
    }

    //Setup the font
    Font font = marker.getLabelFont();

    String fontName = getProperty(PROPERTY_FONT_NAME);
    if (fontName == null) {
        fontName = font.getName();
    }

    Float fontSize = getFloatProperty(PROPERTY_FONT_SIZE);
    if (fontSize == null) {
        fontSize = Float.valueOf(font.getSize());
    }

    int fontStyle = Font.PLAIN;
    Boolean isBold = getBooleanProperty(PROPERTY_FONT_BOLD);
    if (isBold != null) {
        fontStyle = fontStyle | Font.BOLD;
    }
    Boolean isItalic = getBooleanProperty(PROPERTY_FONT_ITALIC);
    if (isItalic != null) {
        fontStyle = fontStyle | Font.ITALIC;
    }

    marker.setLabelFont(FontUtil.getInstance(filler.getJasperReportsContext()).getAwtFontFromBundles(fontName,
            fontStyle, fontSize, filler.getFillContext().getMasterLocale(), true));

    return marker;
}

From source file:adapters.HistogramChartAdapter.java

/**
 * Modified method/*from w w  w . jav a 2 s  .  c o m*/
 *
 * Displays chart on the screen using Swing.
 *    This method creates an application containing a chart panel displaying
 *    the chart. The created frame is positioned on-screen, and displayed before
 *    it is returned. The <TT>width</TT> and the <TT>height</TT>
 *    of the chart are measured in pixels.
 *
 * @param width frame width in pixels.
 *
 *    @param height frame height in pixels.
 *
 *    @return frame containing the chart.
 *
 */
public JFrame view(int width, int height) {
    JFrame myFrame;
    if (chart.getTitle() != null)
        myFrame = new JFrame("Histogram Chart: " + chart.getTitle().getText());
    else
        myFrame = new JFrame("Histogram Chart");
    TextTitle tt = chart.getTitle();
    tt.setFont(new FontUIResource("DensityChartSmallFont", Font.ITALIC, 12));
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(width, height));
    myFrame.setContentPane(chartPanel);
    myFrame.pack();
    myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    return myFrame;
}

From source file:com.bsoft.baseframe.baseframe_utils.beanUtils.Classgenerator.java

/**
 * ???/*from   w  ww .ja v  a 2 s .  com*/
 */
public Classgenerator() {
    setTitle("?");
    setSize(WIDTH, HEIGHT);
    setLocationRelativeTo(null);

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 1));

    JPanel _beanPanel = new JPanel();
    _beanPanel.setBorder(BorderFactory.createTitledBorder("?"));

    JPanel _otherPanel = new JPanel();
    _otherPanel.setBorder(BorderFactory.createTitledBorder("?"));

    JLabel _tbLabel = new JLabel("??*");
    _tb = new JTextField(25);
    _beanPanel.add(_tbLabel);
    _beanPanel.add(_tb);

    JLabel _stbbLabel = new JLabel("??*");
    _stb = new JTextField(25);
    _beanPanel.add(_stbbLabel);
    _beanPanel.add(_stb);

    JLabel _ibatisLabel = new JLabel("IBTS*");
    _ibatis = new JTextField(25);
    _beanPanel.add(_ibatisLabel);
    _beanPanel.add(_ibatis);

    JLabel _svLabel = new JLabel("SERVICE");
    _sv = new JTextField(23);
    _otherPanel.add(_svLabel);
    _otherPanel.add(_sv);

    //      JLabel _sviLabel = new JLabel("??*");
    //      _zwmc = new JTextField("?",25);
    //      _zwmc.setEditable(false);
    //      _otherPanel.add(_sviLabel);
    //      _otherPanel.add(_zwmc);

    JLabel _detail = new JLabel("(?ServiceService??,");
    JLabel _detail2 = new JLabel("??Service???.impl)");
    _detail.setFont(new Font("", Font.ITALIC, 12));
    _detail2.setFont(new Font("", Font.ITALIC, 12));
    _otherPanel.add(_detail);
    _otherPanel.add(_detail2);
    panel.add(_beanPanel);
    panel.add(_otherPanel);

    add(panel, BorderLayout.CENTER);

    JPanel btnPanel = new JPanel();
    JButton _saveBtn = new JButton("?");

    _saveBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int msg_code = clickSaveBtn(e);
            showMsg(msg_code);
        }
    });

    JButton _restBtn = new JButton("?");

    //?
    _restBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            _tb.setText(null);
            _stb.setText(null);
            _ibatis.setText(null);
            _sv.setText(null);
            //            _svi.setText(null);
        }
    });
    btnPanel.add(_saveBtn);
    btnPanel.add(_restBtn);
    add(btnPanel, BorderLayout.SOUTH);
}

From source file:ExposedInt.java

public void init() {

    Panel buttonPanel = new PanelWithInsets(0, 0, 0, 0);
    buttonPanel.setLayout(new GridLayout(3, 2, 5, 5));
    buttonPanel.add(new GrayButton(ExposedIntStringTable.increment));
    buttonPanel.add(new GrayButton(ExposedIntStringTable.decrement));
    buttonPanel.add(minimumButton);/*from www .  j a v  a  2  s .co m*/
    buttonPanel.add(maximumButton);
    buttonPanel.add(zeroButton);
    buttonPanel.add(new GrayButton(ExposedIntStringTable.negate));
    zeroButton.disable();

    binaryField = new Label("00000000000000000000000000000000");
    hexField = new Label("00000000");
    decimalField = new Label("0");

    Font fieldFont = new Font("TimesRoman", Font.PLAIN, 12);
    binaryField.setFont(fieldFont);
    hexField.setFont(fieldFont);
    decimalField.setFont(fieldFont);

    Panel numberPanel = new Panel();
    numberPanel.setBackground(Color.white);
    numberPanel.setLayout(new GridLayout(3, 1));
    Panel binaryPanel = new Panel();
    binaryPanel.setLayout(new BorderLayout());
    binaryPanel.add("Center", binaryField);
    numberPanel.add(binaryPanel);

    Panel hexPanel = new Panel();
    hexPanel.setLayout(new BorderLayout());
    hexPanel.add("Center", hexField);
    numberPanel.add(hexPanel);
    numberPanel.add(decimalField);

    Panel labelPanel = new Panel();
    labelPanel.setBackground(Color.white);
    labelPanel.setLayout(new GridLayout(3, 1));
    Label label = new Label(ExposedIntStringTable.binary, Label.CENTER);
    Font labelFont = new Font("Helvetica", Font.ITALIC, 11);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(ExposedIntStringTable.hex, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(ExposedIntStringTable.decimal, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);

    Panel dataPanel = new Panel();
    dataPanel.setLayout(new BorderLayout());
    dataPanel.add("West", labelPanel);
    dataPanel.add("Center", numberPanel);

    ColoredLabel title = new ColoredLabel(ExposedIntStringTable.title, Label.CENTER, Color.yellow);
    title.setFont(new Font("Helvetica", Font.BOLD, 12));

    setBackground(Color.red);
    setLayout(new BorderLayout(5, 5));
    add("North", title);
    add("West", buttonPanel);
    add("Center", dataPanel);
}