Example usage for java.awt Font BOLD

List of usage examples for java.awt Font BOLD

Introduction

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

Prototype

int BOLD

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

Click Source Link

Document

The bold style constant.

Usage

From source file:PointingMap.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, java.io.IOException {

    Connection conn = null;//from   ww w.  jav  a 2s  . c om
    Statement stmt = null;
    ResultSet rs = null;
    ResultSetMetaData rsm = null;

    OutputStream out = response.getOutputStream();
    try {

        String dbHost = request.getParameter("dbHost");
        String dbName = request.getParameter("dbName");

        conn = connect(dbHost, dbName);

        // get & plot target catalog
        String targetCatQuery = "select " + "ra2000Hours, dec2000Deg " + "from TargetCat limit 200";

        stmt = conn.createStatement();
        rs = stmt.executeQuery(targetCatQuery);
        rsm = rs.getMetaData();
        //int colCount = rsm.getColumnCount();

        XYSeries series = new XYSeries("Target Catalog");
        int raColIndex = 1;
        int decColIndex = 2;
        while (rs.next()) {
            series.add(rs.getDouble(raColIndex), rs.getDouble(decColIndex));
        }

        XYDataset data = new XYSeriesCollection(series);
        stmt.close();

        // Get latest primary beam pointing position
        String latestPointingQuery = "select " + "actId, ts, " + "raHours, decDeg " + "from TscopePointReq "
                + "where atabeam = 'primary' " + "order by actId desc limit 1";

        stmt = conn.createStatement();
        rs = stmt.executeQuery(latestPointingQuery);
        rsm = rs.getMetaData();
        //int colCount = rsm.getColumnCount();

        int actId = -1;
        String timeString = "";
        double pointingRaHours = -1;
        double pointingDecDeg = -1;

        int actIdIndex = 1;
        int timeIndex = 2;
        raColIndex = 3;
        decColIndex = 4;

        while (rs.next()) {
            actId = rs.getInt(actIdIndex);
            timeString = rs.getString(timeIndex);
            pointingRaHours = rs.getDouble(raColIndex);
            pointingDecDeg = rs.getDouble(decColIndex);
        }

        String plotTitle = "ATA Primary Pointing" + " (Act Id: " + actId + ")" + " " + timeString;

        JFreeChart chart = ChartFactory.createScatterPlot(plotTitle, "RA (Hours)", // x-axis label
                "Dec (Deg)", // y axis label
                data, PlotOrientation.VERTICAL, false, // legend 
                true, // tooltips
                false // urls
        );

        // plot RA hours with higher values to the left
        //chart.getXYPlot().getDomainAxis().setInverted(true);
        chart.getXYPlot().getDomainAxis().setLowerBound(-1);
        chart.getXYPlot().getDomainAxis().setUpperBound(25);

        // increase axis label fonts for better readability
        Font axisFont = new Font("Serif", Font.BOLD, 14);
        chart.getXYPlot().getDomainAxis().setLabelFont(axisFont);
        chart.getXYPlot().getDomainAxis().setTickLabelFont(axisFont);
        chart.getXYPlot().getRangeAxis().setLabelFont(axisFont);
        chart.getXYPlot().getRangeAxis().setTickLabelFont(axisFont);

        // show current pointing as crosshairs
        chart.getXYPlot().setDomainCrosshairValue(pointingRaHours);
        chart.getXYPlot().setRangeCrosshairValue(pointingDecDeg);
        chart.getXYPlot().setDomainCrosshairVisible(true);
        chart.getXYPlot().setRangeCrosshairVisible(true);
        chart.getXYPlot().setDomainCrosshairPaint(Color.BLACK);
        chart.getXYPlot().setRangeCrosshairPaint(Color.BLACK);

        Stroke stroke = new BasicStroke(2);
        chart.getXYPlot().setDomainCrosshairStroke(stroke);
        chart.getXYPlot().setRangeCrosshairStroke(stroke);

        // set hat creek dec range
        chart.getXYPlot().getRangeAxis().setLowerBound(-40);
        chart.getXYPlot().getRangeAxis().setUpperBound(90);

        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) chart.getXYPlot().getRenderer();
        int seriesIndex = 0;
        renderer.setSeriesPaint(seriesIndex, Color.BLUE);

        Shape circularShape = new Ellipse2D.Double(-1.0, -1.0, 1.2, 1.2);
        renderer.setSeriesShape(seriesIndex, circularShape);

        // Default shape [0-9]: 0=square 1=circle 2=uptriangle 3=diamond...
        //renderer.setShape(DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[1]);
        response.setContentType("image/png");
        int width = 800;
        int height = 600;
        ChartUtilities.writeChartAsPNG(out, chart, width, height);

    } catch (Exception e) {
        throw new ServletException(e);
    } finally {

        try {
            if (stmt != null) {
                stmt.close();
            }

            if (conn != null) {
                conn.close();
            }

        } catch (SQLException sql) {
        }

    }

}

From source file:edu.ucla.stat.SOCR.analyses.gui.SimpleLinearRegression.java

/**Initialize the Analysis*/
public void init() {

    showInput = false;/* www.  j  ava 2 s .c o m*/
    showSelect = false;
    showVisualize = false;
    super.init();

    analysisType = AnalysisType.SIMPLE_LINEAR_REGRESSION;

    //////System.out.println("SLR analysisType = " + analysisType);
    useInputExample = false;
    useLocalExample = false;
    useRandomExample = true;
    useServerExample = false;
    useStaticExample = SimpleLinearRegressionExamples.availableExamples;
    useGraph = true;

    onlineDescription = "http://en.wikipedia.org/wiki/Linear_regression";
    depMax = 1; // max number of dependent var
    indMax = 1; // max number of independent var
    resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize));
    frame = getFrame(this);
    setName("Regression & Correlation Analysis");
    // Create the toolBar
    toolBar = new JToolBar();
    createActionComponents(toolBar);
    this.getContentPane().add(toolBar, BorderLayout.NORTH);

    chartFactory = new Chart();
    resetGraph();
    validate();
    //      reset();
}

From source file:is.iclt.jcorpald.CorpaldView.java

public void createAndShowGUI() {
    CorpaldSettings settings = CorpaldSettings.getInstance();

    //Create and set up the window.
    JFrame frame = new JFrame(settings.getProperty("corpus.acronym") + " "
            + settings.getProperty("corpus.version") + " - " + settings.getProperty("corpus.longname"));
    frame.setIconImage((new ImageIcon("icons/corpald.png")).getImage());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // frame.setBounds(50, 50, 700, 450);
    frame.setPreferredSize(new Dimension(750, 720));

    // Create the panel that has the query and the result        
    JPanel panMainArea = new JPanel(new BorderLayout());
    JPanel panQuery = new JPanel(new BorderLayout());

    txtQuery = new JHighlightPane();
    txtQuery.addKeyListener(this);

    txtQuery.setFont(new Font("Monospaced", Font.BOLD, 16));
    this.updateHighlighting();
    txtQuery.setPreferredSize(new Dimension(700, 150));

    panQuery.add(labQuery, BorderLayout.NORTH);
    panQuery.add(new JScrollPane(txtQuery, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.CENTER);
    panQuery.setBorder(new EmptyBorder(0, 10, 10, 10));

    String welcomeMessage = "";
    try {/*from   w ww.j  a  v  a  2  s . c om*/
        welcomeMessage = FileUtils.readFileToString(new File(settings.getProperty("corpus.welcome")), "utf-8");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    JPanel panResult = new JPanel(new BorderLayout());
    txtResult = new JTextArea(welcomeMessage);

    txtResult.setEditable(false);
    txtResult.setFont(new Font("Monospaced", Font.BOLD, 14));

    JScrollPane scrResult = new JScrollPane(txtResult, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrResult.setPreferredSize(new Dimension(700, 400));
    panResult.add(new JLabel("Result:"), BorderLayout.NORTH);
    panResult.add(scrResult, BorderLayout.CENTER);
    panResult.setBorder(new EmptyBorder(0, 10, 0, 10));

    panMainArea.add(panQuery, BorderLayout.NORTH);
    panMainArea.add(panResult, BorderLayout.CENTER);

    // Create panel at top with buttons
    JPanel panToolbar = new JPanel(new FlowLayout(FlowLayout.CENTER));

    // New, Open, Save
    // New
    ImageIcon icoNewQuery = new ImageIcon("icons/page_white.png");
    butNewQuery = new JButton(icoNewQuery);
    butNewQuery.addActionListener(this);
    butNewQuery.setPreferredSize(new Dimension(26, 26));
    butNewQuery.setToolTipText("Create a new empty query");
    panToolbar.add(butNewQuery);
    // Open
    ImageIcon icoOpenQuery = new ImageIcon("icons/folder.png");
    butOpenQuery = new JButton(icoOpenQuery);
    butOpenQuery.addActionListener(this);
    butOpenQuery.setPreferredSize(new Dimension(26, 26));
    butOpenQuery.setToolTipText("Open a query file");
    panToolbar.add(butOpenQuery);
    // Save
    ImageIcon icoSaveQuery = new ImageIcon("icons/page_save.png");
    butSaveQuery = new JButton(icoSaveQuery);
    butSaveQuery.addActionListener(this);
    butSaveQuery.setPreferredSize(new Dimension(26, 26));
    butSaveQuery.setToolTipText("Save current query");
    panToolbar.add(butSaveQuery);
    // Save as
    ImageIcon icoSaveQueryAs = new ImageIcon("icons/page_save_as.png");
    butSaveQueryAs = new JButton(icoSaveQueryAs);
    butSaveQueryAs.addActionListener(this);
    butSaveQueryAs.setPreferredSize(new Dimension(26, 26));
    butSaveQueryAs.setToolTipText("Save current query under a new file name");
    panToolbar.add(butSaveQueryAs);

    // Open definitions file
    ImageIcon icoOpenDef = new ImageIcon("icons/folder_table.png");
    butOpenDef = new JButton(icoOpenDef);
    butOpenDef.addActionListener(this);
    butOpenDef.setPreferredSize(new Dimension(26, 26));
    butOpenDef.setToolTipText("Select a new definitions file");
    panToolbar.add(butOpenDef);

    // Run Query button
    ImageIcon icoRunQuery = new ImageIcon("icons/control_play_blue.png");
    butRunQuery = new JButton("Run Query", icoRunQuery);
    butRunQuery.setPreferredSize(new Dimension(130, 26));
    butRunQuery.addActionListener(this);
    butRunQuery.setToolTipText("Run the current query using CorpusSearch");
    panToolbar.add(butRunQuery);

    // TextField for root node label
    JLabel labRootNode = new JLabel("Root:");
    panToolbar.add(labRootNode);
    txtRootNode = new JTextField("", 12);
    txtRootNode.setPreferredSize(new Dimension(50, 26));
    txtRootNode.addKeyListener(this);
    txtRootNode.setMargin(new Insets(3, 3, 3, 3));
    txtRootNode.setToolTipText("<html>Search within instances of a particular type of node,<br/>"
            + "such as IP-*, IP-SUB, NP-*, etc. $ROOT matches<br/>"
            + "the root node of every tree in the corpus.</html>");
    panToolbar.add(txtRootNode);

    chkNodesOnly = new JCheckBox("Nodes only");
    chkNodesOnly.addItemListener(this);
    chkNodesOnly.setToolTipText("<html>If checked, CorpusSearch prints out only the nodes that<br/>"
            + "contain the structure described in \"Query\". If not checked,<br/>"
            + "CorpusSearch prints out the entire sentence that contains the<br/>"
            + "structure described in \"Query\".</html>");
    panToolbar.add(chkNodesOnly);

    chkRemoveNodes = new JCheckBox("Remove nodes");
    chkRemoveNodes.addItemListener(this);
    chkRemoveNodes.setToolTipText("<html>Remove subtrees whose root is of the same syntactic category<br/>"
            + "as the node boundary embedded within a instance of that node<br/>"
            + "boundary. \"Remove nodes\" thus removes recursive structure.</html>");
    panToolbar.add(chkRemoveNodes);

    // Create panel at top with buttons
    JPanel panBottombar = new JPanel(new FlowLayout(FlowLayout.CENTER));
    // panBottombar.setBorder(new EmptyBorder(0, 0, 10, 5));
    ImageIcon icoOpenFolder = new ImageIcon("icons/folder.png");
    butOpenFolder = new JButton("Show result in folder", icoOpenFolder);
    butOpenFolder.setEnabled(false);
    butOpenFolder.addActionListener(this);
    panBottombar.add(butOpenFolder);

    ImageIcon icoTextEditor = new ImageIcon("icons/page_white_go.png");
    butTextEditor = new JButton("Open result in text editor", icoTextEditor);
    butTextEditor.setEnabled(false);
    butTextEditor.addActionListener(this);
    panBottombar.add(butTextEditor);

    ImageIcon icoCopyResults = new ImageIcon("icons/page_copy.png");
    butCopyResults = new JButton("Copy result to clipboard", icoCopyResults);
    butCopyResults.setEnabled(false);
    butCopyResults.addActionListener(this);
    panBottombar.add(butCopyResults);

    // Add stuff to top level content pane                
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(panToolbar, BorderLayout.NORTH);
    frame.getContentPane().add(panMainArea, BorderLayout.CENTER);
    frame.getContentPane().add(panBottombar, BorderLayout.SOUTH);

    this.configureFileFilters();

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:com.xilinx.virtex7.PowerChart.java

private void makeChart() {
    dataset = new DefaultCategoryDataset();
    chart = ChartFactory.createBarChart("", "Time Interval", "", dataset, PlotOrientation.HORIZONTAL, true,
            true, false);//from   www  .  j  ava 2s  .  com

    TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15));
    ttitle.setPaint(Color.WHITE);
    chart.setTitle(ttitle);
    chart.setBackgroundPaint(bg);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);

    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    ValueAxis axis = plot.getRangeAxis();
    axis.setUpperBound(10.0);
    TickUnits tickUnits = new TickUnits();
    tickUnits.add(new NumberTickUnit(2));
    axis.setStandardTickUnits(tickUnits);
    axis.setLowerBound(0.0);
    axis.setTickLabelPaint(new Color(185, 185, 185));

    CategoryAxis caxis = plot.getDomainAxis();
    caxis.setTickLabelPaint(new Color(185, 185, 185));
    caxis.setLabelPaint(new Color(185, 185, 185));

    renderer.setItemMargin(0);
    renderer.setSeriesPaint(0, new Color(0x17, 0x7b, 0x7c));
    renderer.setSeriesPaint(1, new Color(0xa2, 0x45, 0x73));
    renderer.setSeriesPaint(2, new Color(0xff, 0x80, 0x40));
    renderer.setSeriesPaint(3, new Color(0x6f, 0x2c, 0x85));
    renderer.setBaseToolTipGenerator(
            new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000")));
    addDummy();
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java

/**
 * This method initializes jPanelValue   
 *    /*from   w  w  w.j a va2s .  c om*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelValue() {
    if (jPanelValue == null) {

        jPanelValue = new JPanel();
        jPanelValue.setLayout(new GridBagLayout());
        jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelValue.setPreferredSize(new Dimension(400, 200));

        // Default Report Location

        jLabelDefaultReportLocation = new JLabel();
        jLabelDefaultReportLocation.setText("Default Report Location:");
        jLabelDefaultReportLocation.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelDefaultReportLocation = new GridBagConstraints();
        gridBagConstraintsjLabelDefaultReportLocation.gridx = 0;
        gridBagConstraintsjLabelDefaultReportLocation.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelDefaultReportLocation.insets = new Insets(5, 0, 0, 0);
        gridBagConstraintsjLabelDefaultReportLocation.gridy = 1;

        GridBagConstraints gridBagConstraintsjpanelDefaultReportLocation = new GridBagConstraints();
        gridBagConstraintsjpanelDefaultReportLocation.fill = GridBagConstraints.BOTH;
        gridBagConstraintsjpanelDefaultReportLocation.gridy = 1;
        gridBagConstraintsjpanelDefaultReportLocation.weightx = 1.0;
        gridBagConstraintsjpanelDefaultReportLocation.insets = new Insets(10, 5, 5, 15);
        gridBagConstraintsjpanelDefaultReportLocation.gridx = 1;

        // reciprocal license

        jLabelReciprocalLicense = new JLabel();
        jLabelReciprocalLicense.setText("Reciprocal License (RED):");
        jLabelReciprocalLicense.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelReciprocalLicense = new GridBagConstraints();
        gridBagConstraintsjLabelReciprocalLicense.gridx = 0;
        gridBagConstraintsjLabelReciprocalLicense.insets = new Insets(0, 15, 0, 0);
        gridBagConstraintsjLabelReciprocalLicense.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelReciprocalLicense.gridy = 2;
        jPanelValue.add(jLabelDefaultReportLocation, gridBagConstraintsjLabelDefaultReportLocation);
        jPanelValue.add(getJPanelDefaultReportLocation(), gridBagConstraintsjpanelDefaultReportLocation);
        jPanelValue.add(jLabelReciprocalLicense, gridBagConstraintsjLabelReciprocalLicense);

        GridBagConstraints gridBagConstraintsgetJTextFieldReciprocalLicense = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldReciprocalLicense.gridx = 1;
        gridBagConstraintsgetJTextFieldReciprocalLicense.weightx = 1.0;
        gridBagConstraintsgetJTextFieldReciprocalLicense.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldReciprocalLicense.insets = new Insets(5, 5, 5, 15);
        gridBagConstraintsgetJTextFieldReciprocalLicense.gridy = 2;
        jPanelValue.add(getJTextFieldReciprocalLicense(), gridBagConstraintsgetJTextFieldReciprocalLicense);

        // major license

        jLabelMajorLicense = new JLabel();
        jLabelMajorLicense.setText("Major License (ORANGE):");
        jLabelMajorLicense.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelMajorLicense = new GridBagConstraints();
        gridBagConstraintsjLabelMajorLicense.gridx = 0;
        gridBagConstraintsjLabelMajorLicense.insets = new Insets(0, 15, 0, 0);
        gridBagConstraintsjLabelMajorLicense.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelMajorLicense.gridy = 3;
        jPanelValue.add(jLabelMajorLicense, gridBagConstraintsjLabelMajorLicense);

        GridBagConstraints gridBagConstraintsgetJTextFieldMajorLicense = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldMajorLicense.gridx = 1;
        gridBagConstraintsgetJTextFieldMajorLicense.weightx = 1.0;
        gridBagConstraintsgetJTextFieldMajorLicense.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldMajorLicense.insets = new Insets(5, 5, 5, 15);
        gridBagConstraintsgetJTextFieldMajorLicense.gridy = 3;
        jPanelValue.add(getJTextFieldMajorLicense(), gridBagConstraintsgetJTextFieldMajorLicense);

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;
        gridBagConstraints3.weighty = 1.0;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.gridy = 4;
        JLabel jLabelEmpty = new JLabel();
        jLabelEmpty.setText("");
        jPanelValue.add(jLabelEmpty, gridBagConstraints3);
    }
    return jPanelValue;
}

From source file:CircleOfSquares.java

public void init() {

    setBackground(ColorTable.appletBackgroundColor);
    setLayout(new BorderLayout(5, 5));

    threeParts = new ThreeParts(SimData.methodAreaMemorySectionSize);
    simulationController = new ControlPanel();
    resetButton = simulationController.getResetButton();

    ColoredLabel title = new ColoredLabel(StringTable.appletTitle, Label.CENTER, ColorTable.titleColor);
    title.setFont(new Font("Helvetica", Font.BOLD, 12));
    add("North", title);
    add("South", simulationController);
    add("Center", threeParts);

    // Get a reference to the UI objects that are actually manipulated by
    // the handlers of the Step and Reset buttons. These aren't available
    // without this explicit get() because these objects are buried several
    // levels down in embedded panels.
    stackMemoryView = threeParts.getStackMemoryViewReference();
    methodAreaMemoryView = threeParts.getMethodAreaMemoryViewReference();
    registers = threeParts.getRegisterPanel();

    // Place the bytecodes into the method area
    for (int i = 0; i < SimData.methodAreaMemorySectionSize; ++i) {

        methodAreaMemorySection.setAtAddress(methodAreaBase + i, SimData.theProgram[i]);

        methodAreaMemorySection.setLogicalValueAtAddress(methodAreaBase + i, SimData.byteCodeMnemonics[i]);
    }//from   w  ww .j  ava  2s  .c  om

    ResetState();
    UpdateStateDisplay();
}

From source file:de.hs.mannheim.modUro.reader.BoxAndWhiskersPlotDiagram.java

/**
 * Plots Data for Chart/*from  w w  w.j  a v  a 2 s .co  m*/
 */
private void boxWhiskerPlot() {
    BoxAndWhiskerCategoryDataset dataset = createDataset();
    CategoryAxis xAxis = new CategoryAxis("Model");
    NumberAxis yAxis = new NumberAxis("Fitness");
    yAxis.setRange(0.0, 1.0);

    BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setMaximumBarWidth(0.2);
    renderer.setItemMargin(0.5);
    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.HORIZONTAL);

    chart = new JFreeChart("Model comparison", new Font("Palatino", Font.BOLD, 14), plot, true);
    chart.removeLegend();
    // boxWhiskerPane.setCenter(viewer);
}

From source file:com.limegroup.gnutella.gui.themes.setters.SubstanceThemeSetter.java

public void apply() {
    SubstanceLookAndFeel.setSkin(_skinClassName);
    ThemeMediator.applyCommonSkinUI();// w  w w  . ja  va  2s  . c  o m

    float scaledFontPolicyFactor = WINDOWS_SCALED_FONT_POLICY_FACTOR;
    if (OSUtils.isMacOSX()) {
        scaledFontPolicyFactor = MAC_SCALED_FONT_POLICY_FACTOR;
    } else if (OSUtils.isLinux()) {
        scaledFontPolicyFactor = LINUX_SCALED_FONT_POLICY_FACTOR;
    }

    if (LookUtils.IS_OS_WINDOWS) {
        fixWindowsOSFont();
    } else if (LookUtils.IS_OS_LINUX) {
        fixLinuxOSFont();
    }

    SubstanceLookAndFeel.setFontPolicy(SubstanceFontUtilities.getScaledFontPolicy(scaledFontPolicyFactor));

    //reduceFont("Label.font");
    //reduceFont("Table.font");
    //ResourceManager.setFontSizes(-1);
    //ResourceManager.setFontSizes(0);

    UIManager.put("Tree.leafIcon", UIManager.getIcon("Tree.closedIcon"));

    // remove split pane borders
    UIManager.put("SplitPane.border", BorderFactory.createEmptyBorder());

    if (!OSUtils.isMacOSX()) {
        UIManager.put("Table.focusRowHighlightBorder", UIManager.get("Table.focusCellHighlightBorder"));
    }

    UIManager.put("Table.focusCellHighlightBorder", BorderFactory.createEmptyBorder(1, 1, 1, 1));

    // Add a bold text version of simple text.
    Font normal = UIManager.getFont("Table.font");
    FontUIResource bold = new FontUIResource(normal.getName(), Font.BOLD, normal.getSize());
    UIManager.put("Table.font.bold", bold);
    UIManager.put("Tree.rowHeight", 0);
}

From source file:net.sf.dynamicreports.test.jasper.chart.DifferenceChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);// ww  w  .  ja  v  a2s .  c  o m

    JFreeChart chart = getChart("summary.chart1", 0);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    Assert.assertEquals("renderer", XYDifferenceRenderer.class, renderer.getClass());
    Assert.assertFalse("show shapes", ((XYDifferenceRenderer) renderer).getShapesVisible());
    Assert.assertEquals("positive paint", Color.BLUE, ((XYDifferenceRenderer) renderer).getPositivePaint());
    Assert.assertEquals("negative paint", Color.MAGENTA, ((XYDifferenceRenderer) renderer).getNegativePaint());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    Assert.assertEquals("category label", "time", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());

    chart = getChart("summary.chart3", 0);
    axis = chart.getXYPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
    Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());
}

From source file:Transfer.java

public Transfer() {

    // Establish the GUI
    Container cp = new Box(BoxLayout.X_AXIS);
    setContentPane(cp);/*from   ww  w. ja  v  a2  s . c  om*/
    JPanel firstPanel = new JPanel();
    propertyComboBox = new JComboBox();
    propertyComboBox.addItem("text");
    propertyComboBox.addItem("font");
    propertyComboBox.addItem("background");
    propertyComboBox.addItem("foreground");
    firstPanel.add(propertyComboBox);
    cp.add(firstPanel);
    cp.add(Box.createGlue());

    tf = new JTextField("Hello");
    tf.setForeground(Color.RED);
    tf.setDragEnabled(true);
    cp.add(tf);

    cp.add(Box.createGlue());

    l = new JLabel("Hello");
    l.setBackground(Color.YELLOW);
    cp.add(l);

    cp.add(Box.createGlue());

    JSlider stryder = new JSlider(SwingConstants.VERTICAL);
    stryder.setMinimum(10);
    stryder.setValue(14);
    stryder.setMaximum(72);
    stryder.setMajorTickSpacing(10);
    stryder.setPaintTicks(true);

    cp.add(stryder);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(500, 300);

    // Add Listeners and Converters
    setMyTransferHandlers((String) propertyComboBox.getSelectedItem());

    // Mousing in the Label starts a Drag.
    MouseListener myDragListener = new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            JComponent c = (JComponent) e.getSource();
            TransferHandler handler = c.getTransferHandler();
            handler.exportAsDrag(c, e, TransferHandler.COPY);
        }
    };
    l.addMouseListener(myDragListener);

    // Selecting in the ComboBox makes that the property that is xfered.
    propertyComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ce) {
            JComboBox bx = (JComboBox) ce.getSource();
            String prop = (String) bx.getSelectedItem();
            setMyTransferHandlers(prop);
        }
    });

    // Typing a word and pressing enter in the TextField tries
    // to set that as the font name.
    tf.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            JTextField jtf = (JTextField) evt.getSource();
            String fontName = jtf.getText();
            Font font = new Font(fontName, Font.BOLD, 18);
            tf.setFont(font);
        }
    });

    // Setting the Slider sets that font into the textfield.
    stryder.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent evt) {
            JSlider sl = (JSlider) evt.getSource();
            Font oldf = tf.getFont();
            Font newf = oldf.deriveFont((float) sl.getValue());
            tf.setFont(newf);
        }
    });

}