use of javax.swing.ListCellRenderer in project cytoscape-impl by cytoscape.
the class OntologyPanelBuilder method buildPanel.
protected void buildPanel() {
panel.getAdvancedButton().setEnabled(false);
final ListCellRenderer ontologyLcr = panel.ontologyComboBox.getRenderer();
panel.ontologyComboBox.setRenderer(new ListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel ontologyItem = (JLabel) ontologyLcr.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
String url = ontologyUrlMap.get(value);
if (isSelected) {
ontologyItem.setBackground(list.getSelectionBackground());
ontologyItem.setForeground(list.getSelectionForeground());
} else {
ontologyItem.setBackground(list.getBackground());
ontologyItem.setForeground(list.getForeground());
}
if ((url != null) && url.startsWith("http://")) {
ontologyItem.setIcon(REMOTE_SOURCE_ICON.getIcon());
} else {
ontologyItem.setIcon(LOCAL_SOURCE_ICON.getIcon());
}
return ontologyItem;
}
});
panel.ontologyComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
ontologyComboBoxActionPerformed(evt);
}
});
panel.browseOntologyButton.setToolTipText("Browse local ontology file...");
panel.browseOntologyButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
browseOntologyButtonActionPerformed(evt);
}
});
panel.annotationComboBox.setName("annotationComboBox");
final ListCellRenderer lcr = panel.annotationComboBox.getRenderer();
panel.annotationComboBox.setRenderer(new ListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel cmp = (JLabel) lcr.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
String url = annotationUrlMap.get(value);
if (value == null)
cmp.setIcon(null);
else if (value.toString().equals(DEF_ANNOTATION_ITEM)) {
cmp.setIcon(null);
} else if ((url != null) && url.startsWith("http://")) {
cmp.setIcon(REMOTE_SOURCE_ICON.getIcon());
} else {
cmp.setIcon(LOCAL_SOURCE_ICON.getIcon());
}
return cmp;
}
});
panel.annotationComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
annotationComboBoxActionPerformed(evt);
}
});
panel.browseAnnotationButton.setToolTipText("Browse local annotation file...");
panel.browseAnnotationButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
browseAnnotationButtonActionPerformed(evt);
}
});
}
use of javax.swing.ListCellRenderer in project freeplane by freeplane.
the class FilterConditionEditor method setValuesEditor.
private void setValuesEditor() {
final Object selectedProperty = filteredPropertiesComponent.getSelectedItem();
final IElementaryConditionController conditionController = filterController.getConditionFactory().getConditionController(selectedProperty);
final TranslatedObject selectedCondition = (TranslatedObject) elementaryConditions.getSelectedItem();
final boolean canSelectValues = conditionController.canSelectValues(selectedProperty, selectedCondition);
values.setEnabled(canSelectValues);
values.setEditable(false);
values.setModel(conditionController.getValuesForProperty(selectedProperty, selectedCondition));
final ComboBoxEditor valueEditor = conditionController.getValueEditor(selectedProperty, selectedCondition);
values.setEditor(valueEditor != null ? valueEditor : new FixedBasicComboBoxEditor());
setValuesEnterKeyListener();
final ListCellRenderer valueRenderer = conditionController.getValueRenderer(selectedProperty, selectedCondition);
values.setRenderer(valueRenderer != null ? valueRenderer : filterController.getConditionRenderer());
values.setEditable(conditionController.canEditValues(selectedProperty, selectedCondition));
if (values.getModel().getSize() > 0) {
values.setSelectedIndex(0);
}
caseSensitive.setEnabled(canSelectValues && conditionController.isCaseDependent(selectedProperty, selectedCondition));
approximateMatching.setEnabled(canSelectValues && conditionController.supportsApproximateMatching(selectedProperty, selectedCondition));
}
use of javax.swing.ListCellRenderer in project opennars by opennars.
the class TestbedSidePanel method initComponents.
public void initComponents() {
setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
TestbedSettings settings = model.getSettings();
JPanel top = new JPanel();
top.setLayout(new GridLayout(0, 1));
top.setBorder(BorderFactory.createCompoundBorder(new EtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(10, 10, 10, 10)));
tests = new JComboBox(model.getComboModel());
tests.setMaximumRowCount(30);
tests.setMaximumSize(new Dimension(250, 20));
tests.addActionListener(this);
tests.setRenderer(new ListCellRenderer() {
JLabel categoryLabel = null;
JLabel testLabel = null;
@Override
public Component getListCellRendererComponent(JList list, Object ovalue, int index, boolean isSelected, boolean cellHasFocus) {
ListItem value = (ListItem) ovalue;
if (value.isCategory()) {
if (categoryLabel == null) {
categoryLabel = new JLabel();
categoryLabel.setOpaque(true);
categoryLabel.setBackground(new Color(.5f, .5f, .6f));
categoryLabel.setForeground(Color.white);
categoryLabel.setHorizontalAlignment(SwingConstants.CENTER);
categoryLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
}
categoryLabel.setText(value.category);
return categoryLabel;
} else {
if (testLabel == null) {
testLabel = new JLabel();
testLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 1, 0));
}
testLabel.setText(value.test.getTestName());
if (isSelected) {
testLabel.setBackground(list.getSelectionBackground());
testLabel.setForeground(list.getSelectionForeground());
} else {
testLabel.setBackground(list.getBackground());
testLabel.setForeground(list.getForeground());
}
return testLabel;
}
}
});
top.add(new JLabel("Choose a test:"));
top.add(tests);
addSettings(top, settings, SettingType.DRAWING);
add(top, "North");
JPanel middle = new JPanel();
middle.setLayout(new GridLayout(0, 1));
middle.setBorder(BorderFactory.createCompoundBorder(new EtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5, 10, 5, 10)));
addSettings(middle, settings, SettingType.ENGINE);
add(middle, "Center");
pauseButton.setAlignmentX(CENTER_ALIGNMENT);
stepButton.setAlignmentX(CENTER_ALIGNMENT);
resetButton.setAlignmentX(CENTER_ALIGNMENT);
saveButton.setAlignmentX(CENTER_ALIGNMENT);
loadButton.setAlignmentX(CENTER_ALIGNMENT);
quitButton.setAlignmentX(CENTER_ALIGNMENT);
Box buttonGroups = Box.createHorizontalBox();
JPanel buttons1 = new JPanel();
buttons1.setLayout(new GridLayout(0, 1));
buttons1.add(resetButton);
JPanel buttons2 = new JPanel();
buttons2.setLayout(new GridLayout(0, 1));
buttons2.add(pauseButton);
buttons2.add(stepButton);
JPanel buttons3 = new JPanel();
buttons3.setLayout(new GridLayout(0, 1));
buttons3.add(saveButton);
buttons3.add(loadButton);
buttons3.add(quitButton);
buttonGroups.add(buttons1);
buttonGroups.add(buttons2);
buttonGroups.add(buttons3);
add(buttonGroups, "South");
}
use of javax.swing.ListCellRenderer in project lar_361 by comitsrl.
the class PosPayment method init.
private void init() {
Font font = AdempierePLAF.getFont_Field().deriveFont(18f);
// North
CPanel mainPanel = new CPanel(new MigLayout("hidemode 3", "[100:100:300, trailing]20[200:200:300,grow, trailing]"));
getContentPane().add(mainPanel);
mainPanel.setBorder(new TitledBorder(Msg.translate(p_ctx, "Payment")));
CLabel gtLabel = new CLabel(Msg.translate(p_ctx, "GrandTotal"));
mainPanel.add(gtLabel, "growx");
mainPanel.add(fTotal, "wrap, growx");
fTotal.setEditable(false);
fTotal.setFont(font);
fTotal.setHorizontalAlignment(JTextField.TRAILING);
mainPanel.add(new CLabel(Msg.translate(p_ctx, "Balance")), "growx");
mainPanel.add(fBalance, "wrap, growx");
fBalance.setEditable(false);
fBalance.setFont(font);
fBalance.setHorizontalAlignment(JTextField.TRAILING);
mainPanel.add(new CLabel(Msg.translate(p_ctx, "TenderType"), "growx"));
// Payment type selection
// C_Payment_v.TenderType
int AD_Column_ID = 8416;
MLookup lookup = MLookupFactory.get(Env.getCtx(), 0, 0, AD_Column_ID, DisplayType.List);
ArrayList<Object> types = lookup.getData(true, false, true, true);
DefaultComboBoxModel typeModel = new DefaultComboBoxModel(types.toArray());
tenderTypePick.setModel(typeModel);
// default to cash payment
for (Object obj : types) {
if (obj instanceof ValueNamePair) {
ValueNamePair key = (ValueNamePair) obj;
if (key.getID().equals("X")) {
// Cash
tenderTypePick.setSelectedItem(key);
}
if (!"CDKXT".contains(key.getID())) {
tenderTypePick.removeItem(key);
}
if (key.getID().equals("T")) {
// Account
accountKey = key;
}
}
}
tenderTypePick.setFont(font);
tenderTypePick.addActionListener(this);
// red1 for ID purpuse during testing
tenderTypePick.setName("tenderTypePick");
tenderTypePick.setRenderer(new ListCellRenderer() {
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setPreferredSize(new Dimension(50, 50));
renderer.setHorizontalAlignment(JLabel.CENTER);
return renderer;
}
});
mainPanel.add(tenderTypePick, "wrap, h 50!, growx");
/**
* Load Payment Terms
*/
String sql = "SELECT C_PaymentTerm_ID, Name " + " FROM C_PaymentTerm " + " WHERE IsActive='Y' AND AD_Client_ID=? ORDER BY Name";
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, Env.getAD_Client_ID(p_ctx));
rs = pstmt.executeQuery();
while (rs.next()) {
int key = rs.getInt(1);
String name = rs.getString(2);
KeyNamePair pp = new KeyNamePair(key, name);
fCPaymentTerm.addItem(pp);
}
} catch (SQLException e) {
log.log(Level.SEVERE, sql, e);
} finally {
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
fCPaymentTerm.setFont(font);
lCPaymentTerm = new CLabel(Msg.translate(p_ctx, "PaymentTerms"));
mainPanel.add(lCPaymentTerm, "growx");
mainPanel.add(fCPaymentTerm, "wrap, h 50!, growx");
fPayAmt = new PosTextField(Msg.translate(p_ctx, "PayAmt"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), DisplayType.getNumberFormat(DisplayType.Amount));
lPayAmt = new CLabel(Msg.translate(p_ctx, "PayAmt"));
mainPanel.add(lPayAmt, "growx");
fPayAmt.setFont(font);
fPayAmt.setEditable(false);
fPayAmt.setHorizontalAlignment(JTextField.TRAILING);
fPayAmt.addActionListener(this);
mainPanel.add(fPayAmt, "wrap, growx");
fTenderAmt = new PosTextField(Msg.translate(p_ctx, "AmountTendered"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), DisplayType.getNumberFormat(DisplayType.Amount));
lTenderAmt = new CLabel(Msg.translate(p_ctx, "AmountTendered"));
mainPanel.add(lTenderAmt, "growx");
fTenderAmt.addActionListener(this);
fTenderAmt.setFont(font);
fTenderAmt.setHorizontalAlignment(JTextField.TRAILING);
mainPanel.add(fTenderAmt, "wrap, growx");
fReturnAmt = new PosTextField(Msg.translate(p_ctx, "AmountReturned"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), DisplayType.getNumberFormat(DisplayType.Amount));
lReturnAmt = new CLabel(Msg.translate(p_ctx, "AmountReturned"));
mainPanel.add(lReturnAmt, "growx");
fReturnAmt.setFont(font);
fReturnAmt.setHorizontalAlignment(JTextField.TRAILING);
mainPanel.add(fReturnAmt, "wrap, growx");
fReturnAmt.setEditable(false);
fCheckRouteNo = new PosTextField(Msg.translate(p_ctx, "RoutingNo"), p_posPanel, p_pos.getOSNP_KeyLayout_ID());
lCheckRouteNo = new CLabel(Msg.translate(p_ctx, "RoutingNo"));
mainPanel.add(lCheckRouteNo, "growx");
mainPanel.add(fCheckRouteNo, "wrap, growx");
fCheckRouteNo.setFont(font);
fCheckRouteNo.setHorizontalAlignment(JTextField.TRAILING);
fCheckAccountNo = new PosTextField(Msg.translate(p_ctx, "AccountNo"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
lCheckAccountNo = new CLabel(Msg.translate(p_ctx, "AccountNo"));
mainPanel.add(lCheckAccountNo, "growx");
mainPanel.add(fCheckAccountNo, "wrap, growx");
fCheckAccountNo.setFont(font);
fCheckAccountNo.setHorizontalAlignment(JTextField.TRAILING);
fCheckNo = new PosTextField(Msg.translate(p_ctx, "CheckNo"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
lCheckNo = new CLabel(Msg.translate(p_ctx, "CheckNo"));
mainPanel.add(lCheckNo, "growx");
mainPanel.add(fCheckNo, "wrap, growx");
fCheckNo.setFont(font);
fCheckNo.setHorizontalAlignment(JTextField.TRAILING);
fCheckAccountName = new PosTextField(Msg.translate(p_ctx, "A_Name"), p_posPanel, p_pos.getOSNP_KeyLayout_ID());
lCheckAccountName = new CLabel(Msg.translate(p_ctx, "A_Name"));
mainPanel.add(lCheckAccountName, "growx");
mainPanel.add(fCheckAccountName, "wrap, growx");
fCheckAccountName.setFont(font);
fCheckAccountName.setHorizontalAlignment(JTextField.TRAILING);
/**
* Load Credit Cards
*/
ValueNamePair[] ccs = p_order.getCreditCards((BigDecimal) fPayAmt.getValue());
// Set Selection
fCCardType = new CComboBox(ccs);
// red1 Id for testing
fCCardType.setName("cardType");
fCCardType.setRenderer(new ListCellRenderer() {
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setPreferredSize(new Dimension(50, 50));
renderer.setHorizontalAlignment(JLabel.CENTER);
return renderer;
}
});
lCCardType = new CLabel(Msg.translate(p_ctx, "CreditCardType"));
mainPanel.add(lCCardType, "growx");
mainPanel.add(fCCardType, "h 50, wrap, growx");
fCCardType.setFont(font);
fCCardNo = new PosTextField(Msg.translate(p_ctx, "CreditCardNumber"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
lCCardNo = new CLabel(Msg.translate(p_ctx, "CreditCardNumber"));
fCCardNo.setName("cardNo");
mainPanel.add(lCCardNo, "growx");
mainPanel.add(fCCardNo, "wrap, growx");
fCCardNo.setFont(font);
fCCardNo.setHorizontalAlignment(JTextField.TRAILING);
fCCardName = new PosTextField(Msg.translate(p_ctx, "Name"), p_posPanel, p_pos.getOSK_KeyLayout_ID());
lCCardName = new CLabel(Msg.translate(p_ctx, "Name"));
mainPanel.add(lCCardName, "growx");
mainPanel.add(fCCardName, "wrap, growx");
fCCardName.setFont(font);
fCCardName.setHorizontalAlignment(JTextField.TRAILING);
fCCardMonth = new PosTextField(Msg.translate(p_ctx, "Expires"), p_posPanel, p_pos.getOSNP_KeyLayout_ID());
lCCardMonth = new CLabel(Msg.translate(p_ctx, "Expires"));
fCCardMonth.setName("expiry");
mainPanel.add(lCCardMonth, "growx");
mainPanel.add(fCCardMonth, "wrap, w 75!");
fCCardMonth.setFont(font);
fCCardMonth.setHorizontalAlignment(JTextField.TRAILING);
fCCardVC = new PosTextField(Msg.translate(p_ctx, "CVC"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
lCCardVC = new CLabel(Msg.translate(p_ctx, "CVC"));
mainPanel.add(lCCardVC, "growx");
mainPanel.add(fCCardVC, "wrap, w 75!");
fCCardVC.setFont(font);
fCCardVC.setHorizontalAlignment(JTextField.TRAILING);
fPrintShipment.setText("Imprimir Remito");
fPrintShipment.setSelected(true);
mainPanel.add(fPrintShipment, "skip, wrap, growx");
AppsAction actCancel = new AppsAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
actCancel.setDelegate(this);
f_bCancel = (CButton) actCancel.getButton();
f_bCancel.setFocusable(false);
mainPanel.add(f_bCancel, "h 50!, w 50!, skip, split 2, trailing");
AppsAction act = new AppsAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
act.setDelegate(this);
f_bProcess = (CButton) act.getButton();
f_bProcess.setFocusable(false);
mainPanel.add(f_bProcess, "h 50!, w 50!");
pack();
setTotals();
}
use of javax.swing.ListCellRenderer in project vcell by virtualcell.
the class OverlayEditorPanelJAI method initialize.
/**
* This method initializes this
*/
private void initialize() {
this.setSize(734, 710);
final GridBagLayout gridBagLayout_1 = new GridBagLayout();
gridBagLayout_1.rowWeights = new double[] { 0.0, 1.0, 0 };
gridBagLayout_1.columnWeights = new double[] { 1.0 };
gridBagLayout_1.rowHeights = new int[] { 0, 0, 0 };
this.setLayout(gridBagLayout_1);
editROIPanel = new JPanel();
final GridBagLayout gridBagLayout_2 = new GridBagLayout();
gridBagLayout_2.rowHeights = new int[] { 0, 0, 7 };
gridBagLayout_2.columnWidths = new int[] { 0, 7 };
editROIPanel.setLayout(gridBagLayout_2);
final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();
gridBagConstraints_6.anchor = GridBagConstraints.WEST;
gridBagConstraints_6.insets = new Insets(2, 2, 5, 2);
gridBagConstraints_6.weightx = 1.0;
gridBagConstraints_6.gridy = 0;
gridBagConstraints_6.gridx = 0;
add(editROIPanel, gridBagConstraints_6);
final JLabel infoLabel = new JLabel();
infoLabel.setText("Data Info:");
final GridBagConstraints gridBagConstraints_12 = new GridBagConstraints();
gridBagConstraints_12.insets = new Insets(0, 0, 0, 4);
gridBagConstraints_12.anchor = GridBagConstraints.EAST;
gridBagConstraints_12.gridy = 0;
gridBagConstraints_12.gridx = 0;
editROIPanel.add(infoLabel, gridBagConstraints_12);
textLabel = new JLabel();
textLabel.setPreferredSize(new Dimension(500, 20));
textLabel.setMinimumSize(new Dimension(500, 20));
final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
gridBagConstraints_2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_2.weightx = 1;
gridBagConstraints_2.insets = new Insets(0, 2, 0, 0);
gridBagConstraints_2.anchor = GridBagConstraints.WEST;
gridBagConstraints_2.gridy = 0;
gridBagConstraints_2.gridx = 1;
gridBagConstraints_2.gridwidth = 2;
editROIPanel.add(textLabel, gridBagConstraints_2);
textLabel.setText("No FRAP DataSet loaded.");
autoCropButton = new JButton(new ImageIcon(getClass().getResource("/images/autoCrop.gif")));
autoCropButton.setName("roiAutoCropBtn");
autoCropButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
firePropertyChange(FRAP_DATA_AUTOCROP_PROPERTY, null, null);
}
});
clearROIbutton = new JButton(new ImageIcon(getClass().getResource("/images/clearROI.gif")));
clearROIbutton.setEnabled(false);
clearROIbutton.setName("clearROIBtn");
clearROIbutton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (roiComboBox.getItemCount() == 0) {
giveROIRequiredWarning("Clear Domain");
return;
}
firePropertyChange(FRAP_DATA_CLEARROI_PROPERTY, ((ROIMultiPaintManager.ComboboxROIName) roiComboBox.getSelectedItem()), null);
}
});
viewZLabel = new JLabel();
viewZLabel.setText("View Z:");
final GridBagConstraints gridBagConstraints_17 = new GridBagConstraints();
gridBagConstraints_17.insets = new Insets(0, 0, 0, 4);
gridBagConstraints_17.anchor = GridBagConstraints.EAST;
gridBagConstraints_17.gridy = 1;
gridBagConstraints_17.gridx = 0;
editROIPanel.add(viewZLabel, gridBagConstraints_17);
final JPanel panel_1 = new JPanel();
final GridBagLayout gridBagLayout_4 = new GridBagLayout();
gridBagLayout_4.columnWeights = new double[] { 1.0 };
gridBagLayout_4.columnWidths = new int[] { 7 };
panel_1.setLayout(gridBagLayout_4);
final GridBagConstraints gridBagConstraints_18 = new GridBagConstraints();
gridBagConstraints_18.anchor = GridBagConstraints.WEST;
gridBagConstraints_18.insets = new Insets(0, 2, 0, 0);
gridBagConstraints_18.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_18.weightx = 0;
gridBagConstraints_18.gridy = 1;
gridBagConstraints_18.gridx = 1;
editROIPanel.add(panel_1, gridBagConstraints_18);
final GridBagConstraints gridBagConstraints_19 = new GridBagConstraints();
gridBagConstraints_19.insets = new Insets(0, 0, 5, 0);
gridBagConstraints_19.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_19.anchor = GridBagConstraints.WEST;
gridBagConstraints_19.weightx = 1;
gridBagConstraints_19.gridy = 0;
gridBagConstraints_19.gridx = 0;
panel_1.add(getZSlider(), gridBagConstraints_19);
viewTLabel = new JLabel();
viewTLabel.setText("View Time:");
final GridBagConstraints gridBagConstraints_13 = new GridBagConstraints();
gridBagConstraints_13.insets = new Insets(0, 0, 0, 4);
gridBagConstraints_13.anchor = GridBagConstraints.EAST;
gridBagConstraints_13.gridy = 2;
gridBagConstraints_13.gridx = 0;
editROIPanel.add(viewTLabel, gridBagConstraints_13);
final JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
final GridBagConstraints gridBagConstraints_15 = new GridBagConstraints();
gridBagConstraints_15.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_15.weightx = 1;
gridBagConstraints_15.insets = new Insets(0, 0, 0, 0);
gridBagConstraints_15.anchor = GridBagConstraints.WEST;
gridBagConstraints_15.gridy = 0;
gridBagConstraints_15.gridx = 0;
panel.add(getTimeSlider(), gridBagConstraints_15);
final GridBagConstraints gridBagConstraints_14 = new GridBagConstraints();
gridBagConstraints_14.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_14.insets = new Insets(0, 2, 0, 0);
gridBagConstraints_14.anchor = GridBagConstraints.WEST;
gridBagConstraints_14.gridy = 2;
gridBagConstraints_14.gridx = 1;
editROIPanel.add(panel, gridBagConstraints_14);
final JPanel editROIButtonPanel = new JPanel();
final GridBagLayout gridBagLayout_3 = new GridBagLayout();
gridBagLayout_3.rowWeights = new double[] { 0.0, 1.0 };
gridBagLayout_3.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 };
gridBagLayout_3.columnWidths = new int[] { 0, 0, 7, 7, 0, 0 };
editROIButtonPanel.setLayout(gridBagLayout_3);
final GridBagConstraints gridBagConstraints_8 = new GridBagConstraints();
gridBagConstraints_8.gridwidth = 2;
gridBagConstraints_8.weightx = 0;
gridBagConstraints_8.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_8.insets = new Insets(0, 2, 0, 0);
gridBagConstraints_8.anchor = GridBagConstraints.WEST;
gridBagConstraints_8.gridy = 3;
gridBagConstraints_8.gridx = 0;
editROIPanel.add(editROIButtonPanel, gridBagConstraints_8);
panel_2 = new JPanel();
GridBagConstraints gbc_panel_2 = new GridBagConstraints();
gbc_panel_2.insets = new Insets(2, 2, 2, 2);
gbc_panel_2.weighty = 1.0;
gbc_panel_2.weightx = 1.0;
gbc_panel_2.fill = GridBagConstraints.BOTH;
gbc_panel_2.gridx = 0;
gbc_panel_2.gridy = 1;
add(panel_2, gbc_panel_2);
GridBagLayout gbl_panel_2 = new GridBagLayout();
gbl_panel_2.columnWidths = new int[] { 0, 0, 0 };
gbl_panel_2.rowHeights = new int[] { 0 };
gbl_panel_2.columnWeights = new double[] { 0, 1.0, 0.0 };
gbl_panel_2.rowWeights = new double[] { 0.0 };
panel_2.setLayout(gbl_panel_2);
panel_3 = new JPanel();
panel_3.setBorder(new LineBorder(new Color(0, 0, 0)));
GridBagConstraints gbc_panel_3 = new GridBagConstraints();
gbc_panel_3.fill = GridBagConstraints.BOTH;
gbc_panel_3.insets = new Insets(2, 2, 2, 2);
gbc_panel_3.gridx = 0;
gbc_panel_3.gridy = 0;
panel_2.add(panel_3, gbc_panel_3);
GridBagLayout gbl_panel_3 = new GridBagLayout();
gbl_panel_3.columnWidths = new int[] { 0, 0 };
gbl_panel_3.rowHeights = new int[] { 0, 0, 0, 0 };
gbl_panel_3.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
gbl_panel_3.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
panel_3.setLayout(gbl_panel_3);
domainRegionLabel = new JLabel(DOMAIN_LIST_TEXT);
GridBagConstraints gbc_domainRegionLabel = new GridBagConstraints();
gbc_domainRegionLabel.insets = new Insets(0, 0, 2, 0);
gbc_domainRegionLabel.gridx = 0;
gbc_domainRegionLabel.gridy = 0;
panel_3.add(domainRegionLabel, gbc_domainRegionLabel);
scrollPane = new JScrollPane();
GridBagConstraints gbc_scrollPane = new GridBagConstraints();
gbc_scrollPane.insets = new Insets(0, 2, 0, 0);
gbc_scrollPane.weighty = 1.0;
gbc_scrollPane.fill = GridBagConstraints.BOTH;
gbc_scrollPane.gridx = 0;
gbc_scrollPane.gridy = 1;
panel_3.add(scrollPane, gbc_scrollPane);
scrollPane.setPreferredSize(new Dimension(125, 10));
scrollPane.setMinimumSize(new Dimension(125, 10));
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
resolvedList = new JList();
resolvedList.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
if (showConvertPopup(e, false) == SHOWCONVERT.HANDLED) {
return;
}
if (e.getClickCount() == 2) {
firePropertyChange(FRAP_DATA_FINDROI_PROPERTY, null, resolvedList.getSelectedValue());
}
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
super.mousePressed(e);
if (showConvertPopup(e, false) == SHOWCONVERT.HANDLED) {
return;
}
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
super.mouseReleased(e);
if (showConvertPopup(e, false) == SHOWCONVERT.HANDLED) {
return;
}
}
});
resolvedList.addListSelectionListener(resolvedListSelectionListener);
resolvedList.setCellRenderer(resolvedObjectListCellRenderer);
scrollPane.setViewportView(resolvedList);
mergeButton = new JButton("Auto-Merge");
mergeButton.setToolTipText("Remove regions by merging with neighbor");
mergeButton.setEnabled(false);
mergeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
resolvedListSelection(true);
}
});
GridBagConstraints gbc_mergeButton = new GridBagConstraints();
gbc_mergeButton.gridx = 0;
gbc_mergeButton.gridy = 2;
panel_3.add(mergeButton, gbc_mergeButton);
GridBagConstraints gbc_jScrollPane2 = new GridBagConstraints();
gbc_jScrollPane2.weighty = 1.0;
gbc_jScrollPane2.weightx = 1.0;
gbc_jScrollPane2.fill = GridBagConstraints.BOTH;
gbc_jScrollPane2.insets = new Insets(2, 2, 2, 2);
gbc_jScrollPane2.gridx = 1;
gbc_jScrollPane2.gridy = 0;
panel_2.add(getJScrollPane2(), gbc_jScrollPane2);
GridBagConstraints gbc_toolButtonPanel = new GridBagConstraints();
gbc_toolButtonPanel.weighty = 1.0;
gbc_toolButtonPanel.insets = new Insets(2, 2, 0, 2);
gbc_toolButtonPanel.anchor = GridBagConstraints.NORTH;
gbc_toolButtonPanel.gridx = 2;
gbc_toolButtonPanel.gridy = 0;
panel_2.add(getToolButtonPanel(), gbc_toolButtonPanel);
roiComboBox = new JComboBox();
roiComboBox.setName("activeROIComboBox");
roiComboBox.setRenderer(new ListCellRenderer() {
private DefaultListCellRenderer listCellRender = new DefaultListCellRenderer();
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
ROIMultiPaintManager.ComboboxROIName comboboxROIName = (ROIMultiPaintManager.ComboboxROIName) value;
if (comboboxROIName == null) {
// return blank
return listCellRender.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
}
if (comboboxROIName.getHighlightColor() == null) {
// return text only
return listCellRender.getListCellRendererComponent(list, comboboxROIName.getROIName(), index, isSelected, cellHasFocus);
}
// return text with small color box
Icon icon = new ColorIcon(20, 20, comboboxROIName.getHighlightColor());
JLabel jlable = (JLabel) listCellRender.getListCellRendererComponent(list, icon, index, isSelected, cellHasFocus);
jlable.setText(comboboxROIName.getROIName());
return jlable;
}
});
roiComboBox.addActionListener(ROI_COMBOBOX_ACTIONLISTENER);
lblNewLabel = new JLabel("Active Domain:");
GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
gbc_lblNewLabel.insets = new Insets(4, 4, 4, 4);
gbc_lblNewLabel.anchor = GridBagConstraints.EAST;
gbc_lblNewLabel.gridx = 0;
gbc_lblNewLabel.gridy = 0;
editROIButtonPanel.add(lblNewLabel, gbc_lblNewLabel);
final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
gridBagConstraints_1.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_1.insets = new Insets(4, 4, 5, 5);
gridBagConstraints_1.weightx = 1;
gridBagConstraints_1.gridy = 0;
gridBagConstraints_1.gridx = 1;
editROIButtonPanel.add(roiComboBox, gridBagConstraints_1);
addROIButton = new JButton();
addROIButton.setName("roiAddBtn");
addROIButton.addActionListener(addROIActionListener);
addROIButton.setText("Add Domain...");
final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();
gridBagConstraints_3.insets = new Insets(4, 4, 5, 5);
gridBagConstraints_3.gridy = 0;
gridBagConstraints_3.gridx = 2;
editROIButtonPanel.add(addROIButton, gridBagConstraints_3);
delROIButton = new JButton();
delROIButton.setName("roiDeleteBtn");
delROIButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
firePropertyChange(FRAP_DATA_DELETEROI_PROPERTY, ((ROIMultiPaintManager.ComboboxROIName) roiComboBox.getSelectedItem()), null);
}
});
delROIButton.setText("Delete Domain...");
delROIButton.setEnabled(false);
final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
gridBagConstraints_4.insets = new Insets(4, 4, 5, 5);
gridBagConstraints_4.gridy = 0;
gridBagConstraints_4.gridx = 3;
editROIButtonPanel.add(delROIButton, gridBagConstraints_4);
discardHighlightsButton = new JButton("Clear Selections");
discardHighlightsButton.setEnabled(false);
discardHighlightsButton.setName("clearHighlightsBtn");
discardHighlightsButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
firePropertyChange(FRAP_DATA_DISCARDHIGHLIGHT_PROPERTY, null, null);
}
});
GridBagConstraints gbc_specialActionsButton = new GridBagConstraints();
gbc_specialActionsButton.insets = new Insets(4, 4, 5, 5);
gbc_specialActionsButton.gridx = 4;
gbc_specialActionsButton.gridy = 0;
editROIButtonPanel.add(discardHighlightsButton, gbc_specialActionsButton);
channelComboBox = new JComboBox();
GridBagConstraints gbc_channelComboBox = new GridBagConstraints();
gbc_channelComboBox.insets = new Insets(4, 4, 5, 4);
gbc_channelComboBox.gridx = 5;
gbc_channelComboBox.gridy = 0;
editROIButtonPanel.add(channelComboBox, gbc_channelComboBox);
channelComboBox.addActionListener(channelActionListener);
channelComboBox.setPreferredSize(new Dimension(100, 22));
channelComboBox.setMinimumSize(new Dimension(100, 20));
blendPercentPanel = new JPanel();
blendPercentPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
GridBagConstraints gbc_panel_2a = new GridBagConstraints();
gbc_panel_2a.gridwidth = 6;
gbc_panel_2a.insets = new Insets(4, 4, 4, 4);
gbc_panel_2a.fill = GridBagConstraints.BOTH;
gbc_panel_2a.gridx = 0;
gbc_panel_2a.gridy = 1;
editROIButtonPanel.add(blendPercentPanel, gbc_panel_2a);
GridBagLayout gbl_panel_2a = new GridBagLayout();
blendPercentPanel.setLayout(gbl_panel_2a);
blendPercentROILabel = new JLabel("Domains");
GridBagConstraints gbc_blendPercentROILabel = new GridBagConstraints();
gbc_blendPercentROILabel.anchor = GridBagConstraints.WEST;
gbc_blendPercentROILabel.gridx = 0;
gbc_blendPercentROILabel.gridy = 0;
blendPercentPanel.add(blendPercentROILabel, gbc_blendPercentROILabel);
blendPercentSlider = new JSlider();
blendPercentSlider.setToolTipText("Mix view of Domains and background image");
blendPercentSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
setBlendPercent(blendPercentSlider.getValue());
// if(!blendPercentSlider.getValueIsAdjusting()){
// setBlendPercent(blendPercentSlider.getValue());
// }
}
});
GridBagConstraints gbc_blendPercentSlider = new GridBagConstraints();
gbc_blendPercentSlider.fill = GridBagConstraints.HORIZONTAL;
gbc_blendPercentSlider.weightx = 0.5;
gbc_blendPercentSlider.gridx = 1;
gbc_blendPercentSlider.gridy = 0;
blendPercentPanel.add(blendPercentSlider, gbc_blendPercentSlider);
blendPercentImageLabel = new JLabel("Image");
GridBagConstraints gbc_blendPercentImageLabel = new GridBagConstraints();
gbc_blendPercentImageLabel.anchor = GridBagConstraints.EAST;
gbc_blendPercentImageLabel.gridx = 2;
gbc_blendPercentImageLabel.gridy = 0;
blendPercentPanel.add(blendPercentImageLabel, gbc_blendPercentImageLabel);
smoothOrigLabel = new JLabel("Original");
GridBagConstraints gbc_smoothOrigLabel = new GridBagConstraints();
gbc_smoothOrigLabel.insets = new Insets(0, 20, 0, 0);
gbc_smoothOrigLabel.gridx = 3;
gbc_smoothOrigLabel.gridy = 0;
blendPercentPanel.add(smoothOrigLabel, gbc_smoothOrigLabel);
smoothslider = new JSlider();
smoothslider.setToolTipText("Smooth background image");
smoothslider.setSnapToTicks(true);
smoothslider.setPaintTicks(true);
smoothslider.setMajorTickSpacing(1);
smoothslider.setMaximum(10);
smoothslider.setValue(0);
smoothslider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
if (!smoothslider.getValueIsAdjusting()) {
firePropertyChange(FRAP_DATA_UNDERLAY_SMOOTH_PROPERTY, null, new Integer(smoothslider.getValue()));
}
}
});
GridBagConstraints gbc_smoothslider = new GridBagConstraints();
gbc_smoothslider.fill = GridBagConstraints.HORIZONTAL;
gbc_smoothslider.weightx = 0.5;
gbc_smoothslider.gridx = 4;
gbc_smoothslider.gridy = 0;
blendPercentPanel.add(smoothslider, gbc_smoothslider);
smootherLabel = new JLabel("Smoother");
GridBagConstraints gbc_smootherLabel = new GridBagConstraints();
gbc_smootherLabel.gridx = 5;
gbc_smootherLabel.gridy = 0;
blendPercentPanel.add(smootherLabel, gbc_smootherLabel);
roiDrawButtonGroup.add(selectButton);
roiDrawButtonGroup.add(paintButton);
roiDrawButtonGroup.add(eraseButton);
roiDrawButtonGroup.add(fillButton);
roiDrawButtonGroup.add(cropButton);
roiDrawButtonGroup.add(translateToolButton);
roiDrawButtonGroup.add(scaleToolButton);
BeanUtils.enableComponents(getToolButtonPanel(), false);
BeanUtils.enableComponents(editROIPanel, false);
histogramPanel = new HistogramPanel();
histogramPanel.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(HistogramPanel.HISTOGRAM_SELECT_PROPERTY)) {
OverlayEditorPanelJAI.this.firePropertyChange(OverlayEditorPanelJAI.FRAP_DATA_HISTOUPDATEHIGHLIGHT_PROPERTY, null, (ListSelectionModel) evt.getNewValue());
} else if (evt.getPropertyName().equals(HistogramPanel.HISTOGRAM_APPLY_ACTION)) {
firePropertyChange(OverlayEditorPanelJAI.FRAP_DATA_UPDATEROI_WITHHIGHLIGHT_PROPERTY, null, null);
}
}
});
histogramPanel.setVisible(false);
histogramPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
GridBagConstraints gbc_histogramButton = new GridBagConstraints();
gbc_histogramButton.fill = GridBagConstraints.BOTH;
gbc_histogramButton.insets = new Insets(2, 2, 2, 2);
gbc_histogramButton.gridx = 0;
gbc_histogramButton.gridy = 2;
add(histogramPanel, gbc_histogramButton);
}
Aggregations