Example usage for java.awt Font PLAIN

List of usage examples for java.awt Font PLAIN

Introduction

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

Prototype

int PLAIN

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

Click Source Link

Document

The plain style constant.

Usage

From source file:io.github.tavernaextras.biocatalogue.ui.search_results.ServiceListCellRenderer.java

/**
 * This entry can be in one of two states:
 * -- containing only the name of the resource and NOT loading further details;
 * -- containing only the name of the resource and LOADING further details.
 * //from   www .  j  av a 2  s  .co  m
 * @param itemToRender
 * @return
 */
protected GridBagConstraints prepareInitiallyLoadingEntry(Object itemToRender) {
    TYPE resourceType = determineResourceType(itemToRender);
    LoadingResource resource = (LoadingResource) itemToRender;

    jlTypeIcon = new JLabel(resourceType.getIcon());
    jlItemStatus = new JLabel(ResourceManager.getImageIcon(ResourceManager.SERVICE_STATUS_UNKNOWN_ICON));

    jlItemTitle = new JLabel(Resource.getDisplayNameForResource(resource), JLabel.LEFT);
    jlItemTitle.setForeground(Color.decode("#AD0000")); // very dark red
    jlItemTitle.setFont(jlItemTitle.getFont().deriveFont(Font.PLAIN, jlItemTitle.getFont().getSize() + 2));

    jlDescription = resource.isLoading() ? loaderBarAnimationGrey : loaderBarAnimationGreyStill;

    return (arrangeLayout(false));
}

From source file:demo.AnimatingAddNodeDemo.java

@Override
public void init() {

    //create a graph
    Graph<Number, Number> ig = Graphs
            .<Number, Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number, Number>());

    ObservableGraph<Number, Number> og = new ObservableGraph<Number, Number>(ig);
    og.addGraphEventListener(new GraphEventListener<Number, Number>() {

        public void handleGraphEvent(GraphEvent<Number, Number> evt) {
            System.err.println("got " + evt);

        }//from w  ww .  j  a  v a2  s .co m
    });
    this.g = og;
    //create a graphdraw
    layout = new FRLayout<Number, Number>(g);
    layout.setSize(new Dimension(600, 600));
    Relaxer relaxer = new VisRunner((IterativeContext) layout);
    relaxer.stop();
    relaxer.prerelax();

    Layout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout);

    vv = new VisualizationViewer<Number, Number>(staticLayout, new Dimension(600, 600));

    JRootPane rp = this.getRootPane();
    rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().setBackground(java.awt.Color.lightGray);
    getContentPane().setFont(new Font("Serif", Font.PLAIN, 12));

    vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>());

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>());
    vv.setForeground(Color.white);

    vv.addComponentListener(new ComponentAdapter() {

        /**
         * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent)
         */
        @Override
        public void componentResized(ComponentEvent arg0) {
            super.componentResized(arg0);
            layout.setSize(arg0.getComponent().getSize());
        }
    });

    getContentPane().add(vv);

    timer = new Timer();
}

From source file:org.apache.qpid.disttest.charting.chartbuilder.StatisticalBarChartBuilder.java

@Override
public JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, final Dataset dataset,
        PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls) {
    CategoryAxis xAxis = new CategoryAxis(xAxisTitle);
    ValueAxis yAxis = new NumberAxis(yAxisTitle);
    CategoryItemRenderer renderer = new StatisticalBarRenderer();

    CategoryPlot plot = new CategoryPlot((StatisticalCategoryDataset) dataset, xAxis, yAxis, renderer);

    JFreeChart chart = new JFreeChart(title, new Font("Arial", Font.PLAIN, 10), plot, true);

    chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    return chart;
}

From source file:be.ac.ua.comp.scarletnebula.gui.DecoratedGraph.java

/**
 * @see Graph/*  www  . ja  va 2 s .  c  o m*/
 */
@Override
public ChartPanel getChartPanel() {
    final XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    plot.setBackgroundPaint(Color.darkGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    // plot.setInsets(new RectangleInsets(0, 0, 0, 0));
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);

    if (stream.getMax() != null) {
        log.info("Getting chart panel for stream with maximum.");
        range.setAutoRange(false);

        range.setTickUnit(new NumberTickUnit(stream.getMax() / 10, new DecimalFormat(), 1));
        range.setRange(0, stream.getMax());
    } else if (stream.getType() == Type.RELATIVE) {
        range.setAutoRange(false);

        range.setTickUnit(new NumberTickUnit(0.1, new DecimalFormat(), 1));
        range.setRange(0, 1);
    } else {
        double sum = 0;
        final List<TimedDatapoint> datapoints = stream.getRecentlyProcessedDatapoints();

        range.setTickUnit(
                new NumberTickUnit((int) (Utils.max(datapoints).getValue() / 5) + 1, new DecimalFormat(), 1));
    }

    final JFreeChart chart = new JFreeChart(stream.getStreamname(), new Font("SansSerif", Font.PLAIN, 20), plot,
            true);
    chart.setBackgroundPaint(Color.white);
    chart.removeLegend();
    final ChartPanel chartPanel = new ChartPanel(chart);
    // chartPanel.setBorder(BorderFactory
    // .createBevelBorder(BevelBorder.LOWERED));

    return chartPanel;
}

From source file:com.github.dougkelly88.FLIMPlateReaderGUI.FLIMClasses.Classes.FindMaxpoint.java

/**
 * Creates a chart.//  ww  w.  j  a v  a  2s .c om
 * 
 * @param dataset  the data for the chart.
 * 
 * @return a chart.
 */
public JFreeChart createChart() {

    //http://www.java2s.com/Code/Java/Chart/JFreeChartDualAxisDemo2.htm
    String xlabel = "Delay (ps)";
    String ylabel = "Signal (DN)";

    // create the chart with findmaxpoint results
    final JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title
            xlabel, // x axis label
            ylabel, // y axis label
            findMaxpointData_, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );

    final XYPlot plot = chart.getXYPlot();
    // deal with axes and add second dataset
    final NumberAxis yaxis1 = (NumberAxis) plot.getRangeAxis();
    yaxis1.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    yaxis1.setLabelFont(new Font("Dialog", Font.PLAIN, 10));
    final NumberAxis yaxis2 = new NumberAxis(null);
    final NumberAxis xaxis = (NumberAxis) plot.getDomainAxis();
    xaxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    xaxis.setLabelFont(new Font("Dialog", Font.PLAIN, 10));
    plot.setRangeAxis(1, yaxis2);
    plot.setDataset(1, gatePositionData_);
    plot.mapDatasetToRangeAxis(1, 1);
    yaxis1.setRange(0, 5000);
    yaxis2.setRange(-1, 1);
    yaxis2.setTickLabelsVisible(false);
    xaxis.setRange(0, 16666);

    // deal with visuals

    final XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(true, true);
    renderer1.setSeriesPaint(0, Color.RED);
    renderer1.setSeriesStroke(0, new BasicStroke(3));

    //        renderer1.setBaseShapesVisible(true);
    //        renderer1.setSeriesShape(0, ShapeUtilities.createDiagonalCross(4,1));

    plot.setRenderer(0, renderer1);

    //        final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
    final XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(false, true);
    renderer2.setSeriesPaint(0, Color.CYAN);
    renderer2.setSeriesShapesFilled(0, Boolean.TRUE);
    renderer2.setBaseShapesVisible(true);
    renderer2.setShape(new Rectangle(-2, -100, 4, 200));
    renderer2.setOutlineStroke(new BasicStroke(1));
    renderer2.setOutlinePaint(Color.GRAY);
    renderer2.setUseOutlinePaint(true);
    plot.setRenderer(1, renderer2);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    //                
    return chart;

}

From source file:net.sf.profiler4j.console.ClassListPanel.java

/**
 * This method initializes classesTable//w  ww. java  2 s  .c  o m
 * 
 * @return javax.swing.JTable
 */
private JTable getClassesTable() {
    if (classesTable == null) {
        classesTable = new JTable();
        classesTable.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        classesTable.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 12));
        classesTable.setModel(getClassListTableModel());
        classesTable.setRowHeight(20);
        classesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (classesTable.getSelectedRowCount() > 0) {
                    addAsRuleButton.setEnabled(true);
                } else {
                    addAsRuleButton.setEnabled(false);
                }

            }
        });
        TableColumn c = classesTable.getColumnModel().getColumn(0);
        c.setMinWidth(50);
        c.setMaxWidth(50);

        c = classesTable.getColumnModel().getColumn(1);
        c.setMinWidth(300);
        c.setCellRenderer(new DefaultTableCellRenderer() {
            Font f1 = new Font("Tahoma", java.awt.Font.PLAIN, 12);
            Font f2 = new Font("Tahoma", java.awt.Font.BOLD, 12);

            @Override
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                    boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

                if (isSelected) {
                    setFont(f2);
                } else {
                    setFont(f1);
                }
                if (classListTableModel.getRow(row).info.isInstrumented()) {
                    if (isSelected) {
                        setForeground(Color.YELLOW);
                        setBackground(Color.BLUE);
                    } else {
                        setBackground(Color.decode("#bbffbb"));
                        setForeground(Color.BLACK);
                    }
                } else {
                    if (isSelected) {
                        setForeground(Color.WHITE);
                        setBackground(Color.BLUE);
                    } else {
                        setBackground(Color.WHITE);
                        setForeground(Color.BLACK);
                    }
                }
                setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
                return this;
            }
        });

    }
    return classesTable;
}

From source file:com.okmich.hackerday.client.tool.dashboard.ReportItemPanel.java

/**
 *
 * @return A panel./*  ww w. ja v  a2s. co m*/
 */
public JPanel createChartPanel() {
    JFreeChart chart = ChartFactory.createPieChart(title, // chart title
            getChartDataset(), // data
            true, // include legend
            true, false);

    TextTitle textTitle = new TextTitle(title, new Font("SansSerif", Font.BOLD, 16));
    chart.setTitle(textTitle);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);

    LegendTitle legend = chart.getLegend();
    legend.setPosition(RectangleEdge.BOTTOM);
    this.chartPanel = new ChartPanel(chart);
    this.chartPanel.addMouseListener(new MouseListenerImpl(this));

    return this.chartPanel;
}

From source file:com.eviware.soapui.support.components.JPropertiesTable.java

public JPropertiesTable(String title, T propertyObject) {
    super(new BorderLayout());
    this.title = title;

    tableModel = new PropertiesTableModel<T>(propertyObject);
    table = new PTable(tableModel);

    table.getColumnModel().getColumn(0).setHeaderValue("Property");
    table.getColumnModel().getColumn(1).setHeaderValue("Value");
    table.getColumnModel().getColumn(0).setCellRenderer(new PropertiesTableCellRenderer());
    table.getColumnModel().getColumn(1).setCellRenderer(new PropertiesTableCellRenderer());

    add(new JScrollPane(table), BorderLayout.CENTER);
    titledBorder = BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), title);
    /*//from   w w  w  .j  a  v  a 2 s .c o m
     * Java 7 issue
     * 
     * old: titledBorder.setTitleFont( titledBorder.getTitleFont().deriveFont(
     * Font.PLAIN, 11 ) ); titledBorder.getTitleFont() return null in Java 7
     */
    Font defaultUIFont = getUIDefaultFont();
    if (defaultUIFont != null)
        titledBorder.setTitleFont(getUIDefaultFont().deriveFont(Font.PLAIN, 11));

    if (title != null)
        setBorder(titledBorder);

    table.setBackground(Color.WHITE);
    setPreferredSize(table.getPreferredSize());
}

From source file:PickText3DBounds.java

public BranchGroup createSceneGraph(Canvas3D canvas) {
    Color3f eColor = new Color3f(0.0f, 0.0f, 0.0f);
    Color3f sColor = new Color3f(1.0f, 1.0f, 1.0f);
    Color3f objColor = new Color3f(0.6f, 0.6f, 0.6f);
    Color3f lColor1 = new Color3f(1.0f, 0.0f, 0.0f);
    Color3f lColor2 = new Color3f(0.0f, 1.0f, 0.0f);
    Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f);
    Color3f bgColor = new Color3f(0.05f, 0.05f, 0.2f);

    Transform3D t;//  w  ww.j ava2 s. co m

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

    // Create a Transformgroup to scale all objects so they
    // appear in the scene.
    TransformGroup objScale = new TransformGroup();
    Transform3D t3d = new Transform3D();
    t3d.setScale(0.4);
    objScale.setTransform(t3d);
    objRoot.addChild(objScale);

    // Create a bounds for the background and lights
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

    // Set up the background
    Background bg = new Background(bgColor);
    bg.setApplicationBounds(bounds);
    objScale.addChild(bg);

    Material m = new Material(objColor, eColor, objColor, sColor, 100.0f);
    Appearance a = new Appearance();
    m.setLightingEnable(true);
    a.setMaterial(m);
    Font3D f3d = new Font3D(new Font("TestFont", Font.PLAIN, 1), new FontExtrusion());
    Text3D txt = new Text3D(f3d, new String("TEXT3D"), new Point3f(-2.0f, 0.0f, 0.0f));
    //    txt.setCapability(Geometry.ALLOW_INTERSECT);
    Shape3D s3D = new Shape3D();
    s3D.setGeometry(txt);
    s3D.setAppearance(a);

    // Create a transform group node and initialize it to the
    // identity.  Enable the TRANSFORM_WRITE capability so that
    // our behavior code can modify it at runtime.
    TransformGroup spinTg = new TransformGroup();
    spinTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    spinTg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    spinTg.setCapability(TransformGroup.ENABLE_PICK_REPORTING);

    spinTg.addChild(s3D);
    objScale.addChild(spinTg);

    // Create the transform group node for the each light and initialize
    // it to the identity.  Enable the TRANSFORM_WRITE capability so that
    // our behavior code can modify it at runtime.  Add them to the root
    // of the subgraph.

    // Create transformations for the positional lights
    t = new Transform3D();
    Vector3d lPos1 = new Vector3d(0.0, 0.0, 2.0);
    t.set(lPos1);
    TransformGroup l1Trans = new TransformGroup(t);
    l1Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    l1Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    l1Trans.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
    objScale.addChild(l1Trans);

    t = new Transform3D();
    Vector3d lPos2 = new Vector3d(0.5, 0.8, 2.0);
    t.set(lPos2);
    TransformGroup l2Trans = new TransformGroup(t);
    l2Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    l2Trans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    l2Trans.setCapability(TransformGroup.ENABLE_PICK_REPORTING);

    objScale.addChild(l2Trans);

    // Create Geometry for point lights
    ColoringAttributes caL1 = new ColoringAttributes();
    ColoringAttributes caL2 = new ColoringAttributes();
    caL1.setColor(lColor1);
    caL2.setColor(lColor2);
    Appearance appL1 = new Appearance();
    Appearance appL2 = new Appearance();
    appL1.setColoringAttributes(caL1);
    appL2.setColoringAttributes(caL2);
    l1Trans.addChild(new Sphere(0.05f, Sphere.GENERATE_NORMALS, 15, appL1));
    l2Trans.addChild(new Sphere(0.05f, Sphere.GENERATE_NORMALS, 15, appL2));

    // Create lights
    AmbientLight aLgt = new AmbientLight(alColor);

    Light lgt1;
    Light lgt2;

    Point3f lPoint = new Point3f(0.0f, 0.0f, 0.0f);
    Point3f atten = new Point3f(1.0f, 0.0f, 0.0f);
    lgt1 = new PointLight(lColor1, lPoint, atten);
    lgt2 = new PointLight(lColor2, lPoint, atten);

    // Set the influencing bounds
    aLgt.setInfluencingBounds(bounds);
    lgt1.setInfluencingBounds(bounds);
    lgt2.setInfluencingBounds(bounds);

    // Add the lights into the scene graph
    objScale.addChild(aLgt);
    l1Trans.addChild(lgt1);
    l2Trans.addChild(lgt2);

    PickRotateBehavior behavior1 = new PickRotateBehavior(objRoot, canvas, bounds);
    behavior1.setMode(PickTool.BOUNDS);
    objRoot.addChild(behavior1);

    PickZoomBehavior behavior2 = new PickZoomBehavior(objRoot, canvas, bounds);
    behavior2.setMode(PickTool.BOUNDS);
    objRoot.addChild(behavior2);

    PickTranslateBehavior behavior3 = new PickTranslateBehavior(objRoot, canvas, bounds);
    behavior3.setMode(PickTool.BOUNDS);
    objRoot.addChild(behavior3);

    // Let Java 3D perform optimizations on this scene graph.
    objRoot.compile();

    return objRoot;
}

From source file:edu.uci.ics.jung.samples.AnimatingAddNodeDemo.java

@Override
public void init() {

    //create a graph
    Graph<Number, Number> ig = Graphs
            .<Number, Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number, Number>());

    ObservableGraph<Number, Number> og = new ObservableGraph<Number, Number>(ig);
    og.addGraphEventListener(new GraphEventListener<Number, Number>() {

        public void handleGraphEvent(GraphEvent<Number, Number> evt) {
            System.err.println("got " + evt);

        }//from  w  w w  .  ja v  a2 s. c o  m
    });
    this.g = og;
    //create a graphdraw
    layout = new FRLayout<Number, Number>(g);
    layout.setSize(new Dimension(600, 600));
    Relaxer relaxer = new VisRunner((IterativeContext) layout);
    relaxer.stop();
    relaxer.prerelax();

    Layout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout);

    vv = new VisualizationViewer<Number, Number>(staticLayout, new Dimension(600, 600));

    JRootPane rp = this.getRootPane();
    rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().setBackground(java.awt.Color.lightGray);
    getContentPane().setFont(new Font("Serif", Font.PLAIN, 12));

    vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>());

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>());
    vv.setForeground(Color.white);

    vv.addComponentListener(new ComponentAdapter() {

        /**
         * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent)
         */
        @Override
        public void componentResized(ComponentEvent arg0) {
            super.componentResized(arg0);
            System.err.println("resized");
            layout.setSize(arg0.getComponent().getSize());
        }
    });

    getContentPane().add(vv);
    switchLayout = new JButton("Switch to SpringLayout");
    switchLayout.addActionListener(new ActionListener() {

        @SuppressWarnings({ "unchecked", "rawtypes" })
        public void actionPerformed(ActionEvent ae) {
            Dimension d = vv.getSize();//new Dimension(600,600);
            if (switchLayout.getText().indexOf("Spring") > 0) {
                switchLayout.setText("Switch to FRLayout");
                layout = new SpringLayout<Number, Number>(g, new ConstantTransformer(EDGE_LENGTH));
                layout.setSize(d);
                Relaxer relaxer = new VisRunner((IterativeContext) layout);
                relaxer.stop();
                relaxer.prerelax();
                StaticLayout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout);
                LayoutTransition<Number, Number> lt = new LayoutTransition<Number, Number>(vv,
                        vv.getGraphLayout(), staticLayout);
                Animator animator = new Animator(lt);
                animator.start();
                //   vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.repaint();

            } else {
                switchLayout.setText("Switch to SpringLayout");
                layout = new FRLayout<Number, Number>(g, d);
                layout.setSize(d);
                Relaxer relaxer = new VisRunner((IterativeContext) layout);
                relaxer.stop();
                relaxer.prerelax();
                StaticLayout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout);
                LayoutTransition<Number, Number> lt = new LayoutTransition<Number, Number>(vv,
                        vv.getGraphLayout(), staticLayout);
                Animator animator = new Animator(lt);
                animator.start();
                //   vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.repaint();

            }
        }
    });

    getContentPane().add(switchLayout, BorderLayout.SOUTH);

    timer = new Timer();
}