20 package net.sf.gridarta.gui.utils;
22 import java.awt.BorderLayout;
23 import java.awt.Color;
24 import java.awt.Dimension;
25 import java.awt.Window;
26 import java.lang.reflect.InvocationTargetException;
27 import javax.swing.AbstractButton;
28 import javax.swing.JButton;
29 import javax.swing.JFrame;
30 import javax.swing.JPanel;
31 import javax.swing.JSplitPane;
32 import javax.swing.SwingUtilities;
33 import org.jetbrains.annotations.NotNull;
60 public static void main(@NotNull
final String @NotNull [] args)
throws InterruptedException, InvocationTargetException {
61 SwingUtilities.invokeAndWait(() -> {
66 final GSplitPane splitPane1 =
new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, green, blue,
"TEST_GREEN_BLUE", 70);
67 splitPane1.setResizeWeight(0.5);
68 final GSplitPane splitPane2 =
new GSplitPane(JSplitPane.VERTICAL_SPLIT, splitPane1, yellow,
"TEST_GREEN_BLUE_YELLOW", 40);
69 final GSplitPane splitPane3 =
new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, orange, splitPane2,
"TEST_ORANGE_GREEN_BLUE_YELLOW", 30);
70 final AbstractButton button =
new JButton(
"save divider locations and quit");
71 final Window frame =
new JFrame();
72 button.addActionListener(e -> {
76 frame.setVisible(
false);
79 frame.setLayout(
new BorderLayout());
80 frame.add(button, BorderLayout.SOUTH);
81 frame.add(splitPane3);
83 frame.setSize(
new Dimension(800, 600));
84 frame.setLocationRelativeTo(
null);
85 frame.setVisible(
true);
96 private static JPanel
newPanel(
final int width,
final int height, @NotNull
final Color color) {
97 final JPanel panel =
new JPanel();
98 panel.setMinimumSize(
new Dimension(width, height));
99 panel.setOpaque(
true);
100 panel.setBackground(color);