Added more default elements and changed colours
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
import org.openautonomousconnection.oacswing.component.design.Design;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -46,7 +46,7 @@ public class OACButton extends JButton implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -53,7 +53,7 @@ public class OACCheckBox extends JCheckBox implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -49,7 +49,7 @@ public class OACCheckBoxMenuItem extends JCheckBoxMenuItem implements OACCompone
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -21,7 +21,7 @@ public class OACColorChooser extends JColorChooser implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -38,7 +38,7 @@ public class OACComboBox<E> extends JComboBox<E> implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import jdk.jshell.spi.ExecutionControl;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.openautonomousconnection.oacswing.component.design.Design;
|
||||
import org.openautonomousconnection.oacswing.component.design.DesignManager;
|
||||
|
||||
@@ -13,6 +12,7 @@ import java.util.OptionalInt;
|
||||
public interface OACComponent {
|
||||
default void initDesign() {
|
||||
DesignManager.apply(this);
|
||||
|
||||
// Design design = DesignManager.getGlobalDesign();
|
||||
//
|
||||
// this.setBackground(design.getElements().get(this.getClass()).getColor());
|
||||
@@ -25,7 +25,7 @@ public interface OACComponent {
|
||||
component.initDesign();
|
||||
}
|
||||
|
||||
default @Nullable Component add(Optional<String> name, Component comp, OptionalInt index, Optional<?> constrains) throws ExecutionControl.NotImplementedException {
|
||||
default Component add(Optional<String> name, Component comp, OptionalInt index, Optional<?> constrains) throws ExecutionControl.NotImplementedException {
|
||||
JComponent superclass = this.getSuperclass();
|
||||
|
||||
if(comp instanceof OACComponent component)
|
||||
|
||||
@@ -1,32 +1,226 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import org.openautonomousconnection.oacswing.component.design.DesignManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
/**
|
||||
* OAC Swing frame with a custom title bar.
|
||||
*/
|
||||
public class OACFrame extends JFrame {
|
||||
private static final int RESIZE_MARGIN = 8;
|
||||
|
||||
private Point dragStart;
|
||||
private Rectangle startBounds;
|
||||
private int resizeCursor = Cursor.DEFAULT_CURSOR;
|
||||
@Getter
|
||||
private OACTitleBar titleBar;
|
||||
|
||||
/**
|
||||
* Creates a new frame.
|
||||
*/
|
||||
public OACFrame() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
this.init();
|
||||
/**
|
||||
* Creates a new frame with the given graphics configuration.
|
||||
*
|
||||
* @param gc graphics configuration
|
||||
*/
|
||||
public OACFrame(GraphicsConfiguration gc) {
|
||||
super(gc);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new frame with the given title.
|
||||
*
|
||||
* @param title frame title
|
||||
*/
|
||||
public OACFrame(String title) {
|
||||
super(title);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new frame with the given title and graphics configuration.
|
||||
*
|
||||
* @param title frame title
|
||||
* @param gc graphics configuration
|
||||
*/
|
||||
public OACFrame(String title, GraphicsConfiguration gc) {
|
||||
super(title, gc);
|
||||
init();
|
||||
}
|
||||
private static final int TITLE_BAR_HEIGHT = 42;
|
||||
private void init() {
|
||||
super.setLayeredPane(new OACLayeredPane());
|
||||
|
||||
setUndecorated(true);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setMinimumSize(new Dimension(900, 600));
|
||||
setLocationByPlatform(true);
|
||||
|
||||
OACPanel content = new OACPanel(new BorderLayout());
|
||||
setContentPane(content);
|
||||
|
||||
titleBar = new OACTitleBar(this);
|
||||
|
||||
OACPanel titleRoot = new OACPanel(new BorderLayout());
|
||||
titleRoot.setOpaque(false);
|
||||
titleRoot.add(titleBar, BorderLayout.CENTER);
|
||||
|
||||
OACLayeredPane layeredPane = getLayeredPane();
|
||||
layeredPane.add(titleRoot, OACLayeredPane.DRAG_LAYER);
|
||||
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
titleRoot.setBounds(0, 0, getWidth(), TITLE_BAR_HEIGHT);
|
||||
|
||||
setShape(new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), 30, 30));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
titleRoot.setBounds(0, 0, getWidth(), TITLE_BAR_HEIGHT);
|
||||
|
||||
setShape(new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), 30, 30));
|
||||
}
|
||||
});
|
||||
|
||||
setSize(900, 600);
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
titleRoot.setBounds(0, 0, getWidth(), TITLE_BAR_HEIGHT);
|
||||
setShape(new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), 30, 30));
|
||||
});
|
||||
|
||||
MouseAdapter adapter = new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
resizeCursor = getResizeCursor(e);
|
||||
|
||||
setCursor(Cursor.getPredefinedCursor(resizeCursor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragStart = e.getLocationOnScreen();
|
||||
startBounds = getBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (resizeCursor == Cursor.DEFAULT_CURSOR) return;
|
||||
|
||||
Point dragNow = e.getLocationOnScreen();
|
||||
int dx = dragNow.x - dragStart.x;
|
||||
int dy = dragNow.y - dragStart.y;
|
||||
|
||||
Rectangle newBounds = new Rectangle(startBounds);
|
||||
|
||||
switch (resizeCursor) {
|
||||
case Cursor.E_RESIZE_CURSOR -> newBounds.width += dx;
|
||||
case Cursor.S_RESIZE_CURSOR -> newBounds.height += dy;
|
||||
case Cursor.SE_RESIZE_CURSOR -> {
|
||||
newBounds.width += dx;
|
||||
newBounds.height += dy;
|
||||
}
|
||||
case Cursor.W_RESIZE_CURSOR -> {
|
||||
newBounds.x += dx;
|
||||
newBounds.width -= dx;
|
||||
}
|
||||
case Cursor.N_RESIZE_CURSOR -> {
|
||||
newBounds.y += dy;
|
||||
newBounds.height -= dy;
|
||||
}
|
||||
case Cursor.NW_RESIZE_CURSOR -> {
|
||||
newBounds.x += dx;
|
||||
newBounds.y += dy;
|
||||
newBounds.width -= dx;
|
||||
newBounds.height -= dy;
|
||||
}
|
||||
case Cursor.NE_RESIZE_CURSOR -> {
|
||||
newBounds.y += dy;
|
||||
newBounds.width += dx;
|
||||
newBounds.height -= dy;
|
||||
}
|
||||
case Cursor.SW_RESIZE_CURSOR -> {
|
||||
newBounds.x += dx;
|
||||
newBounds.width -= dx;
|
||||
newBounds.height += dy;
|
||||
}
|
||||
}
|
||||
|
||||
setBounds(newBounds);
|
||||
|
||||
e.getComponent().dispatchEvent(new ComponentEvent(e.getComponent(), ComponentEvent.COMPONENT_RESIZED));
|
||||
}
|
||||
};
|
||||
|
||||
addMouseListener(adapter);
|
||||
addMouseMotionListener(adapter);
|
||||
|
||||
DesignManager.apply(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a component into the content area (center) by default.
|
||||
*
|
||||
* @param comp component
|
||||
*/
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
initIfOACComponent(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
initIfOACComponent(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
initIfOACComponent(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
initIfOACComponent(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
initIfOACComponent(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
|
||||
private void initIfOACComponent(Component comp) {
|
||||
if(comp instanceof OACComponent component)
|
||||
if (comp instanceof OACComponent component) {
|
||||
component.initDesign();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OACRootPane createRootPane() {
|
||||
OACRootPane rp = new OACRootPane();
|
||||
|
||||
rp.setOpaque(true);
|
||||
return rp;
|
||||
}
|
||||
@@ -37,69 +231,40 @@ public class OACFrame extends JFrame {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initIfOACComponent(comp);
|
||||
public void setLayeredPane(JLayeredPane layeredPane) {
|
||||
if(layeredPane instanceof OACLayeredPane)
|
||||
super.setLayeredPane(layeredPane);
|
||||
}
|
||||
|
||||
return super.add(comp);
|
||||
public void setLayeredPane(OACLayeredPane layeredPane) {
|
||||
setLayeredPane((JLayeredPane) layeredPane);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initIfOACComponent(comp);
|
||||
|
||||
return super.add(comp, index);
|
||||
public OACLayeredPane getLayeredPane() {
|
||||
return (OACLayeredPane) super.getLayeredPane();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initIfOACComponent(comp);
|
||||
private int getResizeCursor(MouseEvent e) {
|
||||
int x = e.getX();
|
||||
int y = e.getY();
|
||||
int w = e.getComponent().getWidth();
|
||||
int h = e.getComponent().getHeight();
|
||||
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
boolean left = x < RESIZE_MARGIN;
|
||||
boolean right = x > w - RESIZE_MARGIN;
|
||||
boolean top = y < RESIZE_MARGIN;
|
||||
boolean bottom = y > h - RESIZE_MARGIN;
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initIfOACComponent(comp);
|
||||
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initIfOACComponent(comp);
|
||||
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
|
||||
public OACFrame(GraphicsConfiguration gc) {
|
||||
super(gc);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public OACFrame(String title) {
|
||||
super(title);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public OACFrame(String title, GraphicsConfiguration gc) {
|
||||
super(title, gc);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.setUndecorated(true);
|
||||
|
||||
// DesignManager.apply(this.getRootPane());
|
||||
DesignManager.apply(this);
|
||||
this.setShape(new RoundRectangle2D.Double(
|
||||
0, 0,
|
||||
this.getWidth(),
|
||||
this.getHeight(),
|
||||
30, 30
|
||||
));
|
||||
if (left && top) return Cursor.NW_RESIZE_CURSOR;
|
||||
if (right && top) return Cursor.NE_RESIZE_CURSOR;
|
||||
if (left && bottom) return Cursor.SW_RESIZE_CURSOR;
|
||||
if (right && bottom) return Cursor.SE_RESIZE_CURSOR;
|
||||
if (left) return Cursor.W_RESIZE_CURSOR;
|
||||
if (right) return Cursor.E_RESIZE_CURSOR;
|
||||
if (top) return Cursor.N_RESIZE_CURSOR;
|
||||
if (bottom) return Cursor.S_RESIZE_CURSOR;
|
||||
|
||||
return Cursor.DEFAULT_CURSOR;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -27,7 +27,7 @@ public class OACLayeredPane extends JLayeredPane implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -40,7 +40,7 @@ public class OACList<E> extends JList<E> implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -39,7 +37,7 @@ public class OACMenu extends JMenu implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -27,7 +27,7 @@ public class OACMenuBar extends JMenuBar implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -47,7 +47,7 @@ public class OACMenuItem extends JMenuItem implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -51,7 +51,7 @@ public class OACOptionPane extends JOptionPane implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -39,7 +39,7 @@ public class OACPanel extends JPanel implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.Document;
|
||||
@@ -44,7 +44,7 @@ public class OACPasswordField extends JPasswordField implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -31,7 +31,7 @@ public class OACPopupMenu extends JPopupMenu implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -43,7 +43,7 @@ public class OACProgressBar extends JProgressBar implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -55,7 +55,7 @@ public class OACRadioButton extends JRadioButton implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -55,7 +55,7 @@ public class OACRadioButtonMenuItem extends JRadioButtonMenuItem implements OACC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -110,7 +110,7 @@ public class OACRootPane extends JRootPane implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -35,7 +35,7 @@ public class OACScrollBar extends JScrollBar implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -39,7 +39,7 @@ public class OACScrollPane extends JScrollPane implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -31,7 +31,7 @@ public class OACSeparator extends JSeparator implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -47,7 +47,7 @@ public class OACSlider extends JSlider implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -31,7 +31,7 @@ public class OACSpinner extends JSpinner implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -43,7 +43,7 @@ public class OACSplitPane extends JSplitPane implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -35,7 +35,7 @@ public class OACTabbedPane extends JTabbedPane implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
@@ -37,7 +37,7 @@ public class OACTable extends JTable implements OACComponent {
|
||||
super(rowData, columnNames);
|
||||
}
|
||||
|
||||
public OACTable(@NotNull Object[][] rowData, @NotNull Object[] columnNames) {
|
||||
public OACTable(@NonNull Object[][] rowData, @NonNull Object[] columnNames) {
|
||||
super(rowData, columnNames);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class OACTable extends JTable implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.Document;
|
||||
@@ -48,7 +48,7 @@ public class OACTextArea extends JTextArea implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.Document;
|
||||
import java.awt.*;
|
||||
@@ -44,7 +42,7 @@ public class OACTextField extends JTextField implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.StyledDocument;
|
||||
@@ -31,7 +31,7 @@ public class OACTextPane extends JTextPane implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/* Author: UnlegitDqrk
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openautonomousconnection.oacswing.component.design.DesignManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
/**
|
||||
* Custom title bar with tabs and window control buttons.
|
||||
*/
|
||||
public class OACTitleBar extends OACPanel {
|
||||
|
||||
@Getter @Setter
|
||||
private static int HEIGHT = 42;
|
||||
|
||||
private final OACFrame frame;
|
||||
private final OACTabbedPane tabs;
|
||||
|
||||
private Point dragStartOnScreen;
|
||||
private Point dragStartFrameLocation;
|
||||
|
||||
/**
|
||||
* Creates a title bar for the given frame.
|
||||
*
|
||||
* @param frame owning frame
|
||||
*/
|
||||
public OACTitleBar(OACFrame frame) {
|
||||
super(new BorderLayout());
|
||||
this.frame = frame;
|
||||
|
||||
setPreferredSize(new Dimension(1, HEIGHT));
|
||||
setBorder(new EmptyBorder(6, 10, 6, 10));
|
||||
|
||||
tabs = createTabs();
|
||||
OACPanel left = new OACPanel(new BorderLayout());
|
||||
left.setOpaque(false);
|
||||
left.add(tabs, BorderLayout.CENTER);
|
||||
|
||||
OACPanel right = createWindowControls();
|
||||
|
||||
add(left, BorderLayout.CENTER);
|
||||
add(right, BorderLayout.EAST);
|
||||
|
||||
installDragToMove();
|
||||
installDoubleClickMaximize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tab component.
|
||||
*
|
||||
* @return tabbed pane
|
||||
*/
|
||||
public OACTabbedPane getTabs() {
|
||||
return tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new tab.
|
||||
*
|
||||
* @param title tab title
|
||||
*/
|
||||
public void addTab(String title) {
|
||||
OACPanel placeholder = new OACPanel();
|
||||
placeholder.setOpaque(false);
|
||||
tabs.addTab(title, placeholder);
|
||||
}
|
||||
|
||||
private OACTabbedPane createTabs() {
|
||||
OACTabbedPane tp = new OACTabbedPane(OACTabbedPane.TOP, OACTabbedPane.SCROLL_TAB_LAYOUT);
|
||||
tp.setOpaque(false);
|
||||
|
||||
tp.setFocusable(false);
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
private OACPanel createWindowControls() {
|
||||
OACPanel p = new OACPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0));
|
||||
p.setOpaque(false);
|
||||
|
||||
OACButton min = createTitleButton("—");
|
||||
OACButton max = createTitleButton("▢");
|
||||
OACButton close = createTitleButton("✕");
|
||||
|
||||
min.addActionListener(e -> frame.setState(Frame.ICONIFIED));
|
||||
max.addActionListener(e -> toggleMaximize());
|
||||
close.addActionListener(e -> frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING)));
|
||||
|
||||
p.add(min);
|
||||
p.add(max);
|
||||
p.add(close);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
private OACButton createTitleButton(String text) {
|
||||
OACButton b = new OACButton(text);
|
||||
b.setFocusable(false);
|
||||
b.setBorderPainted(false);
|
||||
b.setContentAreaFilled(true);
|
||||
b.setOpaque(true);
|
||||
b.setPreferredSize(new Dimension(42, 28));
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
private void installDragToMove() {
|
||||
MouseAdapter drag = new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragStartOnScreen = e.getLocationOnScreen();
|
||||
dragStartFrameLocation = frame.getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (dragStartOnScreen == null || dragStartFrameLocation == null) {
|
||||
return;
|
||||
}
|
||||
Point now = e.getLocationOnScreen();
|
||||
int dx = now.x - dragStartOnScreen.x;
|
||||
int dy = now.y - dragStartOnScreen.y;
|
||||
|
||||
if ((frame.getExtendedState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) {
|
||||
return;
|
||||
}
|
||||
|
||||
frame.setLocation(dragStartFrameLocation.x + dx, dragStartFrameLocation.y + dy);
|
||||
|
||||
frame.dispatchEvent(new ComponentEvent(e.getComponent(), ComponentEvent.COMPONENT_MOVED));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
addMouseListener(drag);
|
||||
addMouseMotionListener(drag);
|
||||
}
|
||||
|
||||
private void installDoubleClickMaximize() {
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) {
|
||||
toggleMaximize();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void toggleMaximize() {
|
||||
int state = frame.getExtendedState();
|
||||
boolean maximized = (state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH;
|
||||
|
||||
if (maximized) {
|
||||
frame.setExtendedState(state & ~Frame.MAXIMIZED_BOTH);
|
||||
} else {
|
||||
frame.setExtendedState(state | Frame.MAXIMIZED_BOTH);
|
||||
}
|
||||
|
||||
frame.dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED));
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -55,7 +55,7 @@ public class OACToggleButton extends JToggleButton implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -39,7 +39,7 @@ public class OACToolBar extends JToolBar implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -27,7 +27,7 @@ public class OACToolTip extends JToolTip implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.TreeModel;
|
||||
@@ -55,7 +55,7 @@ public class OACTree extends JTree implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -27,7 +27,7 @@ public class OACViewport extends JViewport implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -43,7 +43,7 @@ public class OACWindow extends JWindow implements OACComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
public void add(@NonNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
package org.openautonomousconnection.oacswing.component.design;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.border.Border;
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -23,11 +26,22 @@ public final class Design {
|
||||
@Getter
|
||||
private final Map<Class<?>, OACColor> elements;
|
||||
|
||||
public Design(String name, Map<Class<?>, OACColor> elements) {
|
||||
@Getter
|
||||
protected Border border;
|
||||
|
||||
public Design(String name, Map<Class<?>, OACColor> elements, @NonNull Border border) {
|
||||
this.name = name;
|
||||
this.elements = elements;
|
||||
this.border = border;
|
||||
}
|
||||
|
||||
private Design(String name, Map<Class<?>, OACColor> elements) {
|
||||
this.name = name;
|
||||
this.elements = elements;
|
||||
this.border = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) return true;
|
||||
|
||||
@@ -6,13 +6,15 @@ package org.openautonomousconnection.oacswing.component.design;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openautonomousconnection.oacswing.component.OACAnimatedPanel;
|
||||
import org.openautonomousconnection.oacswing.component.OACButton;
|
||||
import org.openautonomousconnection.oacswing.component.OACComponent;
|
||||
import org.openautonomousconnection.oacswing.component.OACFrame;
|
||||
import org.openautonomousconnection.oacswing.component.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DesignManager {
|
||||
@@ -27,16 +29,26 @@ public class DesignManager {
|
||||
|
||||
private DesignManager() {
|
||||
instance = this;
|
||||
|
||||
this.designs = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Getter
|
||||
private List<Design> designs;
|
||||
private final List<Design> designs;
|
||||
|
||||
public static void apply(OACComponent component) {
|
||||
OACColor color;
|
||||
if(globalDesign == null)
|
||||
return;
|
||||
|
||||
if(globalDesign != null && ((color = globalDesign.getElements().get(component.getClass())) != null))
|
||||
component.setBackground(color.getColor());
|
||||
OACColor backgroundColour = globalDesign.getElements().get(component.getClass());
|
||||
Border border = globalDesign.getBorder();
|
||||
|
||||
if(backgroundColour == null)
|
||||
return;
|
||||
|
||||
component.setBackground(backgroundColour.getColor());
|
||||
if(component instanceof JComponent jComponent)
|
||||
jComponent.setBorder(border);
|
||||
}
|
||||
|
||||
public static void apply(OACFrame frame) {
|
||||
@@ -70,11 +82,30 @@ public class DesignManager {
|
||||
}
|
||||
|
||||
static {
|
||||
Design.DARK.getElements().putAll(Map.of(
|
||||
OACButton.class, OACColor.DARK_GREY,
|
||||
OACAnimatedPanel.class, OACColor.LIGHT_GREY,
|
||||
OACFrame.class, OACColor.GREY
|
||||
Design.DARK.getElements().put(OACButton.class, OACColor.DARK_BUTTON);
|
||||
Design.DARK.getElements().put(OACCheckBox.class, OACColor.DARK_INPUT_FIELD);
|
||||
Design.DARK.getElements().put(OACCheckBoxMenuItem.class, OACColor.DARK_ITEM);
|
||||
Design.DARK.getElements().put(OACColorChooser.class, OACColor.DARK_SECTION);
|
||||
Design.DARK.getElements().put(OACComboBox.class, OACColor.DARK_INPUT_FIELD);
|
||||
Design.DARK.getElements().put(OACFrame.class, OACColor.DARK_BACKGROUND);
|
||||
Design.DARK.getElements().put(OACLabel.class, OACColor.DARK_TEXT);
|
||||
Design.DARK.getElements().put(OACLayeredPane.class, OACColor.DARK_BACKGROUND);
|
||||
Design.DARK.getElements().put(OACList.class, OACColor.DARK_SECTION);
|
||||
Design.DARK.getElements().put(OACMenu.class, OACColor.DARK_INPUT_BUTTON);
|
||||
Design.DARK.getElements().put(OACMenuBar.class, OACColor.DARK_SECTION);
|
||||
Design.DARK.getElements().put(OACMenuItem.class, OACColor.DARK_ITEM);
|
||||
Design.DARK.getElements().put(OACOptionPane.class, OACColor.DARK_BACKGROUND);
|
||||
Design.DARK.getElements().put(OACPanel.class, OACColor.DARK_BACKGROUND);
|
||||
Design.DARK.getElements().put(OACPasswordField.class, OACColor.DARK_INPUT_FIELD);
|
||||
Design.DARK.getElements().put(OACPopupMenu.class, OACColor.DARK_BACKGROUND);
|
||||
Design.DARK.getElements().put(OACProgressBar.class, OACColor.DARK_ITEM);
|
||||
Design.DARK.getElements().put(OACRadioButton.class, OACColor.DARK_BUTTON);
|
||||
Design.DARK.getElements().put(OACTitleBar.class, OACColor.DARK_SECTION);
|
||||
|
||||
));
|
||||
Design.DARK.border = new LineBorder(OACColor.DARK_BORDERS.getColor(), 1);
|
||||
|
||||
//Design.DARK.border = new BevelBorder(BevelBorder.LOWERED, OACColor.DARK_BORDERS.getColor(), OACColor.DARK_SHADOW.getColor());
|
||||
|
||||
DesignManager.getInstance().registerDesign(Design.DARK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,31 @@ import lombok.Getter;
|
||||
import java.awt.*;
|
||||
|
||||
public enum OACColor {
|
||||
WEAK_RED(Color.getHSBColor(355, 0.5f, 0.7f)),
|
||||
SUPER_HIGHLIGHT(Color.decode("#fffff")),
|
||||
|
||||
// Dark mode colours
|
||||
DARK_INPUT_FIELD(Color.decode("#0f1118")),
|
||||
DARK_INPUT_BUTTON(Color.decode("#1f2330")),
|
||||
DARK_INPUT_BUTTON_HOVER(Color.decode("#1c2140")),
|
||||
DARK_ITEM(Color.decode("#d7dbe5")),
|
||||
DARK_BORDERS(Color.decode("#2a2f42")),
|
||||
DARK_BUTTON(Color.decode("#151a2b")),
|
||||
DARK_BUTTON_HOVER(Color.decode("#151a2b")),
|
||||
DARK_TEXT(Color.decode("#cfd3dc")),
|
||||
DARK_SUBTITLE(Color.decode("#9aa0aa")),
|
||||
DARK_LINK(Color.decode("#b4c6ff")),
|
||||
DARK_SECTION(Color.decode("#1f2330")),
|
||||
DARK_BIG_TEXT(Color.decode("#9aa0aa")),
|
||||
DARK_HEADING_1(Color.decode("#9bbcff")),
|
||||
DARK_HEADING_2(Color.decode("#8fb1ff")),
|
||||
DARK_HEADING_3(Color.decode("#cdd9ff")),
|
||||
DARK_HEADER(Color.decode("#0f1118")),
|
||||
DARK_HEADER_BORDER(Color.decode("#1f2330")),
|
||||
DARK_RAW_TEXT(Color.decode("#9aa0aa")),
|
||||
DARK_BACKGROUND(Color.decode("#0b0d12")),
|
||||
DARK_SHADOW(Color.decode("#9aa0aa"));
|
||||
|
||||
/*WEAK_RED(Color.getHSBColor(355, 0.5f, 0.7f)),
|
||||
STRONG_RED(Color.getHSBColor(350, 0.7f, 0.6f)),
|
||||
|
||||
WEAK_ORANGE(Color.getHSBColor(37, 0.6f, 0.8f)),
|
||||
@@ -36,7 +60,7 @@ public enum OACColor {
|
||||
|
||||
LIGHT_GREY(Color.getHSBColor(0, 0f, 0.60f)),
|
||||
|
||||
VERY_LIGHT_GREY(Color.getHSBColor(0, 0, 0.9f));
|
||||
VERY_LIGHT_GREY(Color.getHSBColor(0, 0, 0.9f));*/
|
||||
|
||||
@Getter
|
||||
private final Color color;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.openautonomousconnection.oacswing.icons.defaults;
|
||||
|
||||
import org.openautonomousconnection.oacswing.ModifiableImageIcon;
|
||||
|
||||
public class DefaultIcons {
|
||||
public static final ModifiableImageIcon CLOSE_ICON;
|
||||
public static final ModifiableImageIcon MINIMIZE_ICON;
|
||||
public static final ModifiableImageIcon FULL_ICON;
|
||||
|
||||
static {
|
||||
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
CLOSE_ICON = new ModifiableImageIcon(classloader.getResource("defaults/icons/temp_hole.png"));
|
||||
MINIMIZE_ICON = new ModifiableImageIcon(classloader.getResource("defaults/icons/temp_hole.png"));
|
||||
FULL_ICON = new ModifiableImageIcon(classloader.getResource("defaults/icons/temp_hole.png"));
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -26,7 +30,7 @@ public class AnimationTests {
|
||||
|
||||
frame.add(animatedPanel);
|
||||
|
||||
animatedPanel.play(0.1, true);
|
||||
animatedPanel.play(10, true);
|
||||
|
||||
frame.setVisible(true);
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openautonomousconnection.oacswing.component.OACTitledComponent;
|
||||
import org.openautonomousconnection.oacswing.component.*;
|
||||
import org.openautonomousconnection.oacswing.component.design.Design;
|
||||
import org.openautonomousconnection.oacswing.component.design.DesignManager;
|
||||
@@ -19,16 +22,16 @@ public class CustomizedTests {
|
||||
|
||||
OACFrame frame = TestUtils.mockOacFrame();
|
||||
|
||||
frame.setLayout(new FlowLayout(FlowLayout.CENTER));
|
||||
|
||||
frame.add(new OACButton());
|
||||
frame.setLayout(new FlowLayout());
|
||||
|
||||
OACLabel imageLabel = new OACLabel(TempIcons.TEMP_HOLE_ICON.ofSize(IconSize.MEDIUM));
|
||||
|
||||
frame.add(new OACTitledComponent<>("Titled", imageLabel));
|
||||
//frame.add(new OACTitledComponent<>("Titled", imageLabel));
|
||||
|
||||
frame.add(new OACButton());
|
||||
|
||||
frame.setVisible(true);
|
||||
|
||||
wait(5000);
|
||||
wait(15000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
|
||||
package org.openautonomousconnection.oacswing.test;
|
||||
|
||||
import org.openautonomousconnection.oacswing.component.OACFrame;
|
||||
|
||||
Reference in New Issue
Block a user