use of org.micromanager.internal.utils.ShowFlagsPanel in project micro-manager by micro-manager.
the class PropertyEditor method createComponents.
private void createComponents() {
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/micromanager/icons/microscope.gif")));
setLayout(new MigLayout("fill, insets 2, flowy"));
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
flags_.save(PropertyEditor.class);
}
@Override
public void windowOpened(WindowEvent e) {
// restore values from the previous session
data_.update(false);
data_.fireTableStructureChanged();
}
});
setTitle("Device Property Browser");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JButton refreshButton = new JButton("Refresh", new ImageIcon(getClass().getResource("/org/micromanager/icons/arrow_refresh.png")));
Font defaultFont = new Font("Arial", Font.PLAIN, 10);
add(new ShowFlagsPanel(data_, flags_, core_, core_.getSystemStateCache()), "split 2, aligny top, gapbottom 10");
refreshButton.setFont(defaultFont);
refreshButton.addActionListener((ActionEvent e) -> {
refresh(false);
});
add(refreshButton, "width 100!, center, wrap");
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(table_);
scrollPane.setFont(defaultFont);
scrollPane.setBorder(new BevelBorder(BevelBorder.LOWERED));
add(scrollPane, "span, grow, push, wrap");
}
use of org.micromanager.internal.utils.ShowFlagsPanel in project micro-manager by micro-manager.
the class ConfigDialog method initializeWidgets.
protected void initializeWidgets() {
if (showFlagsPanelVisible_) {
flags_.load(ConfigDialog.class);
Configuration cfg;
try {
if (presetName_.length() == 0) {
cfg = new Configuration();
} else {
cfg = core_.getConfigState(groupName_, presetName_);
}
showFlagsPanel_ = new ShowFlagsPanel(data_, flags_, core_, cfg);
add(showFlagsPanel_, "skip " + numRowsBeforeFilters_ + ", aligny top, span 1 3, wrap");
} catch (Exception e) {
ReportingUtils.showError(e);
}
}
final JPanel topMidPanel = new JPanel(new MigLayout("flowx, insets 0 6 0 0, gap 2"));
instructionsTextArea_ = new JTextArea();
instructionsTextArea_.setFont(new Font("Arial", Font.PLAIN, 12));
instructionsTextArea_.setWrapStyleWord(true);
instructionsTextArea_.setText(instructionsText_);
instructionsTextArea_.setEditable(false);
instructionsTextArea_.setOpaque(false);
topMidPanel.add(instructionsTextArea_, "gaptop 2, wrap");
nameFieldLabel_ = new JLabel(nameFieldLabelText_);
nameFieldLabel_.setFont(new Font("Arial", Font.BOLD, 12));
topMidPanel.add(nameFieldLabel_, "split 2, alignx right");
nameField_ = new JTextField();
nameField_.setFont(new Font("Arial", Font.PLAIN, 12));
// nameField_.setFont(new Font("Arial", Font.BOLD, 16));
// should consider increasing font size for entry field for readability,
// but would want to do it in multiple places for consistency
nameField_.setText(initName_);
nameField_.setEditable(true);
nameField_.setSelectionStart(0);
nameField_.setSelectionEnd(nameField_.getText().length());
int fieldWidth = showPixelSize_ ? 90 : 180;
topMidPanel.add(nameField_, "width " + fieldWidth + "!, gaptop 2, wrap");
if (showPixelSize_) {
JLabel pixelSizeFieldLabel = new JLabel(pixelSizeFieldLabelText_);
pixelSizeFieldLabel.setFont(new Font("Arial", Font.BOLD, 12));
topMidPanel.add(pixelSizeFieldLabel, "split 2, alignx right");
pixelSizeField_ = new JTextField();
pixelSizeField_.setFont(new Font("Arial", Font.PLAIN, 12));
pixelSizeField_.setText(pixelSize_);
pixelSizeField_.setEditable(true);
pixelSizeField_.setSelectionStart(0);
pixelSizeField_.setSelectionEnd(pixelSizeField_.getText().length());
topMidPanel.add(pixelSizeField_, "width " + fieldWidth + "!, gaptop 2, wrap");
}
JPanel topRightPanel = new JPanel(new MigLayout("flowy, insets 0 6 0 0, gap 2"));
okButton_ = new JButton("OK");
okButton_.addActionListener(e -> {
if (table_.isEditing() && table_.getCellEditor() != null) {
table_.getCellEditor().stopCellEditing();
}
okChosen();
});
topRightPanel.add(okButton_, "gapleft push, split 2, width 90!");
cancelButton_ = new JButton("Cancel");
cancelButton_.addActionListener(e -> dispose());
topRightPanel.add(cancelButton_, "width 90!");
add(topMidPanel, "flowx, split 2");
add(topRightPanel, "gapleft push, flowx");
// Override x button to make it have same behavior as Cancel button
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
dispose();
}
});
}
Aggregations