use of javax.swing.JRadioButton in project EnrichmentMapApp by BaderLab.
the class PostAnalysisInputPanel method getKnownSignatureRadio.
JRadioButton getKnownSignatureRadio() {
if (knownSignatureRadio == null) {
knownSignatureRadio = new JRadioButton("Known Signature");
knownSignatureRadio.setSelected(true);
knownSignatureRadio.addActionListener(evt -> {
showInputPanel(getKnownSignaturePanel());
});
}
return knownSignatureRadio;
}
use of javax.swing.JRadioButton in project EnrichmentMapApp by BaderLab.
the class PostAnalysisInputPanel method getSignatureDiscoveryRadio.
JRadioButton getSignatureDiscoveryRadio() {
if (signatureDiscoveryRadio == null) {
signatureDiscoveryRadio = new JRadioButton("Signature Discovery");
signatureDiscoveryRadio.addActionListener(evt -> {
showInputPanel(getSignatureDiscoveryPanel());
});
}
return signatureDiscoveryRadio;
}
use of javax.swing.JRadioButton in project adempiere by adempiere.
the class PreviewPanel method setupPreview.
/**
* Create the preview UI components
*/
private void setupPreview() {
JRootPane rootPane = new JRootPane();
previewPanel.setLayout(new BorderLayout());
previewPanel.add(rootPane, BorderLayout.CENTER);
previewPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
GridLayout gridLayout = new GridLayout(1, 3);
gridLayout.setHgap(4);
rootPane.getContentPane().setLayout(gridLayout);
rootPane.setGlassPane(new GlassPane());
rootPane.getGlassPane().setVisible(true);
CPanel column1 = new CPanel();
rootPane.getContentPane().add(column1);
CPanel column2 = new CPanel();
rootPane.getContentPane().add(column2);
CPanel column3 = new CPanel();
rootPane.getContentPane().add(column3);
column1.setLayout(new GridBagLayout());
JTree jtree = new JTree();
jtree.setFocusable(false);
jtree.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
column1.add(jtree, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 2), 0, 0));
CTextField normal = new CTextField("Text Field");
normal.setFocusable(false);
column1.add(normal, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 5, 2), 0, 0));
error.setBackground(true);
error.setFocusable(false);
column1.add(error, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column2.setLayout(new GridBagLayout());
JTable jtable = new JTable(s_data, s_columns);
JScrollPane scrollPane = new JScrollPane(jtable);
jtable.setFocusable(false);
scrollPane.setPreferredSize(jtable.getPreferredSize());
column2.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 2), 0, 0));
mandatory.setMandatory(true);
mandatory.setFocusable(false);
column2.add(mandatory, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CTextField inactive = new CTextField(s_res.getString("Inactive"));
inactive.setEnabled(false);
column2.add(inactive, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column3.setLayout(new GridBagLayout());
CTabbedPane tab = new CTabbedPane();
column3.add(tab, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 5), 0, 0));
CComboBox editable = new CComboBox(new Object[] { "Editable" });
editable.setEditable(true);
editable.setFocusable(false);
column3.add(editable, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CComboBox choice = new CComboBox(new Object[] { "Choice" });
choice.setEditable(false);
choice.setFocusable(false);
column3.add(choice, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 5), 0, 0));
tabPage1.setLayout(new BoxLayout(tabPage1, BoxLayout.Y_AXIS));
JRadioButton radio = new JRadioButton("Radio");
radio.setSelected(true);
radio.setMargin(new Insets(5, 5, 5, 5));
radio.setFocusable(false);
radio.setOpaque(false);
tabPage1.add(radio);
CCheckBox checkBox = new CCheckBox("Checkbox");
checkBox.setSelected(true);
checkBox.setMargin(new Insets(5, 5, 5, 5));
checkBox.setFocusable(false);
tabPage1.add(checkBox);
CLabel label = new CLabel("Label");
label.setHorizontalAlignment(JLabel.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
tabPage1.add(label);
button.setMargin(new Insets(5, 5, 5, 5));
button.setFocusable(false);
tabPage1.add(button);
tab.add(tabPage1, "tab1");
tab.add(new CPanel(), "tab2");
}
use of javax.swing.JRadioButton in project adempiere by adempiere.
the class VBOMDrop method actionPerformed.
// getPreferredSize
/**************************************************************************
* Action Listener
* @param e event
*/
public void actionPerformed(ActionEvent e) {
log.config(e.getActionCommand());
Object source = e.getSource();
// Toggle Qty Enabled
if (source instanceof JCheckBox || source instanceof JRadioButton) {
cmd_selection(source);
// need to de-select the others in group
if (source instanceof JRadioButton) {
// find Button Group
Iterator it = m_buttonGroups.values().iterator();
while (it.hasNext()) {
ButtonGroup group = (ButtonGroup) it.next();
Enumeration en = group.getElements();
while (en.hasMoreElements()) {
// We found the group
if (source == en.nextElement()) {
Enumeration info = group.getElements();
while (info.hasMoreElements()) {
Object infoObj = info.nextElement();
if (source != infoObj)
cmd_selection(infoObj);
}
}
}
}
}
} else // Product / Qty
if (source == productField || source == productQty) {
m_qty = (BigDecimal) productQty.getValue();
KeyNamePair pp = (KeyNamePair) productField.getSelectedItem();
m_product = MProduct.get(Env.getCtx(), pp.getKey());
createMainPanel();
sizeIt();
} else // Order
if (source == orderField) {
KeyNamePair pp = (KeyNamePair) orderField.getSelectedItem();
boolean valid = (pp != null && pp.getKey() > 0);
//
if (invoiceField != null)
invoiceField.setReadWrite(!valid);
if (projectField != null)
projectField.setReadWrite(!valid);
} else // Invoice
if (source == invoiceField) {
KeyNamePair pp = (KeyNamePair) invoiceField.getSelectedItem();
boolean valid = (pp != null && pp.getKey() > 0);
//
if (orderField != null)
orderField.setReadWrite(!valid);
if (projectField != null)
projectField.setReadWrite(!valid);
} else // Project
if (source == projectField) {
KeyNamePair pp = (KeyNamePair) projectField.getSelectedItem();
boolean valid = (pp != null && pp.getKey() > 0);
//
if (orderField != null)
orderField.setReadWrite(!valid);
if (invoiceField != null)
invoiceField.setReadWrite(!valid);
} else // OK
if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
if (cmd_save())
dispose();
} else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
dispose();
// Enable OK
boolean OK = m_product != null;
if (OK) {
KeyNamePair pp = null;
if (orderField != null)
pp = (KeyNamePair) orderField.getSelectedItem();
if ((pp == null || pp.getKey() <= 0) && invoiceField != null)
pp = (KeyNamePair) invoiceField.getSelectedItem();
if ((pp == null || pp.getKey() <= 0) && projectField != null)
pp = (KeyNamePair) projectField.getSelectedItem();
OK = (pp != null && pp.getKey() > 0);
}
confirmPanel.getOKButton().setEnabled(OK);
}
use of javax.swing.JRadioButton in project adempiere by adempiere.
the class VBOMDrop method addDisplay.
// addBOMLine
/**
* Add Line to Display
* @param parentM_Product_ID parent product
* @param M_Product_ID product
* @param bomType bom type
* @param name name
* @param lineQty qty
*/
private void addDisplay(int parentM_Product_ID, int M_Product_ID, String bomType, String name, String feature, BigDecimal lineQty) {
log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",feature=" + feature + ",Qty=" + lineQty);
//
boolean selected = true;
if (MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType)) {
String title = "";
JCheckBox cb = new JCheckBox(title);
cb.setSelected(true);
cb.setEnabled(false);
// cb.addActionListener(this); // will not change
m_selectionList.add(cb);
this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
} else if (MPPProductBOMLine.COMPONENTTYPE_Option.equals(bomType)) {
//String title = Msg.getMsg(Env.getCtx(), "Optional");
JCheckBox cb = new JCheckBox(feature);
cb.setSelected(false);
selected = false;
cb.addActionListener(this);
m_selectionList.add(cb);
this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
} else if (MPPProductBOMLine.COMPONENTTYPE_Variant.equals(bomType)) {
//String title = Msg.getMsg(Env.getCtx(), "Variant") + " " + bomType;
JRadioButton b = new JRadioButton(feature);
String groupName = feature + "_" + String.valueOf(parentM_Product_ID) + "_" + bomType;
ButtonGroup group = (ButtonGroup) m_buttonGroups.get(groupName);
if (group == null) {
log.fine("ButtonGroup=" + groupName);
group = new ButtonGroup();
m_buttonGroups.put(groupName, group);
group.add(b);
// select first one
b.setSelected(true);
} else {
group.add(b);
b.setSelected(false);
selected = false;
}
b.addActionListener(this);
m_selectionList.add(b);
this.add(b, new ALayoutConstraint(m_bomLine++, 0));
}
// Add to List & display
m_productList.add(new Integer(M_Product_ID));
VNumber qty = new VNumber("Qty", true, false, true, DisplayType.Quantity, name);
qty.setValue(lineQty);
qty.setReadWrite(selected);
m_qtyList.add(qty);
CLabel label = new CLabel(name);
label.setLabelFor(qty);
this.add(label);
this.add(qty);
}
Aggregations