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/SmartGridLayout.java

/*
 * Copyright (c) 1998, 2001, 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 java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.text.*;
import java.io.Serializable;


/**
  * A better GridLayout class
  *
  * @author Steve Wilson
  */
class SmartGridLayout implements LayoutManager, Serializable {

  int rows = 2;
  int columns = 2;
  int xGap = 2;
  int yGap = 2;
  int componentCount = 0;
  Component[][] layoutGrid;


  public SmartGridLayout(int numColumns, int numRows) {
    rows = numRows;
    columns = numColumns;
    layoutGrid = new Component[numColumns][numRows];

  }


  public void layoutContainer(Container c) {

    buildLayoutGrid(c);

    int[] rowHeights = new int[rows];
    int[] columnWidths = new int[columns];

    for (int row = 0; row < rows; row++) {
        rowHeights[row] = computeRowHeight(row);
    }

    for (int column = 0; column < columns; column++) {
        columnWidths[column] = computeColumnWidth(column);
    }


    Insets insets = c.getInsets();

    if (c.getComponentOrientation().isLeftToRight()) {
        int horizLoc = insets.left;
        for (int column = 0; column < columns; column++) {
          int vertLoc = insets.top;

          for (int row = 0; row < rows; row++) {
            Component current = layoutGrid[column][row];

            current.setBounds(horizLoc, vertLoc, columnWidths[column], rowHeights[row]);
            //  System.out.println(current.getBounds());
            vertLoc += (rowHeights[row] + yGap);
          }
          horizLoc += (columnWidths[column] + xGap );
        }
    } else {
        int horizLoc = c.getWidth() - insets.right;
        for (int column = 0; column < columns; column++) {
          int vertLoc = insets.top;
          horizLoc -= columnWidths[column];

          for (int row = 0; row < rows; row++) {
            Component current = layoutGrid[column][row];

            current.setBounds(horizLoc, vertLoc, columnWidths[column], rowHeights[row]);
            //  System.out.println(current.getBounds());
            vertLoc += (rowHeights[row] + yGap);
          }
          horizLoc -= xGap;
        }
    }



  }

  public Dimension minimumLayoutSize(Container c) {

    buildLayoutGrid(c);
    Insets insets = c.getInsets();



    int height = 0;
    int width = 0;

    for (int row = 0; row < rows; row++) {
        height += computeRowHeight(row);
    }

    for (int column = 0; column < columns; column++) {
        width += computeColumnWidth(column);
    }

    height += (yGap * (rows - 1)) + insets.top + insets.bottom;
    width += (xGap * (columns - 1)) + insets.right + insets.left;

    return new Dimension(width, height);


  }

  public Dimension preferredLayoutSize(Container c) {
      return minimumLayoutSize(c);
  }


  public void addLayoutComponent(String s, Component c) {}

  public void removeLayoutComponent(Component c) {}


  private void buildLayoutGrid(Container c) {

      Component[] children = c.getComponents();

      for (int componentCount = 0; componentCount < children.length; componentCount++) {
        //      System.out.println("Children: " +componentCount);
        int row = 0;
        int column = 0;

        if (componentCount != 0) {
          column = componentCount % columns;
          row = (componentCount - column) / columns;
        }

        //      System.out.println("inserting into: "+ column +  " " + row);

        layoutGrid[column][row] = children[componentCount];
      }
  }

  private int computeColumnWidth(int columnNum) {
    int maxWidth = 1;
    for (int row = 0; row < rows; row++) {
      int width = layoutGrid[columnNum][row].getPreferredSize().width;
      if (width > maxWidth) {
        maxWidth = width;
      }
    }
    return maxWidth;
  }

  private int computeRowHeight(int rowNum) {
    int maxHeight = 1;
    for (int column = 0; column < columns; column++) {
      int height = layoutGrid[column][rowNum].getPreferredSize().height;
      if (height > maxHeight) {
        maxHeight = height;
      }
    }
    return maxHeight;
  }

}

javax/swing/colorchooser/SmartGridLayout.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

JRE 8 rt.jar - java.* Package Source Code

Download and Use JDK 8

⇑⇑ FAQ for JDK (Java Development Kit)

2024-07-16, ≈490🔥, 7💬