Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JRE 8 rt.jar - javax.* Package Source Code
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries.
JRE (Java Runtime) 8 is the runtime environment included in JDK 8.
JRE 8 rt.jar libraries are divided into 6 packages:
com.* - Internal Oracle and Sun Microsystems libraries java.* - Standard Java API libraries. javax.* - Extended Java API libraries. jdk.* - JDK supporting libraries. org.* - Third party libraries. sun.* - Old libraries developed by Sun Microsystems.
JAR File Information:
Directory of C:\fyicenter\jdk-1.8.0_191\jre\lib
63,596,151 rt.jar
Here is the list of Java classes of the javax.* package in JRE 1.8.0_191 rt.jar. Java source codes are also provided.
✍: FYIcenter
⏎ javax/swing/colorchooser/DefaultPreviewPanel.java
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.swing.colorchooser;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
import sun.swing.SwingUtilities2;
/**
* The standard preview panel for the color chooser.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Steve Wilson
* @see JColorChooser
*/
class DefaultPreviewPanel extends JPanel {
private int squareSize = 25;
private int squareGap = 5;
private int innerGap = 5;
private int textGap = 5;
private Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
private String sampleText;
private int swatchWidth = 50;
private Color oldColor = null;
private JColorChooser getColorChooser() {
return (JColorChooser)SwingUtilities.getAncestorOfClass(
JColorChooser.class, this);
}
public Dimension getPreferredSize() {
JComponent host = getColorChooser();
if (host == null) {
host = this;
}
FontMetrics fm = host.getFontMetrics(getFont());
int ascent = fm.getAscent();
int height = fm.getHeight();
int width = SwingUtilities2.stringWidth(host, fm, getSampleText());
int y = height*3 + textGap*3;
int x = squareSize * 3 + squareGap*2 + swatchWidth + width + textGap*3;
return new Dimension( x,y );
}
public void paintComponent(Graphics g) {
if (oldColor == null)
oldColor = getForeground();
g.setColor(getBackground());
g.fillRect(0,0,getWidth(),getHeight());
if (this.getComponentOrientation().isLeftToRight()) {
int squareWidth = paintSquares(g, 0);
int textWidth = paintText(g, squareWidth);
paintSwatch(g, squareWidth + textWidth);
} else {
int swatchWidth = paintSwatch(g, 0);
int textWidth = paintText(g, swatchWidth);
paintSquares(g , swatchWidth + textWidth);
}
}
private int paintSwatch(Graphics g, int offsetX) {
int swatchX = offsetX;
g.setColor(oldColor);
g.fillRect(swatchX, 0, swatchWidth, (squareSize) + (squareGap/2));
g.setColor(getForeground());
g.fillRect(swatchX, (squareSize) + (squareGap/2), swatchWidth, (squareSize) + (squareGap/2) );
return (swatchX+swatchWidth);
}
private int paintText(Graphics g, int offsetX) {
g.setFont(getFont());
JComponent host = getColorChooser();
if (host == null) {
host = this;
}
FontMetrics fm = SwingUtilities2.getFontMetrics(host, g);
int ascent = fm.getAscent();
int height = fm.getHeight();
int width = SwingUtilities2.stringWidth(host, fm, getSampleText());
int textXOffset = offsetX + textGap;
Color color = getForeground();
g.setColor(color);
SwingUtilities2.drawString(host, g, getSampleText(),textXOffset+(textGap/2),
ascent+2);
g.fillRect(textXOffset,
( height) + textGap,
width + (textGap),
height +2);
g.setColor(Color.black);
SwingUtilities2.drawString(host, g, getSampleText(),
textXOffset+(textGap/2),
height+ascent+textGap+2);
g.setColor(Color.white);
g.fillRect(textXOffset,
( height + textGap) * 2,
width + (textGap),
height +2);
g.setColor(color);
SwingUtilities2.drawString(host, g, getSampleText(),
textXOffset+(textGap/2),
((height+textGap) * 2)+ascent+2);
return width + textGap*3;
}
private int paintSquares(Graphics g, int offsetX) {
int squareXOffset = offsetX;
Color color = getForeground();
g.setColor(Color.white);
g.fillRect(squareXOffset,0,squareSize,squareSize);
g.setColor(color);
g.fillRect(squareXOffset+innerGap,
innerGap,
squareSize - (innerGap*2),
squareSize - (innerGap*2));
g.setColor(Color.white);
g.fillRect(squareXOffset+innerGap*2,
innerGap*2,
squareSize - (innerGap*4),
squareSize - (innerGap*4));
g.setColor(color);
g.fillRect(squareXOffset,squareSize+squareGap,squareSize,squareSize);
g.translate(squareSize+squareGap, 0);
g.setColor(Color.black);
g.fillRect(squareXOffset,0,squareSize,squareSize);
g.setColor(color);
g.fillRect(squareXOffset+innerGap,
innerGap,
squareSize - (innerGap*2),
squareSize - (innerGap*2));
g.setColor(Color.white);
g.fillRect(squareXOffset+innerGap*2,
innerGap*2,
squareSize - (innerGap*4),
squareSize - (innerGap*4));
g.translate(-(squareSize+squareGap), 0);
g.translate(squareSize+squareGap, squareSize+squareGap);
g.setColor(Color.white);
g.fillRect(squareXOffset,0,squareSize,squareSize);
g.setColor(color);
g.fillRect(squareXOffset+innerGap,
innerGap,
squareSize - (innerGap*2),
squareSize - (innerGap*2));
g.translate(-(squareSize+squareGap), -(squareSize+squareGap));
g.translate((squareSize+squareGap)*2, 0);
g.setColor(Color.white);
g.fillRect(squareXOffset,0,squareSize,squareSize);
g.setColor(color);
g.fillRect(squareXOffset+innerGap,
innerGap,
squareSize - (innerGap*2),
squareSize - (innerGap*2));
g.setColor(Color.black);
g.fillRect(squareXOffset+innerGap*2,
innerGap*2,
squareSize - (innerGap*4),
squareSize - (innerGap*4));
g.translate(-((squareSize+squareGap)*2), 0);
g.translate((squareSize+squareGap)*2, (squareSize+squareGap));
g.setColor(Color.black);
g.fillRect(squareXOffset,0,squareSize,squareSize);
g.setColor(color);
g.fillRect(squareXOffset+innerGap,
innerGap,
squareSize - (innerGap*2),
squareSize - (innerGap*2));
g.translate(-((squareSize+squareGap)*2), -(squareSize+squareGap));
return (squareSize*3+squareGap*2);
}
private String getSampleText() {
if (this.sampleText == null) {
this.sampleText = UIManager.getString("ColorChooser.sampleText", getLocale());
}
return this.sampleText;
}
}
⏎ javax/swing/colorchooser/DefaultPreviewPanel.java
Or download all of them as a single archive file:
File name: jre-rt-javax-1.8.0_191-src.zip File size: 5381005 bytes Release date: 2018-10-28 Download
⇒ JRE 8 rt.jar - org.* Package Source Code
2024-07-16, ≈574🔥, 7💬
Popular Posts:
What is the jaxp\TypeInfoWriter.java provided in the Apache Xerces package? I have Apache Xerces 2.1...
JDK 11 jdk.crypto.cryptoki.jmod is the JMOD file for JDK 11 Crypto Cryptoki module. JDK 11 Crypto KI...
Apache Log4j IOStreams is a Log4j API extension that provides numerous classes from java.io that can...
How to download and install ojdbc14.jar for Oracle 10g R2? ojdbc14.jar for Oracle 10g R2 is a Java 1...
How to download and install javamail-1_2.zip? The JavaMail API is a set of abstract APIs that model ...