Skip to content

Instantly share code, notes, and snippets.

View DrDaleks's full-sized avatar

DrDaleks DrDaleks

  • Earth
View GitHub Profile
@fmarot
fmarot / SingleComponentAspectRatioKeeperLayout.java
Last active February 3, 2024 16:09
A Java Swing Layout Manager that keep the aspect ratio of the component inside the container while enlarging/shrinling it. Contains a main() method with a JFrame to see by yourself. I crerated it because was unable to find simple exemples on the net.
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import javax.swing.JFrame;
import javax.swing.JPanel;