Skip to content
This repository has been archived by the owner on Jul 20, 2021. It is now read-only.

Commit

Permalink
UI tweak: reduce footprint of path list window
Browse files Browse the repository at this point in the history
  • Loading branch information
tferr committed Nov 30, 2016
1 parent c4bdeae commit 7477ab4
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/main/java/tracing/PathWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import ij.io.SaveDialog;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
Expand Down Expand Up @@ -61,6 +63,7 @@
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
Expand Down Expand Up @@ -525,7 +528,7 @@ public PathWindow(PathAndFillManager pathAndFillManager, SimpleNeuriteTracer plu
this.pathAndFillManager = pathAndFillManager;
this.plugin = plugin;

setBounds(x,y,700,300);
setBounds(x,y,600,240);
root = new DefaultMutableTreeNode("All Paths");
tree = new HelpfulJTree(root);
// tree.setRootVisible(false);
Expand All @@ -535,6 +538,7 @@ public PathWindow(PathAndFillManager pathAndFillManager, SimpleNeuriteTracer plu
add(scrollPane, BorderLayout.CENTER);

buttonPanel = new JPanel();
buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0));

add(buttonPanel, BorderLayout.PAGE_END);

Expand Down Expand Up @@ -577,13 +581,12 @@ public PathWindow(PathAndFillManager pathAndFillManager, SimpleNeuriteTracer plu
popup.add(swcTypeMenu);

// Create all the menu items:

renameButton = new JButton("Rename");
fitVolumeButton = new JButton("Fit Volume");
fillOutButton = new JButton("Fill Out");
makePrimaryButton = new JButton("Make Primary");
deleteButton = new JButton("Delete");
exportAsSWCButton = new JButton("Export as SWC");
renameButton = smallButton("Rename");
fitVolumeButton = smallButton("Fit Volume");
fillOutButton = smallButton("Fill Out");
makePrimaryButton = smallButton("Make Primary");
deleteButton = smallButton("Delete");
exportAsSWCButton = smallButton("Export as SWC");

buttonPanel.add(renameButton);
buttonPanel.add(fitVolumeButton);
Expand Down Expand Up @@ -616,6 +619,17 @@ protected void maybeShowPopup(MouseEvent me) {
tree.addMouseListener(ml);
}

private JButton smallButton(final String text) {
final double SCALE = .85;
final JButton button = new JButton(text);
final Font font = button.getFont();
button.setFont(font.deriveFont((float) (font.getSize() * SCALE)));
final Insets insets = button.getMargin();
button.setMargin(new Insets((int) (insets.top * SCALE), (int) (insets.left * SCALE),
(int) (insets.bottom * SCALE), (int) (insets.right * SCALE)));
return button;
}

protected void showPopup(MouseEvent me) {
assert SwingUtilities.isEventDispatchThread();
// Possibly adjust the selection here:
Expand Down

0 comments on commit 7477ab4

Please sign in to comment.