Fixed Design bug in OACTabbedPane and functionality in OACTitleBar

This commit is contained in:
Tinglyyy
2026-02-08 12:14:58 +01:00
parent 178ec93e95
commit 3b11449cb1
4 changed files with 28 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
<groupId>org.openautonomousconnection</groupId>
<artifactId>OACSwing</artifactId>
<version>1.0.0-BETA.1.0</version>
<version>1.0.0-BETA.1.1</version>
<organization>
<name>Open Autonomous Connection</name>
<url>https://open-autonomous-connection.org/</url>

View File

@@ -245,6 +245,12 @@ public class OACFrame extends JFrame {
return (OACLayeredPane) super.getLayeredPane();
}
/**
* Get the resize cursor for the given edge / corner of this frame.
* Required, since undecorated Frames cannot be resized by default
* @param e event passed by mouse adapter
* @return id of detected resize cursor
*/
private int getResizeCursor(MouseEvent e) {
int x = e.getX();
int y = e.getY();

View File

@@ -22,6 +22,24 @@ public class OACTabbedPane extends JTabbedPane implements OACComponent {
super(tabPlacement, tabLayoutPolicy);
}
@Override
public void addTab(String title, Component component) {
this.initOther(component);
super.addTab(title, component);
}
@Override
public void addTab(String title, Icon icon, Component component) {
this.initOther(component);
super.addTab(title, icon, component);
}
@Override
public void addTab(String title, Icon icon, Component component, String tip) {
this.initOther(component);
super.addTab(title, icon, component, tip);
}
@Override
public Component add(Component comp) {
this.initOther(comp);

View File

@@ -69,11 +69,10 @@ public class OACTitleBar extends OACPanel {
* Adds a new tab.
*
* @param title tab title
* @param panel tab body
*/
public void addTab(String title) {
OACPanel placeholder = new OACPanel();
placeholder.setOpaque(false);
tabs.addTab(title, placeholder);
public void addTab(String title, OACPanel panel) {
tabs.addTab(title, panel);
}
private OACTabbedPane createTabs() {