Example usage for javax.swing.plaf.basic BasicLabelUI BasicLabelUI

List of usage examples for javax.swing.plaf.basic BasicLabelUI BasicLabelUI

Introduction

In this page you can find the example usage for javax.swing.plaf.basic BasicLabelUI BasicLabelUI.

Prototype

BasicLabelUI

Source Link

Usage

From source file:com.epiq.bitshark.ui.TimeDomainPanel.java

public TimeDomainPanel() {
    initComponents();/*  www  .j av  a  2  s  . c o m*/

    initGraph();

    JPanel holderPanel = new JPanel() {
        @Override
        public void paint(Graphics g) {

            if (plot.getDomainAxis().isAutoRange()) {
                plot.getDomainAxis().setAutoRange(false);
                Range newDomain = new Range(0, FMCUartClient.BLOCK_SIZE - 1);
                plot.getDomainAxis().setRange(newDomain, true, false);
            }

            if (plot.getRangeAxis().isAutoRange()) {
                plot.getRangeAxis().setAutoRange(false);
            }

            // ensureAxisMargin( ) ?

            Range newRange = null;
            Range currentRangeRange = plot.getRangeAxis().getRange();
            double extent = currentRangeRange.getUpperBound() - currentRangeRange.getLowerBound();
            newRange = new Range(-(extent) / 2, (extent) / 2);
            plot.getRangeAxis().setRange(newRange, true, false);

            super.paint(g);
        }
    };
    holderPanel.setLayout(new BorderLayout());
    holderPanel.add(chartPanel, BorderLayout.CENTER);
    mainPanel.add(holderPanel, BorderLayout.CENTER);

    headerPanel.setBackgroundPainter(Common.getHeaderPainter());

    titleLabel.setUI(new BasicLabelUI());

    showICheckBox.setFocusPainted(false);
    showQCheckBox.setFocusPainted(false);
}

From source file:com.epiq.bitshark.ui.IVQPanel.java

public IVQPanel() {

    initComponents();/*from w  ww .  j  a  va  2s .  c  o m*/

    initGraph();

    JPanel holderPanel = new JPanel() {

        @Override
        public void paint(Graphics g) {

            Range newDomain = null; // x
            Range newRange = null; // y

            Range currentDomainRange = plot.getDomainAxis().getRange();
            Range currentRangeRange = plot.getRangeAxis().getRange();

            if (plot.getDomainAxis().isAutoRange()) {
                plot.getDomainAxis().setAutoRange(false);
            }

            if (plot.getRangeAxis().isAutoRange()) {
                plot.getRangeAxis().setAutoRange(false);
            }

            Rectangle2D dataArea = chartPanel.getChartRenderingInfo().getPlotInfo().getDataArea();
            double width = dataArea.getWidth();
            double height = dataArea.getHeight();

            double domainScale = 1;
            double rangeScale = 1;

            // scale the domain values up to match the pixels
            if (width > height) {
                domainScale = width / height;
                double extent = currentRangeRange.getUpperBound() - currentRangeRange.getLowerBound();
                newDomain = new Range(-(extent * domainScale) / 2, (extent * domainScale) / 2);

            } else if (height > width) {
                rangeScale = height / width;
                double extent = currentDomainRange.getUpperBound() - currentDomainRange.getLowerBound();
                newRange = new Range(-(extent * rangeScale) / 2, (extent * rangeScale) / 2);
            }

            if (newDomain == null) {
                double extent = currentDomainRange.getUpperBound() - currentDomainRange.getLowerBound();
                newDomain = new Range(-(extent) / 2, (extent) / 2);
            }

            if (newRange == null) {
                double extent = currentRangeRange.getUpperBound() - currentRangeRange.getLowerBound();
                newRange = new Range(-(extent) / 2, (extent) / 2);
            }

            if (newDomain != null) {
                plot.getDomainAxis().setRange(newDomain, true, false);
            }

            if (newRange != null) {
                plot.getRangeAxis().setRange(newRange, true, false);
            }

            Graphics2D g2 = (Graphics2D) g.create();
            super.paint(g2);

            g2.dispose();
        }
    };

    holderPanel.setLayout(new BorderLayout());
    holderPanel.add(chartPanel, BorderLayout.CENTER);
    mainPanel.add(holderPanel, BorderLayout.CENTER);

    headerPanel.setBackgroundPainter(Common.getHeaderPainter());

    chartLabel.setUI(new BasicLabelUI());
}

From source file:com.epiq.bitshark.ui.FrequencyDomainPanel.java

/** Creates new form FrequencyDomainPanel */
public FrequencyDomainPanel() {
    initComponents();//from   w w  w .jav a2  s .  c o m

    initGraph();

    headerPanel.setBackgroundPainter(Common.getHeaderPainter());

    JPanel holderPanel = new JPanel() {
        @Override
        public void paint(Graphics g) {

            if (plot.getDomainAxis().isAutoRange()) {
                plot.getDomainAxis().setAutoRange(false);
                Range newDomain = new Range(0, FMCUartClient.BLOCK_SIZE - 1);
                plot.getDomainAxis().setRange(newDomain, true, false);
            }

            if (plot.getRangeAxis().isAutoRange()) {
                plot.getRangeAxis().setAutoRange(false);
                Range newRange = new Range(-50, 70);
                plot.getRangeAxis().setRange(newRange, true, false);
            }

            super.paint(g);
        }
    };
    holderPanel.setLayout(new BorderLayout());
    holderPanel.add(chartPanel, BorderLayout.CENTER);
    this.mainPanel.add(holderPanel, BorderLayout.CENTER);

    windowComboBox.setModel(new DefaultComboBoxModel(WindowFunction.values()));
    windowComboBox.setSelectedItem(WindowFunction.BLACKMAN_HARRIS);
    windowComboBox.setRenderer(new DefaultListCellRenderer() {

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {

            Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (c instanceof JLabel && value instanceof WindowFunction) {
                JLabel l = (JLabel) c;
                WindowFunction cw = (WindowFunction) value;
                l.setText(cw.getName());
            }

            return c;
        }

    });

    graphLabel.setUI(new BasicLabelUI());
    alphaLabel.setUI(new BasicLabelUI());
    windowLabel.setUI(new BasicLabelUI());
}