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:com.jakemadethis.graphite.visualization.renderers.HyperedgeLabelRenderer.java

public void labelEdge(RenderContext<V, E> rc, Layout<V, E> layout, E e, String label) {
    if (label == null || label.length() == 0)
        return;//from w  w  w .  j  a v  a 2s.  c o  m

    Graph<V, E> g = layout.getGraph();

    EdgeLayout<E> edgeLayout = EdgeLayout$.MODULE$.apply(layout);

    Hypergraph<V, E> hg = g;

    if (!drawPredicate.evaluate(Context.<Hypergraph<V, E>, E>getInstance(hg, e)))
        return;

    if (!rc.getEdgeIncludePredicate().evaluate(Context.<Graph<V, E>, E>getInstance(g, e)))
        return;

    Point2D edgePos = edgeLayout.getEdgeLocation(e);
    edgePos = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, edgePos);

    GraphicsDecorator gd = rc.getGraphicsContext();

    Component component = prepareRenderer(rc, rc.getEdgeLabelRenderer(), label,
            rc.getPickedEdgeState().isPicked(e), e);

    Dimension d = component.getPreferredSize();

    AffineTransform old = gd.getTransform();
    AffineTransform xform = new AffineTransform(old);
    xform.translate(edgePos.getX(), edgePos.getY());

    gd.setTransform(xform);
    gd.setStroke(new BasicStroke(1));
    Rectangle rect = new Rectangle(-10, -10, 20, 20);
    gd.setPaint(Color.WHITE);
    gd.fill(rect);
    gd.setPaint(Color.GRAY);
    gd.draw(rect);

    xform.translate(-d.width / 2, -d.height / 2);
    gd.setTransform(xform);

    gd.draw(component, rc.getRendererPane(), 0, 0, d.width, d.height, true);

    gd.setTransform(old);
}

From source file:inflor.core.utils.PlotUtils.java

public static LookupPaintScale createPaintScale(double zMax, ColorSchemes colorScheme) {
    PaintModel pm = new PaintModel(colorScheme, zMax);
    Paint[] paints = pm.getPaints();
    double[] levels = pm.getLevels();
    LookupPaintScale paintScale = new LookupPaintScale(0, pm.getThreshold(), Color.GRAY);
    for (int i = 0; i < levels.length; i++) {
        paintScale.add(levels[i], paints[i]);
    }/*from www .  j a v  a2  s.co  m*/
    return paintScale;
}

From source file:de.wusel.partyplayer.gui.LockingStatusbar.java

public LockingStatusbar(Application application, final JFrame mainFrame, final Settings settings) {
    this.application = application;
    this.settings = settings;
    this.application.getContext().getTaskMonitor().addPropertyChangeListener(listener);
    statusLabel = new JLabel("Ready");
    fileReaderProgressBar = new JProgressBar(0, 100);

    pinCodeInputField = new JPasswordField();
    PromptSupport.setPrompt("pin-code", pinCodeInputField);
    PromptSupport.setForeground(Color.GRAY, pinCodeInputField);

    pinCodeInputField.addMouseListener(new MouseAdapter() {

        @Override//from   ww  w  .j av a 2  s  .  c  o m
        public void mouseClicked(MouseEvent e) {
            if (!pinCodeInputField.isEnabled()) {
                ChangePasswordDialog dialog = new ChangePasswordDialog(mainFrame, settings);
                dialog.setVisible(true);
                if (dialog.getStatus() == DialogStatus.CONFIRMED) {
                    settings.setNewPassword(dialog.getPassDigest());
                    settings.backup(PathUtil.getSettingsFile());
                }
            }
        }
    });
    pinCodeInputField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            boolean unlocked = settings
                    .isPasswordValid(DigestUtils.md5Hex(new String(pinCodeInputField.getPassword())));
            if (unlocked) {
                pinCodeInputField.transferFocus();
                unlock();
            }
            pinCodeInputField.setText(null);
        }
    });

    lockButton = new JToggleButton();
    lockButton.setIcon(getIcon("lock"));
    lockButton.setSelectedIcon(getIcon("lock_open"));
    lockButton.setEnabled(false);
    lockButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            lock();
        }
    });

    this.settingsButton = new JButton(getIcon("cog_edit"));
    this.settingsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showSettings();
        }
    });
    add(statusLabel, new JXStatusBar.Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL));
    add(fileReaderProgressBar, new JXStatusBar.Constraint(200));
    add(pinCodeInputField, new JXStatusBar.Constraint(100));
    add(lockButton, new JXStatusBar.Constraint());
    add(settingsButton, new JXStatusBar.Constraint());
    this.mainFrame = mainFrame;
}

From source file:de.fhg.igd.iva.explorer.main.JStatBar.java

private void drawButton(Graphics2D g, int dx, int height) {
    int barWidth = 4;
    g.setColor(Color.GRAY);
    g.fillRect(insetX + dx - barWidth / 2, 0, barWidth, height);
    g.draw3DRect(insetX + dx - barWidth / 2, 0, barWidth, height, true);
}

From source file:com.igormaznitsa.jhexed.swing.editor.ui.Utils.java

public static Color getPanelBackgroundColor() {
    final Color panelBack = UIManager.getColor("Panel.background");
    return panelBack == null ? Color.GRAY : panelBack;
}

From source file:net.sourceforge.processdash.ui.lib.chart.StandardDiscItemRenderer.java

public StandardDiscItemRenderer() {
    this.discPaintMap = new PaintMap();
    this.baseDiscPaint = Color.gray;
    this.labelPaintMap = new PaintMap();
    this.labelPadding = 5;
    this.minLabelChars = 4;
    this.outlinePaintMap = new PaintMap();
    this.baseOutlinePaint = null;
    this.outlineStrokeMap = new StrokeMap();
    this.baseOutlineStroke = Plot.DEFAULT_OUTLINE_STROKE;
}

From source file:Main.java

@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle r) {
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Color color = null;//from   w  ww  .  j a  v a  2  s .  c om
    JScrollBar sb = (JScrollBar) c;
    if (!sb.isEnabled() || r.width > r.height) {
        return;
    } else if (isDragging) {
        color = Color.DARK_GRAY;
    } else if (isThumbRollover()) {
        color = Color.LIGHT_GRAY;
    } else {
        color = Color.GRAY;
    }
    g2.setPaint(color);
    g2.fillRoundRect(r.x, r.y, r.width, r.height, 10, 10);
    g2.setPaint(Color.WHITE);
    g2.drawRoundRect(r.x, r.y, r.width, r.height, 10, 10);
    g2.dispose();
}

From source file:org.eevolution.form.CRPDetail.java

/**
 * Create Chart based on UOM//from   w  ww. j  a v a 2  s  .  c  om
 * 
 * @param dataset
 * @param title
 * @param uom
 * @return JFreeChart Chart based On UOM
 */
public JFreeChart createChart(CategoryDataset dataset, String title, MUOM uom) {

    JFreeChart chart = ChartFactory.createBarChart3D(title, Msg.translate(Env.getCtx(), "Day"), // X-Axis label
            Msg.translate(Env.getCtx(), (uom == null) ? "" : uom.getName()), // Y-Axis
            // label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    chart.setBackgroundPaint(Color.WHITE);
    chart.setAntiAlias(true);
    chart.setBorderVisible(true);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.GRAY);

    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.GRAY);

    BarRenderer3D barrenderer = (BarRenderer3D) plot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    barrenderer.setBaseItemLabelGenerator(new LabelGenerator());
    barrenderer.setBaseItemLabelsVisible(true);
    barrenderer.setSeriesPaint(0, new Color(10, 80, 150, 128));
    barrenderer.setSeriesPaint(1, new Color(180, 60, 50, 128));

    ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
            TextAnchor.TOP_CENTER);
    barrenderer.setPositiveItemLabelPosition(itemlabelposition);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    return chart;
}

From source file:org.gvsig.gui.beans.graphic.GraphicChartPanel.java

/**
 * Creates a chart./*from  w w  w .j  a  va  2  s.  c om*/
 * @param dataset the dataset.
 * @return A chart.
 */
private void createChart() {
    chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, false, true,
            true);

    // Definir la lista de colores
    XYPlot plot = chart.getXYPlot();
    plot.getRenderer().setSeriesPaint(0, Color.red);
    plot.getRenderer().setSeriesPaint(1, Color.green);
    plot.getRenderer().setSeriesPaint(2, Color.blue);
    plot.getRenderer().setSeriesPaint(3, Color.cyan);
    plot.getRenderer().setSeriesPaint(4, Color.black);
    plot.getRenderer().setSeriesPaint(5, Color.darkGray);
    plot.getRenderer().setSeriesPaint(6, Color.gray);
    plot.getRenderer().setSeriesPaint(7, Color.magenta);
    plot.getRenderer().setSeriesPaint(8, Color.yellow);
    plot.getRenderer().setSeriesPaint(9, Color.orange);

    Image img = new ImageIcon(getClass().getResource("images/splash.png")).getImage();
    plot.setBackgroundPaint(null);
    plot.setBackgroundImageAlpha(0.18f);
    plot.setBackgroundImage(img);
}

From source file:me.mayo.telnetkek.MainPanel.java

private void flushTelnetErrorQueue() {
    TelnetMessage queuedMessage;//from w ww.  ja  va2s .c o m
    while ((queuedMessage = telnetErrorQueue.poll()) != null) {
        queuedMessage.setColor(Color.GRAY);
        writeToConsoleImmediately(queuedMessage, true);
    }
}