Skip to content

Commit

Permalink
keep improving the base components of the gui
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 21, 2024
1 parent 1ec2028 commit f844ec0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
19 changes: 19 additions & 0 deletions src/main/java/ai/nets/samj/gui/ImageSelection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ai.nets.samj.gui;

import javax.swing.JComboBox;

import ai.nets.samj.gui.components.ComboBoxButtonComp;
import ai.nets.samj.gui.components.ComboBoxItem;

public class ImageSelection extends ComboBoxButtonComp<ComboBoxItem> {


private static final long serialVersionUID = 2478618937640492286L;

public ImageSelection() {
super(new JComboBox<ComboBoxItem>());
this.cmbBox.setModel(null);

}

}
24 changes: 24 additions & 0 deletions src/main/java/ai/nets/samj/gui/ModelSelection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ai.nets.samj.gui;

import java.util.List;

import javax.swing.JComboBox;
import javax.swing.JPanel;

import ai.nets.samj.gui.components.ComboBoxButtonComp;
import io.bioimage.modelrunner.model.Model;

public class ModelSelection extends ComboBoxButtonComp<String> {


private static final long serialVersionUID = 2478618937640492286L;

public ModelSelection(List<Model> models) {
super(new JComboBox<String>());
this.cmbBox.setli(null);

}



}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.nets.samj.gui;
package ai.nets.samj.gui.components;

import java.awt.Font;
import java.awt.FontMetrics;
Expand All @@ -14,13 +14,13 @@ public class ComboBoxButtonComp<T> extends JPanel {

private static final long serialVersionUID = 2478618937640492286L;

private final JComboBox<T> modelCombobox;
protected final JComboBox<T> cmbBox;
private JButton btn = new JButton("▶");
private static final double RATIO_CBX_BTN = 10.0;

public ComboBoxButtonComp(JComboBox<T> modelCombobox) {
// Populate the JComboBox with models
this.modelCombobox = modelCombobox;
this.cmbBox = modelCombobox;
btn.setMargin(new Insets(2, 3, 2, 2));

// Set layout manager to null for absolute positioning
Expand Down Expand Up @@ -59,7 +59,7 @@ public void doLayout() {
int componentHeight = height - (2 * inset); // Account for top and bottom insets

// Set bounds for the JComboBox
modelCombobox.setBounds(x, y, comboWidth, componentHeight);
cmbBox.setBounds(x, y, comboWidth, componentHeight);

x += comboWidth + inset; // Move x position for the JButton

Expand Down

0 comments on commit f844ec0

Please sign in to comment.