Example usage for java.awt Color gray

List of usage examples for java.awt Color gray

Introduction

In this page you can find the example usage for java.awt Color gray.

Prototype

Color gray

To view the source code for java.awt Color gray.

Click Source Link

Document

The color gray.

Usage

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

public void resetExample() {
    isDemo = true;//from  w  ww  .  j a  v a2 s. c om
    XYDataset dataset = createDataset(isDemo);

    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);
    setChart();

    hasExample = true;

    convertor.dataset2Table((TimeSeriesCollection) dataset);
    JTable tempDataTable = convertor.getTable();
    int seriesCount = tempDataTable.getColumnCount() / 2;
    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(seriesCount * 2 + 2);

    for (int i = 0; i < seriesCount * 2; i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }
    dataPanel.removeAll();
    dataPanel.add(new JScrollPane(dataTable));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);

    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // do the mapping
    for (int i = 0; i < seriesCount; i++) {
        addButtonIndependent();
        addButtonDependent();
    }

    updateStatus(url);
}

From source file:visualizer.datamining.dataanalysis.NeighborhoodPreservation.java

private JFreeChart createChart(XYDataset xydataset) {
    JFreeChart chart = ChartFactory.createXYLineChart("Neighborhood Preservation", "Number Neighbors",
            "Precision", xydataset, PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot xyplot = (XYPlot) chart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);

    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    xyplot.setOutlinePaint(Color.BLACK);
    xyplot.setOutlineStroke(new BasicStroke(1.0f));
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    xyplot.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE,
                    Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW },
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseShapesFilled(true);
    xylineandshaperenderer.setDrawOutlines(true);

    return chart;
}

From source file:es.urjc.ia.fia.genericSearch.statistics.JUNGStatistics.java

@Override
public void showStatistics() {

    // Layout: tree and radial
    treeLayout = new TreeLayout<AuxVertex, ACTION>(this.tree, 35, 100);
    radialLayout = new RadialTreeLayout<AuxVertex, ACTION>(this.tree, 35, 130);

    radialLayout.setSize(new Dimension(200 * (this.tree.getHeight() + 1), 200 * (this.tree.getHeight() + 1)));

    // The BasicVisualizationServer<V,E> is parameterized by the edge types
    vv = new VisualizationViewer<AuxVertex, ACTION>(treeLayout);
    vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
    vv.setBackground(Color.white); // Background color

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<AuxVertex>());
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>());

    // Setup up a new vertex to paint transformer
    Transformer<AuxVertex, Paint> vertexPaint = new Transformer<AuxVertex, Paint>() {
        @Override/*  w w  w.  j  a  v a2  s .  c om*/
        public Paint transform(AuxVertex arg0) {
            if (arg0.getState().isSolution() && arg0.isExplored()) {
                return Color.GREEN;
            } else if (arg0.isExplored()) {
                return Color.CYAN;
            } else if (arg0.isDuplicated()) {
                return Color.GRAY;
            } else {
                return Color.WHITE;
            }
        }
    };

    // Tooltip for vertex
    Transformer<AuxVertex, String> toolTipsState = new Transformer<AuxVertex, String>() {

        @Override
        public String transform(AuxVertex arg0) {
            String sortInfo = "";
            if (arg0.isExplored()) {
                if (arg0.getState().isSolution() && arg0.isExplored()) {
                    sortInfo = "<u><i>Solution state " + arg0.getExplored() + "</i></u>";
                } else {
                    sortInfo = "<u><i>Explored state " + arg0.getExplored() + "</i></u>";
                }
            } else if (arg0.isDuplicated()) {
                sortInfo = "<u><i>Duplicated state </i></u>";
            } else {
                sortInfo = "<u><i>Unexplored state</i></u>";
            }
            return "<html><p>" + sortInfo + "</p>" + "<p>State: " + arg0.getState().toString() + "</p>"
                    + "<p>Cost: " + arg0.getState().getSolutionCost() + "</p></html>";
        }

    };
    vv.setVertexToolTipTransformer(toolTipsState);

    // Tooltip for edge
    Transformer<ACTION, String> toolTipsAction = new Transformer<ACTION, String>() {

        @Override
        public String transform(ACTION arg0) {
            return "Cost: " + arg0.cost();
        }

    };
    vv.setEdgeToolTipTransformer(toolTipsAction);

    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<ACTION>());

    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);

    // Create a graph mouse and add it to the visualization component
    DefaultModalGraphMouse<State<ACTION>, ACTION> gm = new DefaultModalGraphMouse<State<ACTION>, ACTION>();
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);
    vv.addKeyListener(gm.getModeKeyListener());

    JFrame vFrame = new JFrame("Statistics Tree View");
    vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    /*
    vFrame.getContentPane().add(vv);
    vFrame.pack();
    vFrame.setVisible(true);
    */

    rings = new Rings();
    Container content = vFrame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    JComboBox modeBox = gm.getModeComboBox();
    modeBox.addItemListener(gm.getModeListener());
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {

                LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv, treeLayout,
                        radialLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv,
                        radialLayout, treeLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.removePreRenderPaintable(rings);
            }
            vv.repaint();
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    /*
     * Statistics 
     */
    JLabel stats = new JLabel();
    long totalTime = endTime.getTime() - initTime.getTime();
    stats.setText("<html>" + "<b>Total States:</b> " + this.totalStates + "<br>" + "<b>Explored States:</b> "
            + this.explorerStates + "<br>" + "<b>Duplicated States (detected):</b> " + this.duplicatedStates
            + "<br>" + "<b>Solution States:</b> " + this.solutionStates + "<br>" + "<b>Total time: </b>"
            + totalTime + " milliseconds" + "</html>");

    JPanel legend = new JPanel();
    legend.setLayout(new BoxLayout(legend, BoxLayout.Y_AXIS));

    JLabel len = new JLabel("<html><b>Lengend</b></html>");
    JLabel lexpl = new JLabel("Explored state");
    lexpl.setBackground(Color.CYAN);
    lexpl.setOpaque(true);
    JLabel lune = new JLabel("Unexplored state");
    lune.setBackground(Color.WHITE);
    lune.setOpaque(true);
    JLabel ldupl = new JLabel("Duplicated state");
    ldupl.setBackground(Color.GRAY);
    ldupl.setOpaque(true);
    JLabel lsol = new JLabel("Solution state");
    lsol.setBackground(Color.GREEN);
    lsol.setOpaque(true);

    legend.add(len);
    legend.add(lexpl);
    legend.add(lune);
    legend.add(ldupl);
    legend.add(lsol);

    JPanel controls = new JPanel();
    controls.add(stats);
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    //controls.add(modeBox);
    controls.add(legend);

    content.add(controls, BorderLayout.SOUTH);

    vFrame.pack();
    vFrame.setVisible(true);
}

From source file:unalcol.termites.boxplots.SucessfulRatesGlobal.java

private static JFreeChart createChart(CategoryDataset categorydataset, ArrayList<Double> pf) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Success Rates - " + getTitle(pf), "", "",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.getTitle().setFont(new Font("Sans-Serif", Font.PLAIN, 18));
    jfreechart.setBackgroundPaint(new Color(221, 223, 238));
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.white);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setRangeGridlinePaint(Color.gray);
    categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();
    //categoryplot.setBackgroundPaint(new Color(221, 223, 238));

    renderer.setSeriesPaint(0, new Color(130, 165, 70));
    renderer.setSeriesPaint(1, new Color(220, 165, 70));
    renderer.setSeriesPaint(4, new Color(255, 165, 70));
    renderer.setDrawBarOutline(false);/*from  ww w .  j  av a 2 s .  c  o  m*/
    renderer.setShadowVisible(false);
    // renderer.setMaximumBarWidth(1);
    renderer.setGradientPaintTransformer(null);
    renderer.setDefaultBarPainter(new StandardBarPainter());

    categoryplot.setRenderer(renderer);

    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setUpperMargin(0.25D);
    CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer();
    categoryitemrenderer.setBaseItemLabelsVisible(true);
    categoryitemrenderer.setBaseItemLabelGenerator(new LabelGenerator(null));
    numberaxis.setRange(0, 100);
    //numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());

    Font font = new Font("SansSerif", Font.ROMAN_BASELINE, 12);
    numberaxis.setTickLabelFont(font);
    CategoryAxis axisd = categoryplot.getDomainAxis();
    ValueAxis axisr = categoryplot.getRangeAxis();
    axisd.setTickLabelFont(font);
    axisr.setTickLabelFont(font);

    final ChartPanel chartPanel = new ChartPanel(jfreechart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));

    FileOutputStream output;
    try {
        output = new FileOutputStream("successGlobalRates" + pf + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, jfreechart, 650, 370, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    }
    return jfreechart;
}

From source file:com.xmage.launcher.XMageLauncher.java

private XMageLauncher() {
    locale = Locale.getDefault();
    //locale = new Locale("it", "IT");
    messages = ResourceBundle.getBundle("MessagesBundle", locale);
    localize();/*  w  w w .j a v  a2s.  co m*/

    serverConsole = new XMageConsole("XMage Server console");
    clientConsole = new XMageConsole("XMage Client console");

    frame = new JFrame(messages.getString("frameTitle") + " " + Config.getVersion());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setPreferredSize(new Dimension(800, 500));
    frame.setResizable(false);

    createToolbar();

    ImageIcon icon = new ImageIcon(XMageLauncher.class.getResource("/icon-mage-flashed.png"));
    frame.setIconImage(icon.getImage());

    Random r = new Random();
    int imageNum = 1 + r.nextInt(17);
    ImageIcon background = new ImageIcon(new ImageIcon(
            XMageLauncher.class.getResource("/backgrounds/" + Integer.toString(imageNum) + ".jpg")).getImage()
                    .getScaledInstance(800, 480, Image.SCALE_SMOOTH));
    mainPanel = new JLabel(background) {
        @Override
        public Dimension getPreferredSize() {
            Dimension size = super.getPreferredSize();
            Dimension lmPrefSize = getLayout().preferredLayoutSize(this);
            size.width = Math.max(size.width, lmPrefSize.width);
            size.height = Math.max(size.height, lmPrefSize.height);
            return size;
        }
    };
    mainPanel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            grabPoint = e.getPoint();
            mainPanel.getComponentAt(grabPoint);
        }
    });
    mainPanel.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseDragged(MouseEvent e) {

            // get location of Window
            int thisX = frame.getLocation().x;
            int thisY = frame.getLocation().y;

            // Determine how much the mouse moved since the initial click
            int xMoved = (thisX + e.getX()) - (thisX + grabPoint.x);
            int yMoved = (thisY + e.getY()) - (thisY + grabPoint.y);

            // Move window to this position
            int X = thisX + xMoved;
            int Y = thisY + yMoved;
            frame.setLocation(X, Y);
        }
    });
    mainPanel.setLayout(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(10, 10, 10, 10);

    Font font16 = new Font("Arial", Font.BOLD, 16);
    Font font12 = new Font("Arial", Font.PLAIN, 12);
    Font font12b = new Font("Arial", Font.BOLD, 12);

    mainPanel.add(Box.createRigidArea(new Dimension(250, 50)));

    ImageIcon logo = new ImageIcon(new ImageIcon(XMageLauncher.class.getResource("/label-xmage.png")).getImage()
            .getScaledInstance(150, 75, Image.SCALE_SMOOTH));
    xmageLogo = new JLabel(logo);
    constraints.gridx = 3;
    constraints.gridy = 0;
    constraints.gridheight = 1;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.anchor = GridBagConstraints.EAST;
    mainPanel.add(xmageLogo, constraints);

    textArea = new JTextArea(5, 40);
    textArea.setEditable(false);
    textArea.setForeground(Color.WHITE);
    textArea.setBackground(Color.BLACK);
    DefaultCaret caret = (DefaultCaret) textArea.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    scrollPane = new JScrollPane(textArea);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    constraints.gridx = 2;
    constraints.gridy = 1;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    mainPanel.add(scrollPane, constraints);

    labelProgress = new JLabel(messages.getString("progress"));
    labelProgress.setFont(font12);
    labelProgress.setForeground(Color.WHITE);
    constraints.gridy = 2;
    constraints.weightx = 0.0;
    constraints.weighty = 0.0;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.WEST;
    mainPanel.add(labelProgress, constraints);

    progressBar = new JProgressBar(0, 100);
    constraints.gridx = 3;
    constraints.weightx = 1.0;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(progressBar, constraints);

    JPanel pnlButtons = new JPanel();
    pnlButtons.setLayout(new GridBagLayout());
    pnlButtons.setOpaque(false);
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.gridheight = GridBagConstraints.REMAINDER;
    constraints.fill = GridBagConstraints.BOTH;
    mainPanel.add(pnlButtons, constraints);

    btnLaunchClient = new JButton(messages.getString("launchClient"));
    btnLaunchClient.setToolTipText(messages.getString("launchClient.tooltip"));
    btnLaunchClient.setFont(font16);
    btnLaunchClient.setForeground(Color.GRAY);
    btnLaunchClient.setEnabled(false);
    btnLaunchClient.setPreferredSize(new Dimension(180, 60));
    btnLaunchClient.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleClient();
        }
    });

    constraints.gridx = GridBagConstraints.RELATIVE;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.fill = GridBagConstraints.BOTH;
    pnlButtons.add(btnLaunchClient, constraints);

    btnLaunchClientServer = new JButton(messages.getString("launchClientServer"));
    btnLaunchClientServer.setToolTipText(messages.getString("launchClientServer.tooltip"));
    btnLaunchClientServer.setFont(font12b);
    btnLaunchClientServer.setEnabled(false);
    btnLaunchClientServer.setForeground(Color.GRAY);
    btnLaunchClientServer.setPreferredSize(new Dimension(80, 40));
    btnLaunchClientServer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleServer();
            handleClient();
        }
    });

    constraints.fill = GridBagConstraints.HORIZONTAL;
    pnlButtons.add(btnLaunchClientServer, constraints);

    btnLaunchServer = new JButton(messages.getString("launchServer"));
    btnLaunchServer.setToolTipText(messages.getString("launchServer.tooltip"));
    btnLaunchServer.setFont(font12b);
    btnLaunchServer.setEnabled(false);
    btnLaunchServer.setForeground(Color.GRAY);
    btnLaunchServer.setPreferredSize(new Dimension(80, 40));
    btnLaunchServer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleServer();
        }
    });

    pnlButtons.add(btnLaunchServer, constraints);

    btnUpdate = new JButton(messages.getString("update.xmage"));
    btnUpdate.setToolTipText(messages.getString("update.xmage.tooltip"));
    btnUpdate.setFont(font12b);
    btnUpdate.setForeground(Color.BLACK);
    btnUpdate.setPreferredSize(new Dimension(80, 40));
    btnUpdate.setEnabled(true);

    btnUpdate.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleUpdate();
        }
    });

    pnlButtons.add(btnUpdate, constraints);

    btnCheck = new JButton(messages.getString("check.xmage"));
    btnCheck.setToolTipText(messages.getString("check.xmage.tooltip"));
    btnCheck.setFont(font12b);
    btnCheck.setForeground(Color.BLACK);
    btnCheck.setPreferredSize(new Dimension(80, 40));
    btnCheck.setEnabled(true);

    btnCheck.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleCheckUpdates();
        }
    });

    pnlButtons.add(btnCheck, constraints);

    frame.add(mainPanel);
    frame.pack();
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2);
}

From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PortHeatMapWorker.java

protected Void doInBackground() throws Exception {
    // this is a SwingWorker thread from its pool, give it a recognizable name
    Thread.currentThread().setName("PortHeatMapWorker");

    JFreeChart Chart = PlotPanel.getHeatChart();

    logger.info("Worker Building HeatMapPlot");
    MessageManager.getInstance()/*from   ww  w  .  j  a  v a 2 s .  co  m*/
            .postMessage(new SmtMessage(SmtMessageType.SMT_MSG_INFO, "Worker Building HeatMapPlot"));

    PortHeatMapDataSet pHeatMap = null;
    if (UseService) {
        SMT_UpdateService updateService = SMT_UpdateService.getInstance();
        History = updateService.getCollection();
        if (IncludedNodes != null)
            pHeatMap = new PortHeatMapDataSet(History, IncludedNodes);
        else
            pHeatMap = new PortHeatMapDataSet(History, IncludedDepths);
    } else if (History != null) {
        if (IncludedNodes != null)
            pHeatMap = new PortHeatMapDataSet(History, IncludedNodes);
        else
            pHeatMap = new PortHeatMapDataSet(History, IncludedDepths);
    } else {
        // FIXME - eliminate this, for test purposes only
        if (IncludedNodes != null)
            pHeatMap = new PortHeatMapDataSet("%h/scripts/OsmScripts/SmtScripts/sierra3H.his", IncludedNodes);
        else
            pHeatMap = new PortHeatMapDataSet("%h/scripts/OsmScripts/SmtScripts/sierra3H.his", IncludedDepths);
    }
    //    logger.fine("Finished creating dataset");
    //    logger.fine("Max X: " + pHeatMap.getMaximumXValue());
    //    logger.fine("Max Y: " + pHeatMap.getMaximumYValue());
    //    logger.fine("Max Z: " + pHeatMap.getMaximumZValue());
    //    
    // if any of these "maximum" values are illegal, stop here and return null
    if (!pHeatMap.isValid()) {
        logger.severe("Invalid HeatMap, check OMS Collection or Depth filter (empty or null)");
        MessageManager.getInstance().postMessage(new SmtMessage(SmtMessageType.SMT_MSG_SEVERE,
                "Invalid HeatMap, check OMS Collection or Depth filter (empty or null)"));
        PlotPanel.setHeatMapDataSet(null);
        return null;
    }

    PlotPanel.setHeatMapDataSet(pHeatMap);

    Range fixedXRange = new Range(0, pHeatMap.getMaximumXValue()); // time #
    Range fixedYRange = new Range(0, pHeatMap.getMaximumYValue()); // port #
    Range fixedZRange = new Range(0, pHeatMap.getMaximumZValue()); // % Util

    // there are 3 valid paint scales, 0, 1, & 2
    LookupPaintScale paintScale = PaintScaleFactory.getLookupPaintScale(1, 0, fixedZRange.getUpperBound(),
            fixedZRange.getUpperBound());
    ValueAxis paintAxis = PaintScaleFactory.getPaintScaleAxis(0, fixedZRange.getUpperBound(),
            PortHeatMapPlotPanel.UtilizationAxisLabel);

    BufferedImage image = HeatMapUtilities.createHeatMapImage(pHeatMap, paintScale);
    XYDataImageAnnotation ann = new XYDataImageAnnotation(image, fixedXRange.getLowerBound(),
            fixedYRange.getLowerBound(), fixedXRange.getUpperBound(), fixedYRange.getUpperBound(), true);
    XYPlot plot = (XYPlot) Chart.getPlot();
    plot.getRenderer().addAnnotation(ann, Layer.BACKGROUND);

    // finally, show the heatmap
    PaintScaleLegend psLegend = new PaintScaleLegend(paintScale, paintAxis);
    psLegend.setMargin(new RectangleInsets(3, 40, 3, 10));
    psLegend.setPosition(RectangleEdge.TOP); // location (within NORTH) of
                                             // heatmap legend
    psLegend.setAxisOffset(4.0);
    psLegend.setFrame(new BlockBorder(Color.GRAY));
    Chart.addSubtitle(psLegend);

    // fix the sliders ranges, and set them for the middle
    if ((pHeatMap != null) && (PlotPanel != null)) {
        PlotPanel.getTimeSlider().setMinimum((int) fixedXRange.getLowerBound());
        PlotPanel.getTimeSlider().setMaximum((int) fixedXRange.getUpperBound());
        PlotPanel.getTimeSlider().setValue((int) fixedXRange.getCentralValue());

        PlotPanel.getPortSlider().setMinimum((int) fixedYRange.getLowerBound());
        PlotPanel.getPortSlider().setMaximum((int) fixedYRange.getUpperBound());
        PlotPanel.getPortSlider().setValue((int) fixedYRange.getCentralValue());

        HeatMapDepthPanel hmdp = new HeatMapDepthPanel(pHeatMap);
        PlotPanel.replaceDepthPanel(hmdp);
    }
    return null;
}

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

/**
 * reset dataTable to default (demo data), and refesh chart
 *//* w w  w.  ja v  a  2 s .  com*/
public void resetExample() {
    isDemo = true;
    IntervalXYDataset dataset = createDataset(isDemo);

    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);
    setChart();

    hasExample = true;

    //convertor.dataset2Table(dataset);   
    convertor.data2Table(raw_x, y_freq, domainLabel, rangeLabel, data_count);
    JTable tempDataTable = convertor.getTable();
    resetTableRows(tempDataTable.getRowCount() + 1);

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    resetTableColumns(tempDataTable.getColumnCount());
    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }
    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    dataPanel.removeAll();
    JScrollPane tablePanel = new JScrollPane(dataTable);
    tablePanel.setRowHeaderView(headerTable);
    dataPanel.add(tablePanel);
    dataPanel.add(new JScrollPane(summaryPanel));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    setMapping();

    updateStatus(url);
}

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

public void resetExample() {
    //  System.out.println("resetExample get called");
    XYDataset dataset = createDataset1(true);

    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);
    setChart();//from   w w  w.  j  a  v  a  2  s.  c o  m

    hasExample = true;

    //System.out.println("independentVarLength="+independentVarLength);
    //  System.out.println("raw+x="+raw_x[0]);
    int colCount = dataset.getSeriesCount();
    String[] columnName = new String[colCount];
    for (int i = 0; i < colCount; i++)
        columnName[i] = dataset.getSeriesKey(i).toString();

    convertor.multiY2Table(raw_x2, row_count, colCount, columnName);
    //convertor.dataset2Table(dataset);            
    JTable tempDataTable = convertor.getTable();

    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(tempDataTable.getColumnCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
            //System.out.println("setTabledata "+tempDataTable.getValueAt(i,j));
        }

    dataPanel.removeAll();
    dataPanel.add(new JScrollPane(dataTable));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();

    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // do the mapping
    for (int i = 0; i < colCount; i++)
        addButtonIndependent();//Y

    rangeLabel = "";
    for (int j = 0; j < colCount; j++)
        rangeLabel += columnName[j] + "/";
    rangeLabel = rangeLabel.substring(0, rangeLabel.length() - 1);

    updateStatus(url);
}

From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java

/**
 * Creates the center panel./*w  w  w.  ja  v  a2  s  .c o  m*/
 *
 * @return the created center panel
 */
private Container createCenter() {
    JPanel centerPanel = new JPanel(new GridBagLayout());

    centerPanel.setBackground(Color.WHITE);
    centerPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3));

    GridBagConstraints constraints = new GridBagConstraints();

    initSmsLabel(centerPanel);
    initTextArea(centerPanel);

    smsCharCountLabel = new JLabel(String.valueOf(smsCharCount));
    smsCharCountLabel.setForeground(Color.GRAY);
    smsCharCountLabel.setVisible(false);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 0;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    constraints.insets = new Insets(0, 2, 0, 2);
    constraints.gridheight = 1;
    constraints.gridwidth = 1;
    centerPanel.add(smsCharCountLabel, constraints);

    smsNumberLabel = new JLabel(String.valueOf(smsNumberCount)) {
        @Override
        public void paintComponent(Graphics g) {
            AntialiasingManager.activateAntialiasing(g);
            g.setColor(getBackground());
            g.fillOval(0, 0, getWidth(), getHeight());

            super.paintComponent(g);
        }
    };
    smsNumberLabel.setHorizontalAlignment(JLabel.CENTER);
    smsNumberLabel.setPreferredSize(new Dimension(18, 18));
    smsNumberLabel.setMinimumSize(new Dimension(18, 18));
    smsNumberLabel.setForeground(Color.WHITE);
    smsNumberLabel.setBackground(Color.GRAY);
    smsNumberLabel.setVisible(false);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 0;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    constraints.insets = new Insets(0, 2, 0, 2);
    constraints.gridheight = 1;
    constraints.gridwidth = 1;
    centerPanel.add(smsNumberLabel, constraints);

    return centerPanel;
}

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

public void resetExample() {

    BoxAndWhiskerCategoryDataset dataset = createDataset(true);

    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);
    setChart();//from  w ww.j av  a  2  s  .co  m

    hasExample = true;

    convertor.Y2Table(raw_y, data_count);
    JTable tempDataTable = convertor.getTable();
    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(tempDataTable.getColumnCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }
    dataPanel.removeAll();
    dataPanel.add(new JScrollPane(dataTable));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // do the mapping
    addButtonIndependent();//Y
    updateStatus(url);
}