Added 'design' functionality
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
package org.openautonomousconnection.oacswing;
|
||||
|
||||
public interface JAnimatedComponent {
|
||||
void play(double speed, boolean loop);
|
||||
|
||||
default void play(double speed) {
|
||||
this.play(speed, false);
|
||||
}
|
||||
|
||||
default void play() {
|
||||
this.play(1, false);
|
||||
}
|
||||
|
||||
void stop();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package org.openautonomousconnection.oacswing;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class JTitledComponent<C extends JComponent> extends JPanel {
|
||||
@Getter @Setter
|
||||
private JLabel title;
|
||||
|
||||
@Getter @Setter
|
||||
private C component;
|
||||
|
||||
public JTitledComponent(String title, C component) {
|
||||
this.setLayout(new FlowLayout());
|
||||
|
||||
this.title = new JLabel(title);
|
||||
|
||||
this.component = component;
|
||||
|
||||
this.add(this.title);
|
||||
this.add(this.component);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing;
|
||||
|
||||
import org.openautonomousconnection.oacswing.icons.IconSize;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Image icon with several (planned) modification methods, like <code>resize(x, y)</code>
|
||||
*/
|
||||
public class ModifiableImageIcon extends ImageIcon {
|
||||
public ModifiableImageIcon(String filename, String description) {
|
||||
super(filename, description);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon(String filename) {
|
||||
super(filename);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon(URL location, String description) {
|
||||
super(location, description);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon(URL location) {
|
||||
super(location);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon(Image image, String description) {
|
||||
super(image, description);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon(Image image) {
|
||||
super(image);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon(byte[] imageData, String description) {
|
||||
super(imageData, description);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon(byte[] imageData) {
|
||||
super(imageData);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ModifiableImageIcon ofSize(IconSize iconSize, int hints) {
|
||||
return this.ofSize(iconSize.getScale(), iconSize.getScale(), hints);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon ofSize(IconSize iconSize) {
|
||||
return this.ofSize(iconSize.getScale(), iconSize.getScale());
|
||||
}
|
||||
|
||||
public ModifiableImageIcon ofSize(int newWidth, int newHeight) {
|
||||
return this.ofSize(newWidth, newHeight, Image.SCALE_SMOOTH);
|
||||
}
|
||||
|
||||
public ModifiableImageIcon ofSize(int newWidth, int newHeight, int hints) {
|
||||
ModifiableImageIcon icon = this.clone();
|
||||
|
||||
icon.resize(newWidth, newHeight, hints);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void resize(int newWidth, int newHeight) {
|
||||
this.resize(newWidth, newHeight, Image.SCALE_SMOOTH);
|
||||
}
|
||||
|
||||
public void resize(int newWidth, int newHeight, int hints) {
|
||||
Image image = this.getImage();
|
||||
|
||||
this.setImage(image.getScaledInstance(newWidth, newHeight, hints));
|
||||
}
|
||||
|
||||
public void resize(IconSize iconSize) {
|
||||
this.resize(iconSize.getScale(), iconSize.getScale());
|
||||
}
|
||||
|
||||
public void resize(IconSize iconSize, int hints) {
|
||||
this.resize(iconSize.getScale(), iconSize.getScale(), hints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModifiableImageIcon clone() {
|
||||
return new ModifiableImageIcon(this.getImage(), this.getDescription());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Author: Maple
|
||||
* Jan. 23 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.animated;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public interface AnimatedComponent {
|
||||
void setCurrentRun(Timer timer);
|
||||
Timer getCurrentRun();
|
||||
|
||||
void setAnimationPath(AnimationPath animationPath);
|
||||
AnimationPath getAnimationPath();
|
||||
|
||||
void setBounds(int x, int y, int width, int height);
|
||||
|
||||
default void play(double speed, boolean loop) {
|
||||
AtomicInteger ticksPassed = new AtomicInteger();
|
||||
|
||||
this.setCurrentRun(new Timer(0, e -> {
|
||||
|
||||
if(ticksPassed.get() * speed / (100) < 1) {
|
||||
ticksPassed.addAndGet(this.getAnimationPath().getInbetweens());
|
||||
return;
|
||||
}
|
||||
|
||||
KeyFrame next = this.getAnimationPath().getNext();
|
||||
|
||||
if(next == null) {
|
||||
if(loop)
|
||||
this.getAnimationPath().reset();
|
||||
else
|
||||
((Timer) e.getSource()).stop();
|
||||
return;
|
||||
}
|
||||
|
||||
this.setBounds(next.position().x, next.position().y, next.width(), next.height());
|
||||
|
||||
ticksPassed.set(0);
|
||||
}));
|
||||
|
||||
this.getCurrentRun().start();
|
||||
}
|
||||
|
||||
default void play(double speed) {
|
||||
this.play(speed, false);
|
||||
}
|
||||
|
||||
default void play() {
|
||||
this.play(1, false);
|
||||
}
|
||||
|
||||
default void stop() {
|
||||
if(this.getCurrentRun() != null)
|
||||
if(this.getCurrentRun().isRunning())
|
||||
this.getCurrentRun().stop();
|
||||
|
||||
this.getAnimationPath().reset();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
/* Author: Maple
|
||||
* Jan. 24 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.animated;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -1,56 +1,22 @@
|
||||
/* Author: Maple
|
||||
* Jan. 23 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.animated;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openautonomousconnection.oacswing.JAnimatedComponent;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class JAnimatedPanel extends JPanel implements JAnimatedComponent {
|
||||
public class JAnimatedPanel extends JPanel implements AnimatedComponent {
|
||||
@Getter @Setter
|
||||
private AnimationPath animationPath;
|
||||
|
||||
@Getter @Setter
|
||||
private Timer currentRun = null;
|
||||
|
||||
public JAnimatedPanel(AnimationPath animationPath) {
|
||||
this.animationPath = animationPath;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void play(double speed, boolean loop) {
|
||||
|
||||
AtomicInteger ticksPassed = new AtomicInteger();
|
||||
|
||||
this.currentRun = new Timer(0, e -> {
|
||||
|
||||
if(ticksPassed.get() * speed / (100) < 1) {
|
||||
ticksPassed.addAndGet(animationPath.getInbetweens());
|
||||
return;
|
||||
}
|
||||
|
||||
KeyFrame next = animationPath.getNext();
|
||||
|
||||
if(next == null) {
|
||||
((Timer) e.getSource()).stop();
|
||||
return;
|
||||
}
|
||||
|
||||
setBounds(next.position().x, next.position().y, next.width(), next.height());
|
||||
|
||||
ticksPassed.set(0);
|
||||
});
|
||||
|
||||
this.currentRun.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if(this.currentRun != null)
|
||||
if(this.currentRun.isRunning())
|
||||
this.currentRun.stop();
|
||||
|
||||
this.animationPath.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/* Author: Maple
|
||||
* Jan. 24 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.animated;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openautonomousconnection.oacswing.animated.AnimatedComponent;
|
||||
import org.openautonomousconnection.oacswing.animated.AnimationPath;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class OACAnimatedPanel extends OACPanel implements AnimatedComponent {
|
||||
@Getter
|
||||
@Setter
|
||||
private AnimationPath animationPath;
|
||||
|
||||
@Getter @Setter
|
||||
private Timer currentRun = null;
|
||||
|
||||
public OACAnimatedPanel(AnimationPath animationPath) {
|
||||
this.animationPath = animationPath;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.openautonomousconnection.oacswing.component.design.Design;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
public class OACButton extends JButton implements OACComponent {
|
||||
public OACButton() {
|
||||
super(null, null);
|
||||
}
|
||||
|
||||
public OACButton(Design design, Icon icon) {
|
||||
super(null, icon);
|
||||
}
|
||||
|
||||
@ConstructorProperties({"text"})
|
||||
public OACButton(String text) {
|
||||
super(text, null);
|
||||
}
|
||||
|
||||
public OACButton(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACButton(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACCheckBox extends JCheckBox implements OACComponent {
|
||||
public OACCheckBox() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACCheckBox(Icon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public OACCheckBox(Icon icon, boolean selected) {
|
||||
super(icon, selected);
|
||||
}
|
||||
|
||||
public OACCheckBox(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACCheckBox(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACCheckBox(String text, boolean selected) {
|
||||
super(text, selected);
|
||||
}
|
||||
|
||||
public OACCheckBox(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
public OACCheckBox(String text, Icon icon, boolean selected) {
|
||||
super(text, icon, selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
return OACComponent.super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
return OACComponent.super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
return OACComponent.super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
OACComponent.super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACCheckBoxMenuItem extends JCheckBoxMenuItem implements OACComponent {
|
||||
public OACCheckBoxMenuItem() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACCheckBoxMenuItem(Icon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public OACCheckBoxMenuItem(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACCheckBoxMenuItem(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACCheckBoxMenuItem(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
public OACCheckBoxMenuItem(String text, boolean b) {
|
||||
super(text, b);
|
||||
}
|
||||
|
||||
public OACCheckBoxMenuItem(String text, Icon icon, boolean b) {
|
||||
super(text, icon, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
return OACComponent.super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
return OACComponent.super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
return OACComponent.super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
OACComponent.super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACColorChooser extends JColorChooser implements OACComponent {
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
return OACComponent.super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
return OACComponent.super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
return OACComponent.super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
OACComponent.super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Vector;
|
||||
|
||||
public class OACComboBox<E> extends JComboBox<E> implements OACComponent {
|
||||
public OACComboBox(ComboBoxModel<E> aModel) {
|
||||
super(aModel);
|
||||
}
|
||||
|
||||
public OACComboBox(E[] items) {
|
||||
super(items);
|
||||
}
|
||||
|
||||
public OACComboBox(Vector<E> items) {
|
||||
super(items);
|
||||
}
|
||||
|
||||
public OACComboBox() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
return OACComponent.super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
return OACComponent.super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
OACComponent.super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
return OACComponent.super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
OACComponent.super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
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;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Optional;
|
||||
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());
|
||||
}
|
||||
|
||||
void setBackground(Color color);
|
||||
|
||||
default void initOther(Component comp) {
|
||||
if(comp instanceof OACComponent component)
|
||||
component.initDesign();
|
||||
}
|
||||
|
||||
default @Nullable Component add(Optional<String> name, Component comp, OptionalInt index, Optional<?> constrains) throws ExecutionControl.NotImplementedException {
|
||||
JComponent superclass = this.getSuperclass();
|
||||
|
||||
if(comp instanceof OACComponent component)
|
||||
component.initDesign();
|
||||
|
||||
if(name.isPresent())
|
||||
return superclass.add(name.get(), comp);
|
||||
else if(constrains.isPresent())
|
||||
if(index.isPresent()) {
|
||||
superclass.add(comp, constrains.get(), index.getAsInt());
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
superclass.add(comp, constrains.get());
|
||||
return null;
|
||||
}
|
||||
|
||||
else if(index.isPresent())
|
||||
return superclass.add(comp, index.getAsInt());
|
||||
|
||||
else
|
||||
return superclass.add(comp);
|
||||
}
|
||||
|
||||
default Component add(Component comp) {
|
||||
try {
|
||||
return this.add(Optional.empty(), comp, OptionalInt.empty(), Optional.empty());
|
||||
} catch (ExecutionControl.NotImplementedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
default Component add(String name, Component comp) {
|
||||
try {
|
||||
return this.add(Optional.of(name), comp, OptionalInt.empty(), Optional.empty());
|
||||
} catch (ExecutionControl.NotImplementedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
default Component add(Component comp, int index) {
|
||||
try {
|
||||
return this.add(Optional.empty(), comp, OptionalInt.of(index), Optional.empty());
|
||||
} catch (ExecutionControl.NotImplementedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
default void add(Component comp, Object constraints, int index) {
|
||||
try {
|
||||
this.add(Optional.empty(), comp, OptionalInt.of(index), Optional.of(constraints));
|
||||
} catch (ExecutionControl.NotImplementedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
default void add(Component comp, Object constraints) {
|
||||
try {
|
||||
this.add(Optional.empty(), comp, OptionalInt.empty(), Optional.of(constraints));
|
||||
} catch (ExecutionControl.NotImplementedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed to run JComponent / Component methods
|
||||
* @return JComponent type superclass
|
||||
* @throws ExecutionControl.NotImplementedException superclass is not of type JComponent
|
||||
*/
|
||||
default JComponent getSuperclass() throws ExecutionControl.NotImplementedException {
|
||||
if(this instanceof JComponent superClass)
|
||||
return superClass;
|
||||
else
|
||||
throw new ExecutionControl.NotImplementedException("Trying to implement OACComponent interface for non-JComponent class");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.openautonomousconnection.oacswing.component.design.DesignManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
public class OACFrame extends JFrame {
|
||||
public OACFrame() {
|
||||
super();
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
private void initIfOACComponent(Component comp) {
|
||||
if(comp instanceof OACComponent component)
|
||||
component.initDesign();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OACRootPane createRootPane() {
|
||||
OACRootPane rp = new OACRootPane();
|
||||
|
||||
rp.setOpaque(true);
|
||||
return rp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OACRootPane getRootPane() {
|
||||
return (OACRootPane) this.rootPane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initIfOACComponent(comp);
|
||||
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initIfOACComponent(comp);
|
||||
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initIfOACComponent(comp);
|
||||
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@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
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class OACLabel extends JLabel implements OACComponent {
|
||||
public OACLabel(String text, Icon icon, int horizontalAlignment) {
|
||||
super(text, icon, horizontalAlignment);
|
||||
}
|
||||
|
||||
public OACLabel(String text, int horizontalAlignment) {
|
||||
super(text, null, horizontalAlignment);
|
||||
}
|
||||
|
||||
public OACLabel(String text) {
|
||||
super(text, null, LEADING);
|
||||
}
|
||||
|
||||
public OACLabel(Icon image, int horizontalAlignment) {
|
||||
super(null, image, horizontalAlignment);
|
||||
}
|
||||
|
||||
public OACLabel(Icon image) {
|
||||
super(null, image, CENTER);
|
||||
}
|
||||
|
||||
public OACLabel() {
|
||||
super("", null, LEADING);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACLayeredPane extends JLayeredPane implements OACComponent {
|
||||
public OACLayeredPane() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Vector;
|
||||
|
||||
public class OACList<E> extends JList<E> implements OACComponent {
|
||||
public OACList(ListModel<E> dataModel) {
|
||||
super(dataModel);
|
||||
}
|
||||
|
||||
public OACList(E[] listData) {
|
||||
super(listData);
|
||||
}
|
||||
|
||||
public OACList(Vector<? extends E> listData) {
|
||||
super(listData);
|
||||
}
|
||||
|
||||
public OACList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACMenu extends JMenu implements OACComponent {
|
||||
public OACMenu() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACMenu(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public OACMenu(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACMenu(String s, boolean b) {
|
||||
super(s, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACMenuBar extends JMenuBar implements OACComponent {
|
||||
public OACMenuBar() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACMenuItem extends JMenuItem implements OACComponent {
|
||||
public OACMenuItem() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACMenuItem(Icon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public OACMenuItem(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACMenuItem(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACMenuItem(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
public OACMenuItem(String text, int mnemonic) {
|
||||
super(text, mnemonic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACOptionPane extends JOptionPane implements OACComponent {
|
||||
public OACOptionPane() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACOptionPane(Object message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public OACOptionPane(Object message, int messageType) {
|
||||
super(message, messageType);
|
||||
}
|
||||
|
||||
public OACOptionPane(Object message, int messageType, int optionType) {
|
||||
super(message, messageType, optionType);
|
||||
}
|
||||
|
||||
public OACOptionPane(Object message, int messageType, int optionType, Icon icon) {
|
||||
super(message, messageType, optionType, icon);
|
||||
}
|
||||
|
||||
public OACOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options) {
|
||||
super(message, messageType, optionType, icon, options);
|
||||
}
|
||||
|
||||
public OACOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue) {
|
||||
super(message, messageType, optionType, icon, options, initialValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACPanel extends JPanel implements OACComponent {
|
||||
public OACPanel(LayoutManager layout, boolean isDoubleBuffered) {
|
||||
super(layout, isDoubleBuffered);
|
||||
}
|
||||
|
||||
public OACPanel(LayoutManager layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
public OACPanel(boolean isDoubleBuffered) {
|
||||
super(isDoubleBuffered);
|
||||
}
|
||||
|
||||
public OACPanel() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.Document;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACPasswordField extends JPasswordField implements OACComponent {
|
||||
public OACPasswordField() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACPasswordField(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACPasswordField(int columns) {
|
||||
super(columns);
|
||||
}
|
||||
|
||||
public OACPasswordField(String text, int columns) {
|
||||
super(text, columns);
|
||||
}
|
||||
|
||||
public OACPasswordField(Document doc, String txt, int columns) {
|
||||
super(doc, txt, columns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACPopupMenu extends JPopupMenu implements OACComponent {
|
||||
public OACPopupMenu() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACPopupMenu(String label) {
|
||||
super(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACProgressBar extends JProgressBar implements OACComponent {
|
||||
public OACProgressBar() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACProgressBar(int orient) {
|
||||
super(orient);
|
||||
}
|
||||
|
||||
public OACProgressBar(int min, int max) {
|
||||
super(min, max);
|
||||
}
|
||||
|
||||
public OACProgressBar(int orient, int min, int max) {
|
||||
super(orient, min, max);
|
||||
}
|
||||
|
||||
public OACProgressBar(BoundedRangeModel newModel) {
|
||||
super(newModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACRadioButton extends JRadioButton implements OACComponent {
|
||||
public OACRadioButton() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACRadioButton(Icon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public OACRadioButton(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACRadioButton(Icon icon, boolean selected) {
|
||||
super(icon, selected);
|
||||
}
|
||||
|
||||
public OACRadioButton(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACRadioButton(String text, boolean selected) {
|
||||
super(text, selected);
|
||||
}
|
||||
|
||||
public OACRadioButton(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
public OACRadioButton(String text, Icon icon, boolean selected) {
|
||||
super(text, icon, selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACRadioButtonMenuItem extends JRadioButtonMenuItem implements OACComponent {
|
||||
public OACRadioButtonMenuItem() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACRadioButtonMenuItem(Icon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public OACRadioButtonMenuItem(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACRadioButtonMenuItem(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACRadioButtonMenuItem(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
public OACRadioButtonMenuItem(String text, boolean selected) {
|
||||
super(text, selected);
|
||||
}
|
||||
|
||||
public OACRadioButtonMenuItem(Icon icon, boolean selected) {
|
||||
super(icon, selected);
|
||||
}
|
||||
|
||||
public OACRadioButtonMenuItem(String text, Icon icon, boolean selected) {
|
||||
super(text, icon, selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACRootPane extends JRootPane implements OACComponent {
|
||||
public OACRootPane() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OACLayeredPane createLayeredPane() {
|
||||
OACLayeredPane p = new OACLayeredPane();
|
||||
p.setName(this.getName()+".layeredPane");
|
||||
return p;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Container createContentPane() {
|
||||
JComponent c = new OACPanel();
|
||||
c.setName(this.getName()+".contentPane");
|
||||
c.setLayout(new BorderLayout() {
|
||||
/* This BorderLayout subclass maps a null constraint to CENTER.
|
||||
* Although the reference BorderLayout also does this, some VMs
|
||||
* throw an IllegalArgumentException.
|
||||
*/
|
||||
public void addLayoutComponent(Component comp, Object constraints) {
|
||||
if (constraints == null) {
|
||||
constraints = BorderLayout.CENTER;
|
||||
}
|
||||
super.addLayoutComponent(comp, constraints);
|
||||
}
|
||||
});
|
||||
return c;
|
||||
}
|
||||
|
||||
// public void setOACMenuBar(OACMenuBar menu) {
|
||||
// super.setJMenuBar(menu);
|
||||
// }
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public JMenuBar getJMenuBar() {
|
||||
if(this.menuBar instanceof OACMenuBar oacMenuBar)
|
||||
return oacMenuBar;
|
||||
else
|
||||
return this.menuBar;
|
||||
}
|
||||
|
||||
public OACMenuBar getOACMenuBar() {
|
||||
return (OACMenuBar) this.menuBar;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setLayeredPane(JLayeredPane layered) {
|
||||
if(layered instanceof OACLayeredPane)
|
||||
super.setLayeredPane(layered);
|
||||
}
|
||||
|
||||
public void setLayeredPane(OACLayeredPane layeredPane) {
|
||||
super.setLayeredPane(layeredPane);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setDefaultButton(JButton defaultButton) {
|
||||
if(defaultButton instanceof OACButton)
|
||||
super.setDefaultButton(defaultButton);
|
||||
}
|
||||
|
||||
public void setDefaultButton(OACButton defaultButton) {
|
||||
super.setDefaultButton(defaultButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OACButton getDefaultButton() {
|
||||
return (OACButton) this.defaultButton;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OACLayeredPane getLayeredPane() { return (OACLayeredPane) this.layeredPane; }
|
||||
|
||||
@Override
|
||||
protected Component createGlassPane() {
|
||||
OACPanel c = new OACPanel();
|
||||
c.setName(this.getName()+".glassPane");
|
||||
c.setVisible(false);
|
||||
c.setOpaque(false);
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACScrollBar extends JScrollBar implements OACComponent {
|
||||
public OACScrollBar(int orientation, int value, int extent, int min, int max) {
|
||||
super(orientation, value, extent, min, max);
|
||||
}
|
||||
|
||||
public OACScrollBar(int orientation) {
|
||||
super(orientation);
|
||||
}
|
||||
|
||||
public OACScrollBar() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACScrollPane extends JScrollPane implements OACComponent {
|
||||
public OACScrollPane(Component view, int vsbPolicy, int hsbPolicy) {
|
||||
super(view, vsbPolicy, hsbPolicy);
|
||||
}
|
||||
|
||||
public OACScrollPane(Component view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
public OACScrollPane(int vsbPolicy, int hsbPolicy) {
|
||||
super(vsbPolicy, hsbPolicy);
|
||||
}
|
||||
|
||||
public OACScrollPane() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACSeparator extends JSeparator implements OACComponent {
|
||||
public OACSeparator() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACSeparator(int orientation) {
|
||||
super(orientation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACSlider extends JSlider implements OACComponent {
|
||||
public OACSlider() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACSlider(int orientation) {
|
||||
super(orientation);
|
||||
}
|
||||
|
||||
public OACSlider(int min, int max) {
|
||||
super(min, max);
|
||||
}
|
||||
|
||||
public OACSlider(int min, int max, int value) {
|
||||
super(min, max, value);
|
||||
}
|
||||
|
||||
public OACSlider(int orientation, int min, int max, int value) {
|
||||
super(orientation, min, max, value);
|
||||
}
|
||||
|
||||
public OACSlider(BoundedRangeModel brm) {
|
||||
super(brm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACSpinner extends JSpinner implements OACComponent {
|
||||
public OACSpinner(SpinnerModel model) {
|
||||
super(model);
|
||||
}
|
||||
|
||||
public OACSpinner() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACSplitPane extends JSplitPane implements OACComponent {
|
||||
public OACSplitPane() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACSplitPane(int newOrientation) {
|
||||
super(newOrientation);
|
||||
}
|
||||
|
||||
public OACSplitPane(int newOrientation, boolean newContinuousLayout) {
|
||||
super(newOrientation, newContinuousLayout);
|
||||
}
|
||||
|
||||
public OACSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent) {
|
||||
super(newOrientation, newLeftComponent, newRightComponent);
|
||||
}
|
||||
|
||||
public OACSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent) {
|
||||
super(newOrientation, newContinuousLayout, newLeftComponent, newRightComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACTabbedPane extends JTabbedPane implements OACComponent {
|
||||
public OACTabbedPane() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACTabbedPane(int tabPlacement) {
|
||||
super(tabPlacement);
|
||||
}
|
||||
|
||||
public OACTabbedPane(int tabPlacement, int tabLayoutPolicy) {
|
||||
super(tabPlacement, tabLayoutPolicy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import javax.swing.table.TableModel;
|
||||
import java.awt.*;
|
||||
import java.util.Vector;
|
||||
|
||||
public class OACTable extends JTable implements OACComponent {
|
||||
public OACTable() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACTable(TableModel dm) {
|
||||
super(dm);
|
||||
}
|
||||
|
||||
public OACTable(TableModel dm, TableColumnModel cm) {
|
||||
super(dm, cm);
|
||||
}
|
||||
|
||||
public OACTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm) {
|
||||
super(dm, cm, sm);
|
||||
}
|
||||
|
||||
public OACTable(int numRows, int numColumns) {
|
||||
super(numRows, numColumns);
|
||||
}
|
||||
|
||||
public OACTable(Vector<? extends Vector> rowData, Vector<?> columnNames) {
|
||||
super(rowData, columnNames);
|
||||
}
|
||||
|
||||
public OACTable(@NotNull Object[][] rowData, @NotNull Object[] columnNames) {
|
||||
super(rowData, columnNames);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.Document;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACTextArea extends JTextArea implements OACComponent {
|
||||
public OACTextArea() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACTextArea(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACTextArea(int rows, int columns) {
|
||||
super(rows, columns);
|
||||
}
|
||||
|
||||
public OACTextArea(String text, int rows, int columns) {
|
||||
super(text, rows, columns);
|
||||
}
|
||||
|
||||
public OACTextArea(Document doc) {
|
||||
super(doc);
|
||||
}
|
||||
|
||||
public OACTextArea(Document doc, String text, int rows, int columns) {
|
||||
super(doc, text, rows, columns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.Document;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACTextField extends JTextField implements OACComponent {
|
||||
public OACTextField() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACTextField(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACTextField(int columns) {
|
||||
super(columns);
|
||||
}
|
||||
|
||||
public OACTextField(String text, int columns) {
|
||||
super(text, columns);
|
||||
}
|
||||
|
||||
public OACTextField(Document doc, String text, int columns) {
|
||||
super(doc, text, columns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.StyledDocument;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACTextPane extends JTextPane implements OACComponent {
|
||||
public OACTextPane() {
|
||||
}
|
||||
|
||||
public OACTextPane(StyledDocument doc) {
|
||||
super(doc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/* Author: Maple
|
||||
* Jan. 22 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACTitledComponent<C extends JComponent & OACComponent> extends OACPanel {
|
||||
@Getter @Setter
|
||||
private OACLabel title;
|
||||
|
||||
@Getter @Setter
|
||||
private C component;
|
||||
|
||||
public OACTitledComponent(String title, C component, int alignment) {
|
||||
this.setLayout(new BorderLayout());
|
||||
|
||||
this.title = new OACLabel(title, alignment);
|
||||
|
||||
this.component = component;
|
||||
|
||||
this.add(this.title, BorderLayout.NORTH);
|
||||
this.add(this.component);
|
||||
}
|
||||
|
||||
public OACTitledComponent(String title, C component) {
|
||||
this(title, component, SwingConstants.CENTER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACToggleButton extends JToggleButton implements OACComponent {
|
||||
public OACToggleButton() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACToggleButton(Icon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public OACToggleButton(Icon icon, boolean selected) {
|
||||
super(icon, selected);
|
||||
}
|
||||
|
||||
public OACToggleButton(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public OACToggleButton(String text, boolean selected) {
|
||||
super(text, selected);
|
||||
}
|
||||
|
||||
public OACToggleButton(Action a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public OACToggleButton(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
}
|
||||
|
||||
public OACToggleButton(String text, Icon icon, boolean selected) {
|
||||
super(text, icon, selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACToolBar extends JToolBar implements OACComponent {
|
||||
public OACToolBar() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACToolBar(int orientation) {
|
||||
super(orientation);
|
||||
}
|
||||
|
||||
public OACToolBar(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public OACToolBar(String name, int orientation) {
|
||||
super(name, orientation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACToolTip extends JToolTip implements OACComponent {
|
||||
public OACToolTip() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}}
|
||||
@@ -0,0 +1,74 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import java.awt.*;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
|
||||
public class OACTree extends JTree implements OACComponent {
|
||||
public OACTree() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACTree(Object[] value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public OACTree(Vector<?> value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public OACTree(Hashtable<?, ?> value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public OACTree(TreeNode root) {
|
||||
super(root);
|
||||
}
|
||||
|
||||
public OACTree(TreeNode root, boolean asksAllowsChildren) {
|
||||
super(root, asksAllowsChildren);
|
||||
}
|
||||
|
||||
public OACTree(TreeModel newModel) {
|
||||
super(newModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACViewport extends JViewport implements OACComponent {
|
||||
public OACViewport() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class OACWindow extends JWindow implements OACComponent {
|
||||
public OACWindow() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OACWindow(GraphicsConfiguration gc) {
|
||||
super(gc);
|
||||
}
|
||||
|
||||
public OACWindow(Frame owner) {
|
||||
super(owner);
|
||||
}
|
||||
|
||||
public OACWindow(Window owner) {
|
||||
super(owner);
|
||||
}
|
||||
|
||||
public OACWindow(Window owner, GraphicsConfiguration gc) {
|
||||
super(owner, gc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component comp, int index) {
|
||||
this.initOther(comp);
|
||||
return super.add(comp, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(@NotNull Component comp, Object constraints) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(String name, Component comp) {
|
||||
this.initOther(comp);
|
||||
return super.add(name, comp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Component comp, Object constraints, int index) {
|
||||
this.initOther(comp);
|
||||
super.add(comp, constraints, index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component.design;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public final class Design {
|
||||
public static final Design LIGHT = new Design("light", new HashMap<>());
|
||||
|
||||
public static final Design DARK = new Design("dark", new HashMap<>());
|
||||
|
||||
public static final Design CONTRAST = new Design("contrast", new HashMap<>());
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
@Getter
|
||||
private final Map<Class<?>, OACColor> elements;
|
||||
|
||||
public Design(String name, Map<Class<?>, OACColor> elements) {
|
||||
this.name = name;
|
||||
this.elements = elements;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) return true;
|
||||
if (obj == null || obj.getClass() != this.getClass()) return false;
|
||||
var that = (Design) obj;
|
||||
return Objects.equals(this.name, that.name) &&
|
||||
Objects.equals(this.elements, that.elements);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, elements);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Design[" +
|
||||
"name=" + name + ", " +
|
||||
"elements=" + elements + ']';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
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 java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DesignManager {
|
||||
@Getter @Setter
|
||||
private static Design globalDesign;
|
||||
|
||||
public static DesignManager getInstance() {
|
||||
return Objects.requireNonNullElseGet(instance, DesignManager::new);
|
||||
}
|
||||
|
||||
private static DesignManager instance;
|
||||
|
||||
private DesignManager() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Getter
|
||||
private List<Design> designs;
|
||||
|
||||
public static void apply(OACComponent component) {
|
||||
OACColor color;
|
||||
|
||||
if(globalDesign != null && ((color = globalDesign.getElements().get(component.getClass())) != null))
|
||||
component.setBackground(color.getColor());
|
||||
}
|
||||
|
||||
public static void apply(OACFrame frame) {
|
||||
OACColor color;
|
||||
|
||||
if(globalDesign != null && ((color = globalDesign.getElements().get(frame.getClass())) != null))
|
||||
frame.getContentPane().setBackground(color.getColor());
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void registerDesign(Design design) {
|
||||
this.designs.add(design);
|
||||
}
|
||||
|
||||
public void registerComponent(Class<?> componentClass, OACColor color) {
|
||||
Style.Design eDesign = Style.Design.DARK;
|
||||
|
||||
if(componentClass.isAnnotationPresent(Style.class))
|
||||
eDesign = componentClass.getAnnotation(Style.class).design();
|
||||
|
||||
Design design = switch (eDesign) {
|
||||
case LIGHT -> Design.LIGHT;
|
||||
case DARK -> Design.DARK;
|
||||
case CONTRAST -> Design.CONTRAST;
|
||||
};
|
||||
|
||||
design.getElements().putIfAbsent(componentClass, null);
|
||||
|
||||
design.getElements().replace(componentClass, color);
|
||||
}
|
||||
|
||||
static {
|
||||
Design.DARK.getElements().putAll(Map.of(
|
||||
OACButton.class, OACColor.DARK_GREY,
|
||||
OACAnimatedPanel.class, OACColor.LIGHT_GREY,
|
||||
OACFrame.class, OACColor.GREY
|
||||
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component.design;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public enum OACColor {
|
||||
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)),
|
||||
STRONG_ORANGE(Color.getHSBColor(30, 0.9f, 0.8f)),
|
||||
|
||||
WEAK_YELLOW(Color.getHSBColor(56, 0.45f, 0.80f)),
|
||||
STRONG_YELLOW(Color.getHSBColor(45, 0.65f, 0.85f)),
|
||||
|
||||
WEAK_GREEN(Color.getHSBColor(125,0.35f,0.5f)),
|
||||
STRONG_GREEN(Color.getHSBColor(110, 0.5f, 0.55f)),
|
||||
|
||||
WEAK_AQUA(Color.getHSBColor(175, 0.35f, 0.75f)),
|
||||
STRONG_AQUA(Color.getHSBColor(195, 0.62f, 0.65f)),
|
||||
|
||||
WEAK_BLUE(Color.getHSBColor(225, 0.45f, 0.6f)),
|
||||
STRONG_BLUE(Color.getHSBColor(215, 0.7f, 0.55f)),
|
||||
|
||||
WEAK_MAGENTA(Color.getHSBColor(277,0.35f,0.65f)),
|
||||
STRONG_MAGENTA(Color.getHSBColor(266, 0.45f, 0.66f)),
|
||||
|
||||
DARK_GREY(Color.getHSBColor(0,0,0.25f)),
|
||||
|
||||
GREY(Color.getHSBColor(0, 0f, 0.44f)),
|
||||
|
||||
LIGHT_GREY(Color.getHSBColor(0, 0f, 0.60f)),
|
||||
|
||||
VERY_LIGHT_GREY(Color.getHSBColor(0, 0, 0.9f));
|
||||
|
||||
@Getter
|
||||
private final Color color;
|
||||
|
||||
OACColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.component.design;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Style {
|
||||
enum Design {
|
||||
LIGHT,
|
||||
DARK,
|
||||
CONTRAST
|
||||
}
|
||||
|
||||
Design design();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.icons;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Preset icon scales
|
||||
*/
|
||||
public enum IconSize {
|
||||
SUPER_TINY(8),
|
||||
TINY(16),
|
||||
SMALLER(32),
|
||||
SMALL(64),
|
||||
LESS_MEDIUM(128),
|
||||
MEDIUM(256),
|
||||
MORE_MEDIUM(512),
|
||||
LARGE(1024),
|
||||
LARGER(2048),
|
||||
HUGE(4096),
|
||||
SUPER_HUGE(8192);
|
||||
|
||||
@Getter
|
||||
private final int scale;
|
||||
IconSize(int scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/* Author: Maple
|
||||
* Feb. 2 2026
|
||||
* */
|
||||
|
||||
package org.openautonomousconnection.oacswing.icons.temp;
|
||||
|
||||
import org.openautonomousconnection.oacswing.ModifiableImageIcon;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Class containing testing / placeholder icons
|
||||
*/
|
||||
public class TempIcons {
|
||||
public static final ModifiableImageIcon TEMP_HOLE_ICON;
|
||||
|
||||
static {
|
||||
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
TEMP_HOLE_ICON = new ModifiableImageIcon(classloader.getResource("defaults/icons/temp_hole.png"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user