Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,18 @@

public class Button extends JButton {

private static int defaultWidth = 100;
private static int defaultHeight = 100;

public Button(final Icon icon) {
super(icon);
setAbsoluteSize(defaultWidth, defaultHeight);
setFocusPainted(false); // remove highlight when clicked
}

public Button(final Icon icon, final int width, final int height) {
super(icon);
setAbsoluteSize(width, height);
setFocusPainted(false); // remove highlight when clicked
}

public Button(final String text) {
super(text);
setAbsoluteSize(defaultWidth, defaultHeight);
setFocusPainted(false); // remove highlight when clicked
}

public Button(final String text, final Icon icon) {
super(text, icon);
setAbsoluteSize(defaultWidth, defaultHeight);
setFocusPainted(false); // remove highlight when clicked
}

public Button(final String text, final int width, final int height) {
super(text);
setAbsoluteSize(width, height);
setFocusPainted(false); // remove highlight when clicked
}

public static void setDefaultSize(final int width, final int height) {
defaultWidth = width;
defaultHeight = height;
}

public void setAbsoluteSize(final int width, final int height) {
final Dimension size = new Dimension(width, height);
setPreferredSize(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

public class Spinner extends JSpinner {

private static int defaultSize = 5;
private static final int DEFAULT_COLUMNS = 5;

private Spinner(final Integer start, final Integer min, final Integer max, final Integer step) {
super(new SpinnerNumberModel(start, min, max, step));
setColumnSize(defaultSize);
setColumnSize(DEFAULT_COLUMNS);
}

private Spinner(final Double start, final Double min, final Double max, final Double step) {
super(new SpinnerNumberModel(start, min, max, step));
setColumnSize(defaultSize);
setColumnSize(DEFAULT_COLUMNS);
}

public static Spinner createIntegerSpinner(
Expand All @@ -37,15 +37,33 @@ public static Spinner createDoubleSpinner(
return new Spinner(Math.max(min, Math.min(start, max)), min, max, step);
}

public static Spinner createIntegerSpinner(
final Integer start,
final Integer min,
final Integer max,
final Integer step,
final int columns) {
final Spinner spinner = createIntegerSpinner(start, min, max, step);
spinner.setColumnSize(columns);
return spinner;
}

public static Spinner createDoubleSpinner(
final Double start,
final Double min,
final Double max,
final Double step,
final int columns) {
final Spinner spinner = createDoubleSpinner(start, min, max, step);
spinner.setColumnSize(columns);
return spinner;
}

public void setColumnSize(final int width) {
final JFormattedTextField textField = ((NumberEditor)getEditor()).getTextField();
textField.setColumns(width);
}

public static void setDefaultSize(final int width) {
defaultSize = width;
}

public int getInt() {
return (Integer)getValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ public void setAbsoluteSize(final int width, final int height) {
setMaximumSize(size);
}

// @Override
// public void addTab(String title, Component component) throws Exception {
// if (component instanceof ListeningPanel) {
// super.addTab(title, component);
// } else {
// throw new Exception("asds");
// }
// }

/**
* The tabbed pane will call the selected and unselected methods when switching tabs.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,11 @@

public class ToggleButton extends JToggleButton {

private static int defaultWidth = 200;
private static int defaultHeight = 30;

private final String onText;
private final String offText;
private final ImageIcon onImage;
private final ImageIcon offImage;

public ToggleButton(final String offText, final String onText,
final ImageIcon offImage, final ImageIcon onImage) {
this.offText = offText;
this.onText = onText;
this.offImage = offImage;
this.onImage = onImage;
setSize(defaultWidth, defaultHeight);
init();
}

public ToggleButton(final String offText, final String onText,
final ImageIcon offImage, final ImageIcon onImage,
final int width, final int height) {
Expand All @@ -37,11 +24,6 @@ public ToggleButton(final String offText, final String onText,
init();
}

public static void setDefaultSize(final int width, final int height) {
defaultWidth = width;
defaultHeight = height;
}

private void init() {
setState(false); // set the initial state
setMargins(1, 1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ private void createUserInterface() {
"[]10[]"
));

Spinner.setDefaultSize(7);
Button.setDefaultSize(160, 26);
btnComputeGrid_ = new Button("Compute Grid");
btnEditPositionList_ = new Button("Edit Position List...");
btnRunOverviewAcq_ = new Button("Run Overview Acquisition");
btnComputeGrid_ = new Button("Compute Grid", 160, 26);
btnEditPositionList_ = new Button("Edit Position List...", 160, 26);
btnRunOverviewAcq_ = new Button("Run Overview Acquisition", 160, 26);
btnRunOverviewAcq_.setEnabled(false);

cbxUseX_ = new CheckBox("Slices from stage coordinates", false);
Expand Down Expand Up @@ -124,29 +122,29 @@ private void createUserInterface() {
lblXDelta_ = new JLabel("X delta [µm]:");
lblXCount_ = new JLabel("Slice count:");

spnXStart_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnXStop_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnXDelta_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnXStart_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);
spnXStop_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);
spnXDelta_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);

// Y
lblYStart_ = new JLabel("Y start [µm]:");
lblYStop_ = new JLabel("Y stop [µm]:");
lblYDelta_ = new JLabel("Y delta [µm]:");
lblYCount_ = new JLabel("Y count:");

spnYStart_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnYStop_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnYDelta_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnYStart_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);
spnYStop_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);
spnYDelta_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);

// Z
lblZStart_ = new JLabel("Z start [µm]:");
lblZStop_ = new JLabel("Z stop [µm]:");
lblZDelta_ = new JLabel("Z delta [µm]:");
lblZCount_ = new JLabel("Z count:");

spnZStart_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnZStop_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnZDelta_ = Spinner.createDoubleSpinner(0.0,-Double.MAX_VALUE, Double.MAX_VALUE, 100.0);
spnZStart_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);
spnZStop_ = Spinner.createDoubleSpinner(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);
spnZDelta_ = Spinner.createDoubleSpinner(0.0,-Double.MAX_VALUE, Double.MAX_VALUE, 100.0, 7);

final Panel pnlSettings = new Panel("Grid Settings");
pnlSettings.setMigLayout(
Expand All @@ -156,8 +154,7 @@ private void createUserInterface() {
);

final JLabel lblOverlap = new JLabel("Overlap (Y and Z) [%]:");
Spinner.setDefaultSize(4);
spnOverlapYZ_ = Spinner.createIntegerSpinner(10, 0, 100, 1);
spnOverlapYZ_ = Spinner.createIntegerSpinner(10, 0, 100, 1, 4);
cbxClearPositions_ = new CheckBox("Clear position list if YZ unused", false);

pnlX.add(lblXStart_, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,15 @@ private void createUserInterface() {
""
);

ToggleButton.setDefaultSize(120, 30);
btnRunAcquisition_ = new ToggleButton(
"Start Acquisition", "Stop Acquisition",
Icons.ARROW_RIGHT, Icons.CANCEL
Icons.ARROW_RIGHT, Icons.CANCEL, 120, 30
);
btnRunAcquisition_.setEnabled(true);

btnPauseAcquisition_ = new ToggleButton(
"Pause", "Resume",
Icons.PAUSE, Icons.PLAY
Icons.PAUSE, Icons.PLAY, 120, 30
);
btnPauseAcquisition_.setEnabled(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ private void createUserInterface() {
btnCustomROI_ = new Button("Custom", 140, 30);
btnCurrentROI_ = new Button("Get Current ROI", 140, 30);

spnOffsetX_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1);
spnOffsetY_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1);
spnWidth_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1);
spnHeight_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1);
spnOffsetX_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1, 6);
spnOffsetY_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1, 6);
spnWidth_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1, 6);
spnHeight_ = Spinner.createIntegerSpinner(0, 0, Integer.MAX_VALUE, 1, 6);

pnlROI.add(btnUnchangedROI_, "span 2, wrap");
pnlROI.add(btnFullROI_, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ private void createUserInterface() {

// post move delay
lblPostMoveDelay_ = new JLabel("Post-move delay [ms]:");
Spinner.setDefaultSize(8);
spnPostMoveDelay_ = Spinner.createIntegerSpinner(
model_.acquisitions().settings().postMoveDelay(),
0, Integer.MAX_VALUE, 100);
0, Integer.MAX_VALUE, 100, 8);

// XYZ grid
btnEditPositionList_ = new Button("Edit Position List...", 130, 24);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ private void createUserInterface() {
"[]5[]"
);

Spinner.setDefaultSize(6);
lblNumTimePoints_ = new JLabel("Number:");
lblTimePointInterval_ = new JLabel("Interval [s]:");
spnNumTimePoints_ = Spinner.createIntegerSpinner(
acqSettings.numTimePoints(), 1, Integer.MAX_VALUE,1);
acqSettings.numTimePoints(), 1, Integer.MAX_VALUE, 1, 6);
spnTimePointInterval_ = Spinner.createDoubleSpinner(
acqSettings.timePointInterval(), 0.1, Double.MAX_VALUE, 0.1);
acqSettings.timePointInterval(), 0.1, Double.MAX_VALUE, 0.1, 6);

add(lblNumTimePoints_, "");
add(spnNumTimePoints_, "wrap");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ private void createUserInterface() {
);

// NOTE: was 80 width on dispim
Button.setDefaultSize(100, 26);
btnTwoPoint_ = new Button("2-point");
btnTwoPoint_ = new Button("2-point", 100, 26);

if (geometryType == GeometryType.DISPIM) {
btnUpdate_ = new Button("Update");
btnUpdate_ = new Button("Update", 100, 26);
} else {
// SCAPE
btnUpdate_ = new Button("Update Offset", 120, 26);
Expand All @@ -95,9 +94,8 @@ private void createUserInterface() {
lblSlopeValue_.setText(String.format("%.3f μm/°", sliceSlope));
lblOffsetValue_.setText(String.format("%.3f μm", sliceOffset));

Button.setDefaultSize(26, 26);
btnStepUp_ = new Button(Icons.ARROW_UP);
btnStepDown_ = new Button(Icons.ARROW_DOWN);
btnStepUp_ = new Button(Icons.ARROW_UP, 26, 26);
btnStepDown_ = new Button(Icons.ARROW_DOWN, 26, 26);

btnRunAutofocus_.setEnabled(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,17 @@ private void createUserInterface() {
"[]5[]"
);

Button.setDefaultSize(80, 26);
btnImagingPath_ = new Button("Imaging");
btnMultiPath_ = new Button("Multi");
btnEpiPath_ = new Button("Epi");
btnImagingPath_ = new Button("Imaging", 80, 26);
btnMultiPath_ = new Button("Multi", 80, 26);
btnEpiPath_ = new Button("Epi", 80, 26);

ToggleButton.setDefaultSize(165, 26);
btnInvertedPath_ = new ToggleButton(
"Preview", "Stop Preview",
Icons.CAMERA, Icons.CANCEL
Icons.CAMERA, Icons.CANCEL, 165, 26
);
btnLiveMode_ = new ToggleButton(
"Live", "Stop Live",
Icons.CAMERA, Icons.CANCEL
Icons.CAMERA, Icons.CANCEL, 165, 26
);

// populate the combo box if the group exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ private void createUserInterface() {
txtSheetWidth_ = new TextField();
btnCenterOffset_ = new Button("Center", 100, 26);

Button.setDefaultSize(40, 30);
btnSheetWidthMinus_ = new Button("-");
btnSheetWidthPlus_ = new Button("+");
btnSheetOffsetMinus_ = new Button("-");
btnSheetOffsetPlus_ = new Button("+");
btnSheetWidthMinus_ = new Button("-", 40, 30);
btnSheetWidthPlus_ = new Button("+", 40, 30);
btnSheetOffsetMinus_ = new Button("-", 40, 30);
btnSheetOffsetPlus_ = new Button("+", 40, 30);

// TODO: set the ranges of these sliders to the micro-mirror's min and max deflection
sldSheetWidth_ = new Slider(0, 8, 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ private void createUserInterface() {
"[]5[]"
);

Button.setDefaultSize(50, 26);
btnImagingCenterGo_ = new Button("Go");
btnImagingCenterSet_ = new Button("Set");
btnImagingCenterGo_ = new Button("Go", 50, 26);
btnImagingCenterSet_ = new Button("Set", 50, 26);

//btnTestAcq_ = new Button("Test Acquisition", 120, 26);

Expand All @@ -80,15 +79,14 @@ private void createUserInterface() {
txtSlicePosition_ = new TextField();
txtImagingPosition_ = new TextField();

Button.setDefaultSize(80, 26);
btnSliceZero_ = new Button("Go to 0", 70, 26);
btnImagingZero_ = new Button("Go to 0", 70, 26);

final JLabel lblIllumPosition = new JLabel("Illumination Piezo:");
txtIllumPosition_ = new TextField();

btnIllumGoHome_ = new Button("Go Home");
btnIllumSetHome_ = new Button("Set Home");
btnIllumGoHome_ = new Button("Go Home", 80, 26);
btnIllumSetHome_ = new Button("Set Home", 80, 26);

lblSlicePositionValue_ = new JLabel("0.000 °");
lblImagingPositionValue_ = new JLabel("0.000 μm");
Expand Down
Loading