Java Code Examples for com.intellij.ui.components.JBLabel#setLabelFor()

The following examples show how to use com.intellij.ui.components.JBLabel#setLabelFor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaExtractSuperBaseDialog.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
@Override
protected JPanel createDestinationRootPanel() {
  final List<VirtualFile> sourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(myProject);
  if (sourceRoots.size() <= 1) return super.createDestinationRootPanel();
  final JPanel panel = new JPanel(new BorderLayout());
  panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
  final JBLabel label = new JBLabel(RefactoringBundle.message("target.destination.folder"));
  panel.add(label, BorderLayout.NORTH);
  label.setLabelFor(myDestinationFolderComboBox);
  myDestinationFolderComboBox.setData(myProject, myTargetDirectory, new Pass<String>() {
    @Override
    public void pass(String s) {
    }
  }, ((PackageNameReferenceEditorCombo)myPackageNameField).getChildComponent());
  panel.add(myDestinationFolderComboBox, BorderLayout.CENTER);
  return panel;
}
 
Example 2
Source File: SettingComponent.java    From intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link LabeledComponent} for the given label text and Swing component.
 *
 * @param getter a {@link Getter} for accessing the component's value
 * @param setter a {@link Setter} for modifying the component's value
 */
public static <T, C extends JComponent> LabeledComponent<T, C> create(
    String label, C component, Getter<C, T> getter, Setter<C, T> setter) {

  JBLabel labelComponent = new JBLabel(label);
  labelComponent.setLabelFor(component);
  Property<T> property = Property.create(() -> component, getter, setter);

  return new LabeledComponent<>(labelComponent, component, property);
}
 
Example 3
Source File: XLightBreakpointPropertiesPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void loadProperties() {
  for (XBreakpointPropertiesSubPanel panel : mySubPanels) {
    panel.loadProperties();
  }

  if (myConditionComboBox != null) {
    XExpression condition = myBreakpoint.getConditionExpressionInt();
    myConditionComboBox.setExpression(condition);
    boolean hideCheckbox = !myShowAllOptions && condition == null;
    myConditionEnabledCheckbox.setSelected(hideCheckbox || (myBreakpoint.isConditionEnabled() && condition != null));
    myConditionEnabledPanel.removeAll();
    if (hideCheckbox) {
      JBLabel label = new JBLabel(XDebuggerBundle.message("xbreakpoints.condition.checkbox"));
      label.setBorder(JBUI.Borders.empty(0, 4));
      label.setLabelFor(myConditionComboBox.getComboBox());
      myConditionEnabledPanel.add(label);
    }
    else {
      myConditionEnabledPanel.add(myConditionEnabledCheckbox);
    }

    onCheckboxChanged();
  }

  for (XBreakpointCustomPropertiesPanel customPanel : myCustomPanels) {
    customPanel.loadFrom(myBreakpoint);
  }
  myEnabledCheckbox.setSelected(myBreakpoint.isEnabled());
  myBreakpointNameLabel.setText(XBreakpointUtil.getShortText(myBreakpoint));
}