下面列出了javax.swing.JRadioButton#setToolTipText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private JComponent createColorPanel()
{
m_colorBox = Box.createVerticalBox();
ButtonGroup group = new ButtonGroup();
m_black = new JRadioButton(i18n("LB_BLACK"));
m_black.setToolTipText(i18n("TT_ANALYZE_BLACK"));
m_black.setEnabled(false);
group.add(m_black);
m_colorBox.add(m_black);
m_white = new JRadioButton(i18n("LB_WHITE"));
m_white.setToolTipText(i18n("TT_ANALYZE_WHITE"));
m_white.setEnabled(false);
group.add(m_white);
m_colorBox.add(m_white);
return m_colorBox;
}
/**
* This method allows to add a component to this container. Hence the container provides radio
* buttons to toggle between components, it is needed to specify a name for the components and
* toolTips.
*
* @param selectionName
* is the name of the component
* @param component
* is the component to add
* @param toolTip
* is the tool tip of corresponding radio button
*/
public void addComponent(String selectionName, Component component, String toolTip) {
boolean isFirstButton = buttonComponentMap.size() == 0;
final JRadioButton selectionButton = new JRadioButton(selectionName, isFirstButton);
buttonComponentMap.put(selectionButton, component);
selectionButton.setToolTipText(toolTip);
selectionButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (selectionButton.isSelected()) {
remove(1);
add(buttonComponentMap.get(selectionButton), BorderLayout.CENTER);
repaint();
}
}
});
toggleButtons.add(selectionButton);
togglePanel.add(selectionButton);
if (isFirstButton) {
selectionButton.setSelected(true);
add(component, BorderLayout.CENTER);
}
}
private void fillMetrics(String[] metrics, JPanel panel) {
if (metrics != null) {
MetricActionListener listener = new MetricActionListener();
for (int i = 0; i < metrics.length / 2; i++) {
JRadioButton radio = new JRadioButton(metrics[2 * i]);
String action = metrics[2 * i];
if (action.endsWith(defaultMarker)) {
action = action.substring(0, action.length() - defaultMarker.length());
}
radio.setActionCommand(action);
radio.setToolTipText(metrics[2 * i + 1]);
radio.addActionListener(listener);
buttonGroupMetrics.add(radio);
panel.add(radio);
}
} else {
panel.add(new JLabel(" None..."));
}
}
@Override
public void createUI() {
final JRadioButton radioButton = new JRadioButton(label, (Boolean) value);
if (toolTipText != null) radioButton.setToolTipText(toolTipText);
UIComponent = radioButton;
setupValueChangeNotifications();
}
public static JRadioButton createRadioButton(String text, String toolTip) {
JRadioButton button = new JRadioButton();
Mnemonics.setLocalizedText(button, text);
button.setText(cutMnemonicAndAmpersand(text));
button.setToolTipText(toolTip);
return button;
}
/**
* Creates a new UI that provides means to configure
* the northbound Telemetry & Event API endpoint to connect to
* for receiving messages.
*/
public HonoReceiverSamplerUI() {
honoServerOptions = new ServerOptionsPanel("Telemetry & Event Endpoint");
tenant = new JLabeledTextField("Tenant");
container = new JLabeledTextField("Name");
endpoint = new JLabeledChoice("Endpoint",
Stream.of(HonoSampler.Endpoint.values()).map(HonoSampler.Endpoint::name).toArray(String[]::new));
endpoint.setToolTipText("<html>The name of the endpoint to send the AMQP message to.</html>");
useSenderTime = new JCheckBox("Use sender time");
senderTimeInProperty = new JRadioButton("Sender time in property");
senderTimeInProperty.setToolTipText("<html>If set, the sending time is retrieved from the message's application property <em>timeStamp</em>.</html>");
senderTimeInPayload = new JRadioButton("Sender time in JSON payload");
final ButtonGroup group = new ButtonGroup();
group.add(senderTimeInProperty);
group.add(senderTimeInPayload);
senderTimeInProperty.setSelected(true);
senderTimeVariableName = new JLabeledTextField("JSON value key");
senderTimeVariableName.setEnabled(false);
prefetch = new JLabeledTextField("Prefetch");
reconnectAttempts = new JLabeledTextField("Max reconnect attempts");
addOption(honoServerOptions);
addOption(tenant);
addOption(container);
addOption(getWrapperPanelToFixAlignment(endpoint));
addOption(prefetch);
addOption(reconnectAttempts);
addOption(createTimeStampPanel());
}
protected void addGlobalCache(int position, String prettyName, final InetAddress inetAddress, String tooltip) {
JRadioButton menuItem = new JRadioButton(prettyName);
menuItem.setToolTipText(tooltip);
globalCacheRadioButtons[position] = menuItem;
buttonGroup.add(menuItem);
globalCacheMenu.add(menuItem);
menuItem.setSelected(inetAddress.equals(globalCacheInetAddress));
menuItem.addActionListener((java.awt.event.ActionEvent evt) -> {
setGlobalCache(inetAddress);
});
}
/**
* Define the common part of the layout, each subclass being able to augment
* this layout from its constructor
*/
protected void defineLayout ()
{
// Buttons to select just the core glyphs, or the whole population
CoreAction coreAction = new CoreAction();
JRadioButton coreButton = new JRadioButton(coreAction);
WholeAction wholeAction = new WholeAction();
JRadioButton wholeButton = new JRadioButton(wholeAction);
// Group the radio buttons.
ButtonGroup group = new ButtonGroup();
group.add(wholeButton);
wholeButton.setToolTipText("Use the whole glyph base for any action");
group.add(coreButton);
coreButton.setToolTipText(
"Use only the core glyph base for any action");
wholeButton.setSelected(true);
// Evaluator Title & Progress Bar
int r = 1; // ----------------------------
String title = engine.getName() + " Training";
builder.addSeparator(title, cst.xyw(1, r, 7));
builder.add(progressBar, cst.xyw(9, r, 7));
r += 2; // ----------------------------
builder.add(wholeButton, cst.xy(3, r));
builder.add(wholeNumber, cst.xy(5, r));
r += 2; // ----------------------------
builder.add(coreButton, cst.xy(3, r));
builder.add(coreNumber, cst.xy(5, r));
// Initialize with population cardinalities
coreAction.actionPerformed(null);
wholeAction.actionPerformed(null);
}
public SizeEditor(){
GridBagLayout gridLayout = new GridBagLayout();
editorPane = new JPanel(gridLayout);
GridBagConstraints c = new GridBagConstraints();
perc = new JRadioButton("Percentage");
px = new JRadioButton("Pixel");
fill = new JRadioButton("*");
fill.setToolTipText("Wildcard, leave this value to layoutmanger");
fill.addActionListener(this);
px.addActionListener(this);
perc.addActionListener(this);
group = new ButtonGroup();
group.add(perc);
group.add(px);
group.add(fill);
px.setSelected(true);
c.gridx = 0;
c.anchor = GridBagConstraints.FIRST_LINE_START;
editorPane.add(perc,c);
c.gridx=1;
editorPane.add(percEditor,c);
c.gridx = 0;
c.gridy = 1;
editorPane.add(px,c);
c.gridx = 1;
c.gridy = 1;
editorPane.add(pxEditor,c);
c.gridx = 0;
c.gridy = 2;
editorPane.add(fill,c);
this.percEditor.setEnabled(false);
this.percEditor.setValue(SizeValue.percent(50));
this.pxEditor.setEnabled(true);
percEditor.addPropertyChangeListener(this);
pxEditor.addPropertyChangeListener(this);
}
private void fillUi(JPanel canvas) {
JLabel projectDataDirLabel = new JBLabel("Project data directory:");
canvas.setPreferredSize(ProjectViewUi.getContainerSize());
projectDataDirField = new TextFieldWithBrowseButton();
projectDataDirField.setName("project-data-dir-field");
projectDataDirField.addBrowseFolderListener(
"",
buildSystemName + " project data directory",
null,
PROJECT_FOLDER_DESCRIPTOR,
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
false);
final String dataDirToolTipText = "Directory in which to store the project's metadata.";
projectDataDirField.setToolTipText(dataDirToolTipText);
projectDataDirLabel.setToolTipText(dataDirToolTipText);
canvas.add(projectDataDirLabel, UiUtil.getLabelConstraints(0));
canvas.add(projectDataDirField, UiUtil.getFillLineConstraints(0));
JLabel projectNameLabel = new JLabel("Project name:");
projectNameField = new JTextField();
final String projectNameToolTipText = "Project display name.";
projectNameField.setToolTipText(projectNameToolTipText);
projectNameField.setName("project-name-field");
projectNameLabel.setToolTipText(projectNameToolTipText);
canvas.add(projectNameLabel, UiUtil.getLabelConstraints(0));
canvas.add(projectNameField, UiUtil.getFillLineConstraints(0));
JLabel defaultNameLabel = new JLabel("Infer name from:");
workspaceDefaultNameOption = new JRadioButton("Workspace");
branchDefaultNameOption = new JRadioButton("Branch");
importDirectoryDefaultNameOption = new JRadioButton("Import Directory");
workspaceDefaultNameOption.setToolTipText("Infer default name from the workspace name");
branchDefaultNameOption.setToolTipText(
"Infer default name from the current branch of your workspace");
importDirectoryDefaultNameOption.setToolTipText(
"Infer default name from the directory used to import your project view");
workspaceDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
branchDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
importDirectoryDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(workspaceDefaultNameOption);
buttonGroup.add(branchDefaultNameOption);
buttonGroup.add(importDirectoryDefaultNameOption);
canvas.add(defaultNameLabel, UiUtil.getLabelConstraints(0));
canvas.add(workspaceDefaultNameOption, UiUtil.getLabelConstraints(0));
canvas.add(branchDefaultNameOption, UiUtil.getLabelConstraints(0));
canvas.add(importDirectoryDefaultNameOption, UiUtil.getLabelConstraints(0));
canvas.add(new JPanel(), UiUtil.getFillLineConstraints(0));
projectViewUi.fillUi(canvas);
}
/**
* Build the user interface ready for display.
*/
private void initComponents()
{
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(2, 2, 2, 2);
GridBagLayout gridbag = new GridBagLayout();
setTitle(TITLE);
setLayout(gridbag);
// Data set selection row
Utility.buildConstraints(gbc, 0, 0, 1, 1, 0.0, 0.0);
JLabel dataSetLabel = new JLabel(LanguageBundle.getString("in_diDataSet"), SwingConstants.RIGHT);
gridbag.setConstraints(dataSetLabel, gbc);
add(dataSetLabel, gbc);
Utility.buildConstraints(gbc, 1, 0, 2, 1, 1.0, 0.0);
dataSetSel = new JTextField("", SwingConstants.WEST);
dataSetSel.setEditable(false);
gridbag.setConstraints(dataSetSel, gbc);
add(dataSetSel, gbc);
Utility.buildConstraints(gbc, 3, 0, 1, 1, 0.0, 0.0);
gbc.fill = GridBagConstraints.NONE;
selectButton = new JButton();
CommonMenuText.name(selectButton, "select"); //$NON-NLS-1$
gridbag.setConstraints(selectButton, gbc);
add(selectButton, gbc);
selectButton.addActionListener(listener);
// Data set details row
Utility.buildConstraints(gbc, 0, 1, 4, 1, 1.0, 1.0);
dataSetDetails = new JFXPanelFromResource<>(
SimpleHtmlPanelController.class,
"SimpleHtmlPanel.fxml"
);
dataSetDetails.setPreferredSize(new Dimension(400, 200));
dataSetDetails.setBackground(getBackground());
gbc.fill = GridBagConstraints.BOTH;
JScrollPane jScrollPane = new JScrollPane();
jScrollPane.setViewportView(dataSetDetails);
gridbag.setConstraints(jScrollPane, gbc);
add(jScrollPane, gbc);
// Location row
Utility.buildConstraints(gbc, 0, 2, 1, 1, 0.0, 0.0);
gbc.fill = GridBagConstraints.HORIZONTAL;
JLabel locLabel = new JLabel(LanguageBundle.getString("in_diLocation"), SwingConstants.RIGHT);
gridbag.setConstraints(locLabel, gbc);
add(locLabel, gbc);
ButtonGroup exclusiveGroup = new ButtonGroup();
locDataButton = new JRadioButton(LanguageBundle.getString("in_diData"));
locDataButton.setToolTipText(LanguageBundle.getString("in_diData_tip"));
exclusiveGroup.add(locDataButton);
locVendorDataButton = new JRadioButton(LanguageBundle.getString("in_diVendorData"));
locVendorDataButton.setToolTipText(LanguageBundle.getString("in_diVendorData_tip"));
exclusiveGroup.add(locVendorDataButton);
locHomebrewDataButton = new JRadioButton(LanguageBundle.getString("in_diHomebrewData"));
locHomebrewDataButton.setToolTipText(LanguageBundle.getString("in_diHomebrewData_tip"));
exclusiveGroup.add(locHomebrewDataButton);
JPanel optionsPanel = new JPanel();
optionsPanel.add(locDataButton);
optionsPanel.add(locVendorDataButton);
optionsPanel.add(locHomebrewDataButton);
Utility.buildConstraints(gbc, 1, 2, 3, 1, 0.0, 0.0);
gridbag.setConstraints(optionsPanel, gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.WEST;
add(optionsPanel, gbc);
// Buttons row
installButton = new JButton();
CommonMenuText.name(installButton, "diInstall"); //$NON-NLS-1$
installButton.addActionListener(listener);
closeButton = new JButton();
CommonMenuText.name(closeButton, "close"); //$NON-NLS-1$
closeButton.addActionListener(listener);
JPanel buttonsPanel = new JPanel();
buttonsPanel.add(installButton);
buttonsPanel.add(closeButton);
Utility.buildConstraints(gbc, 2, 3, 2, 1, 0.0, 0.0);
gridbag.setConstraints(buttonsPanel, gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.EAST;
add(buttonsPanel, gbc);
pack();
}
/**
* Build the user interface ready for display.
*/
private void initComponents()
{
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(2, 2, 2, 2);
GridBagLayout gridbag = new GridBagLayout();
setTitle(TITLE);
setLayout(gridbag);
// Data set selection row
Utility.buildConstraints(gbc, 0, 0, 1, 1, 0.0, 0.0);
JLabel dataSetLabel = new JLabel(LanguageBundle.getString("in_diDataSet"), SwingConstants.RIGHT);
gridbag.setConstraints(dataSetLabel, gbc);
add(dataSetLabel, gbc);
Utility.buildConstraints(gbc, 1, 0, 2, 1, 1.0, 0.0);
dataSetSel = new JTextField("", SwingConstants.WEST);
dataSetSel.setEditable(false);
gridbag.setConstraints(dataSetSel, gbc);
add(dataSetSel, gbc);
Utility.buildConstraints(gbc, 3, 0, 1, 1, 0.0, 0.0);
gbc.fill = GridBagConstraints.NONE;
selectButton = new JButton();
CommonMenuText.name(selectButton, "select"); //$NON-NLS-1$
gridbag.setConstraints(selectButton, gbc);
add(selectButton, gbc);
selectButton.addActionListener(listener);
// Data set details row
Utility.buildConstraints(gbc, 0, 1, 4, 1, 1.0, 1.0);
dataSetDetails = new JFXPanelFromResource<>(
SimpleHtmlPanelController.class,
"SimpleHtmlPanel.fxml"
);
dataSetDetails.setPreferredSize(new Dimension(400, 200));
dataSetDetails.setBackground(getBackground());
gbc.fill = GridBagConstraints.BOTH;
JScrollPane jScrollPane = new JScrollPane();
jScrollPane.setViewportView(dataSetDetails);
gridbag.setConstraints(jScrollPane, gbc);
add(jScrollPane, gbc);
// Location row
Utility.buildConstraints(gbc, 0, 2, 1, 1, 0.0, 0.0);
gbc.fill = GridBagConstraints.HORIZONTAL;
JLabel locLabel = new JLabel(LanguageBundle.getString("in_diLocation"), SwingConstants.RIGHT);
gridbag.setConstraints(locLabel, gbc);
add(locLabel, gbc);
ButtonGroup exclusiveGroup = new ButtonGroup();
locDataButton = new JRadioButton(LanguageBundle.getString("in_diData"));
locDataButton.setToolTipText(LanguageBundle.getString("in_diData_tip"));
exclusiveGroup.add(locDataButton);
locVendorDataButton = new JRadioButton(LanguageBundle.getString("in_diVendorData"));
locVendorDataButton.setToolTipText(LanguageBundle.getString("in_diVendorData_tip"));
exclusiveGroup.add(locVendorDataButton);
locHomebrewDataButton = new JRadioButton(LanguageBundle.getString("in_diHomebrewData"));
locHomebrewDataButton.setToolTipText(LanguageBundle.getString("in_diHomebrewData_tip"));
exclusiveGroup.add(locHomebrewDataButton);
JPanel optionsPanel = new JPanel();
optionsPanel.add(locDataButton);
optionsPanel.add(locVendorDataButton);
optionsPanel.add(locHomebrewDataButton);
Utility.buildConstraints(gbc, 1, 2, 3, 1, 0.0, 0.0);
gridbag.setConstraints(optionsPanel, gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.WEST;
add(optionsPanel, gbc);
// Buttons row
installButton = new JButton();
CommonMenuText.name(installButton, "diInstall"); //$NON-NLS-1$
installButton.addActionListener(listener);
closeButton = new JButton();
CommonMenuText.name(closeButton, "close"); //$NON-NLS-1$
closeButton.addActionListener(listener);
JPanel buttonsPanel = new JPanel();
buttonsPanel.add(installButton);
buttonsPanel.add(closeButton);
Utility.buildConstraints(gbc, 2, 3, 2, 1, 0.0, 0.0);
gridbag.setConstraints(buttonsPanel, gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.EAST;
add(buttonsPanel, gbc);
pack();
}
private JPanel createExpressionPanel(BindingContext bindingContext) {
final TableLayout tableLayout = new TableLayout(2);
tableLayout.setTablePadding(4, 4);
tableLayout.setTableFill(TableLayout.Fill.BOTH);
tableLayout.setTableWeightX(1.0);
tableLayout.setTableWeightY(0.0);
tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
tableLayout.setCellAnchor(0, 1, TableLayout.Anchor.NORTHEAST); // edit expression button
tableLayout.setRowFill(0, TableLayout.Fill.VERTICAL);
tableLayout.setCellFill(1, 0, TableLayout.Fill.BOTH); // expression text area
tableLayout.setCellWeightY(1, 0, 1.0);
tableLayout.setCellColspan(1, 0, 2);
tableLayout.setCellColspan(2, 0, 2); // expression note line 1
tableLayout.setCellColspan(3, 0, 2); // radio button group
tableLayout.setCellFill(3, 0, TableLayout.Fill.BOTH);
final JPanel panel = new JPanel(tableLayout);
useExpressionCheckBox = new JCheckBox("Use expression");
useExpressionCheckBox.addActionListener(e -> updateExpressionComponents());
editExpressionButton = new JButton("Edit Expression...");
final Window parentWindow = SwingUtilities.getWindowAncestor(panel);
editExpressionButton.addActionListener(new EditExpressionActionListener(parentWindow));
panel.add(useExpressionCheckBox);
panel.add(editExpressionButton);
expressionArea = new JTextArea(3, 40);
expressionArea.setLineWrap(true);
panel.add(new JScrollPane(expressionArea));
expressionNoteLabel = new JLabel("Note: The expression might not be applicable to all products.");
panel.add(expressionNoteLabel);
final ButtonGroup buttonGroup = new ButtonGroup();
expressionAsFilterButton = new JRadioButton("Use expression as filter", true);
buttonGroup.add(expressionAsFilterButton);
exportExpressionResultButton = new JRadioButton("Export expression result");
buttonGroup.add(exportExpressionResultButton);
final Property exportResultProperty = bindingContext.getPropertySet().getProperty("exportExpressionResult");
final Boolean defaultValue = (Boolean) exportResultProperty.getDescriptor().getDefaultValue();
exportExpressionResultButton.setSelected(defaultValue);
exportExpressionResultButton.setToolTipText(
"Expression result is exported to the output file for each exported pixel.");
expressionAsFilterButton.setSelected(!defaultValue);
expressionAsFilterButton.setToolTipText(
"Expression is used as filter (all pixels in given window must be valid).");
final JPanel expressionButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
expressionButtonPanel.add(expressionAsFilterButton);
expressionButtonPanel.add(exportExpressionResultButton);
panel.add(expressionButtonPanel);
return panel;
}
protected void configureFileChooser(final SnapFileChooser fileChooser, final ProductSceneView view,
String imageBaseName) {
fileChooser.setDialogTitle(SnapApp.getDefault().getInstanceName() + " - " + "Export Image"); /*I18N*/
if (view.isRGB()) {
fileChooser.setCurrentFilename(imageBaseName + "_RGB");
} else {
fileChooser.setCurrentFilename(imageBaseName + "_" + view.getRaster().getName());
}
final JPanel regionPanel = new JPanel(new GridLayout(2, 1));
regionPanel.setBorder(BorderFactory.createTitledBorder("Image Region"));
buttonFullRegion = new JRadioButton("Full scene");
buttonFullRegion.setToolTipText("Use the image boundaries of the source data");
buttonFullRegion.setActionCommand(AC_FULL_REGION);
buttonVisibleRegion = new JRadioButton("View region");
buttonVisibleRegion.setToolTipText("Use the image boundaries of the view window");
buttonVisibleRegion.setActionCommand(AC_VIEW_REGION);
regionPanel.add(buttonVisibleRegion);
regionPanel.add(buttonFullRegion);
buttonGroupRegion = new ButtonGroup();
buttonGroupRegion.add(buttonVisibleRegion);
buttonGroupRegion.add(buttonFullRegion);
final JPanel resolutionPanel = new JPanel(new GridLayout(3, 1));
resolutionPanel.setBorder(BorderFactory.createTitledBorder("Image Resolution"));
buttonViewResolution = new JRadioButton("View resolution");
buttonViewResolution.setToolTipText("Use the resolution of the view window as it is on the computer screen");
buttonViewResolution.setActionCommand(AC_VIEW_RES);
buttonFullResolution = new JRadioButton("Full resolution");
buttonFullResolution.setToolTipText("Use the resolution of the source data");
buttonFullResolution.setActionCommand(AC_FULL_RES);
buttonUserResolution = new JRadioButton("User resolution");
buttonUserResolution.setToolTipText("Use a custom resolution set by the user");
buttonUserResolution.setActionCommand(AC_USER_RES);
resolutionPanel.add(buttonViewResolution);
resolutionPanel.add(buttonFullResolution);
resolutionPanel.add(buttonUserResolution);
buttonGroupResolution = new ButtonGroup();
buttonGroupResolution.add(buttonViewResolution);
buttonGroupResolution.add(buttonFullResolution);
buttonGroupResolution.add(buttonUserResolution);
sizeComponent = new SizeComponent(view);
JComponent sizePanel = sizeComponent.createComponent();
sizePanel.setBorder(BorderFactory.createTitledBorder("Image Dimension")); /*I18N*/
sizePanel.setToolTipText("Fixed ratio is automatically applied to width and height");
final JPanel accessory = new JPanel();
accessory.setLayout(new BoxLayout(accessory, BoxLayout.Y_AXIS));
accessory.add(regionPanel);
accessory.add(resolutionPanel);
accessory.add(sizePanel);
fileChooser.setAccessory(accessory);
buttonVisibleRegion.addActionListener(e -> updateComponents(e.getActionCommand()));
buttonFullRegion.addActionListener(e -> updateComponents(e.getActionCommand()));
buttonViewResolution.addActionListener(e -> updateComponents(e.getActionCommand()));
buttonFullResolution.addActionListener(e -> updateComponents(e.getActionCommand()));
buttonUserResolution.addActionListener(e -> updateComponents(e.getActionCommand()));
updateComponents(PSEUDO_AC_INIT);
}
@Override
protected List< ? extends Component> createBrickComponents() {
List<Component> components = new ArrayList<Component>();
JPanel wrapper = new JPanel();
String tooltip = getTooltip();
// label
if ( control.getLabel() != null ) {
label = new JLabel();
label.setName(getName()+"/label");
label.setText( control.getLabel() );
if ( tooltip != null ) label.setToolTipText( tooltip );
components.add(label);
}
/*
//TODO: implement horiz/vert orientation for Swing
if ( ((RadioButtonListT) control).getOrientation() != null &&
PanelOrientationT.VERTICAL.equals( ((RadioButtonListT) control).getOrientation() ) )
{
c.setLayout( new GridLayout( 1, false ) );
} else {
RowLayout rl = new RowLayout();
rl.wrap = false;
c.setLayout( rl );
}
*/
// radioButton
for ( ListItemT listItem : ( (RadioButtonListT) control ).getListItem() )
{
JRadioButton radioElement = new JRadioButton();
radioElement.setName(getName()+"/button/"+listItem.getEnumID());
radioElement.setText( listItem.getUiRep() );
if ( parameter != null )
{
for ( EnumPairT enumPair : parameter.getEnumPair() )
{
if ( enumPair.getEnumID() == listItem.getEnumID() )
{
radioElement.setToolTipText( enumPair.getDescription() );
break;
}
}
}
else
{
radioElement.setToolTipText( tooltip );
}
group.add( radioElement );
buttons.add( radioElement );
wrapper.add( radioElement );
}
// set initValue (Note that this has to be the enumID, not the
// wireValue)
// set initValue
if ( ControlHelper.getInitValue( control, getAtdl4jOptions() ) != null )
setValue( (String) ControlHelper.getInitValue( control, getAtdl4jOptions() ), true );
components.add(wrapper);
return components;
}