JDK 11 java.desktop.jmod - Desktop Module

JDK 11 java.desktop.jmod is the JMOD file for JDK 11 Desktop module.

JDK 11 Desktop module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\java.desktop.jmod.

JDK 11 Desktop module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.

JDK 11 Desktop module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\java.desktop.

You can click and view the content of each source code file in the list below.

✍: FYIcenter

com/sun/beans/editors/ColorEditor.java

/*
 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package com.sun.beans.editors;

import java.awt.*;
import java.beans.*;

public class ColorEditor extends Panel implements PropertyEditor {
    private static final long serialVersionUID = 1781257185164716054L;

    @SuppressWarnings("deprecation")
    public ColorEditor() {
        setLayout(null);

        ourWidth = hPad;

        // Create a sample color block bordered in black
        Panel p = new Panel();
        p.setLayout(null);
        p.setBackground(Color.black);
        sample = new Canvas();
        p.add(sample);
        sample.reshape(2, 2, sampleWidth, sampleHeight);
        add(p);
        p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4);
        ourWidth += sampleWidth + 4 + hPad;

        text = new TextField("", 14);
        add(text);
        text.reshape(ourWidth,0,100,30);
        ourWidth += 100 + hPad;

        choser = new Choice();
        int active = 0;
        for (int i = 0; i < colorNames.length; i++) {
            choser.addItem(colorNames[i]);
        }
        add(choser);
        choser.reshape(ourWidth,0,100,30);
        ourWidth += 100 + hPad;

        resize(ourWidth,40);
    }

    public void setValue(Object o) {
        Color c = (Color)o;
        changeColor(c);
    }

    @SuppressWarnings("deprecation")
    public Dimension preferredSize() {
        return new Dimension(ourWidth, 40);
    }

    @SuppressWarnings("deprecation")
    public boolean keyUp(Event e, int key) {
        if (e.target == text) {
            try {
                setAsText(text.getText());
            } catch (IllegalArgumentException ex) {
                // Quietly ignore.
            }
        }
        return (false);
    }

    public void setAsText(String s) throws java.lang.IllegalArgumentException {
        if (s == null) {
            changeColor(null);
            return;
        }
        int c1 = s.indexOf(',');
        int c2 = s.indexOf(',', c1+1);
        if (c1 < 0 || c2 < 0) {
            // Invalid string.
            throw new IllegalArgumentException(s);
        }
        try {
            int r = Integer.parseInt(s.substring(0,c1));
            int g = Integer.parseInt(s.substring(c1+1, c2));
            int b = Integer.parseInt(s.substring(c2+1));
            Color c = new Color(r,g,b);
            changeColor(c);
        } catch (Exception ex) {
            throw new IllegalArgumentException(s);
        }

    }

    @SuppressWarnings("deprecation")
    public boolean action(Event e, Object arg) {
        if (e.target == choser) {
            changeColor(colors[choser.getSelectedIndex()]);
        }
        return false;
    }

    public String getJavaInitializationString() {
        return (this.color != null)
                ? "new java.awt.Color(" + this.color.getRGB() + ",true)"
                : "null";
    }


    private void changeColor(Color c) {

        if (c == null) {
            this.color = null;
            this.text.setText("");
            return;
        }

        color = c;

        text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue());

        int active = 0;
        for (int i = 0; i < colorNames.length; i++) {
            if (color.equals(colors[i])) {
                active = i;
            }
        }
        choser.select(active);

        sample.setBackground(color);
        sample.repaint();

        support.firePropertyChange("", null, null);
    }

    public Object getValue() {
        return color;
    }

    public boolean isPaintable() {
        return true;
    }

    public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
        Color oldColor = gfx.getColor();
        gfx.setColor(Color.black);
        gfx.drawRect(box.x, box.y, box.width-3, box.height-3);
        gfx.setColor(color);
        gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4);
        gfx.setColor(oldColor);
    }

    public String getAsText() {
        return (this.color != null)
                ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue()
                : null;
    }

    public String[] getTags() {
        return null;
    }

    public java.awt.Component getCustomEditor() {
        return this;
    }

    public boolean supportsCustomEditor() {
        return true;
    }

    public void addPropertyChangeListener(PropertyChangeListener l) {
        support.addPropertyChangeListener(l);
    }

    public void removePropertyChangeListener(PropertyChangeListener l) {
        support.removePropertyChangeListener(l);
    }


    private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray",
                        "black", "red", "pink", "orange",
                        "yellow", "green", "magenta", "cyan",
                        "blue"};
    private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray,
                        Color.black, Color.red, Color.pink, Color.orange,
                        Color.yellow, Color.green, Color.magenta, Color.cyan,
                        Color.blue};

    private Canvas sample;
    private int sampleHeight = 20;
    private int sampleWidth = 40;
    private int hPad = 5;
    private int ourWidth;

    private Color color;
    private TextField text;
    private Choice choser;

    private PropertyChangeSupport support = new PropertyChangeSupport(this);
}

com/sun/beans/editors/ColorEditor.java

 

Or download all of them as a single archive file:

File name: java.desktop-11.0.1-src.zip
File size: 7974380 bytes
Release date: 2018-11-04
Download 

 

JDK 11 java.instrument.jmod - Instrument Module

JDK 11 java.datatransfer.jmod - Data Transfer Module

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2022-08-06, 196185👍, 5💬