Java Code Examples for javax.swing.JPanel#setEnabled()

The following examples show how to use javax.swing.JPanel#setEnabled() . These examples are extracted from open source projects. 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 Project: Simple-ADB   File: MainUI.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * to disable the passed panel and all it's components
 */
private void freezePanel(JPanel panel, boolean condition) {

    panel.setEnabled(!condition);

    Component[] com = panel.getComponents();

    for (int i = 0; i < com.length; i++) {

        if (!abortBtn.isEnabled()) if (com[i] instanceof JTextField) {
            ((JTextField) com[i]).setText("");
            com[i].requestFocus();
        }

        if (!com[i].equals(combo))
            com[i].setEnabled(!condition);
        else if (!commandRadio.isSelected()) com[i].setEnabled(!condition);
    }
}
 
Example 2
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 3
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 4
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 5
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 6
Source Project: netbeans   File: DetailsProvider.java    License: Apache License 2.0 5 votes vote down vote up
private static JComponent initialView() {
    JLabel loading = new JLabel(Bundle.BrowserUtils_Loading(), JLabel.CENTER);
    loading.setEnabled(false);
    
    JPanel loadingContainer = new JPanel(new BorderLayout());
    loadingContainer.setOpaque(true);
    loadingContainer.setBackground(UIUtils.getProfilerResultsBackground());
    loadingContainer.setEnabled(false);
    loadingContainer.add(loading, BorderLayout.CENTER);
    
    return loadingContainer;
}
 
Example 7
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 8
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 9
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 10
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 11
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 12
private static JComponent initialView() {
    JLabel loading = new JLabel(Bundle.BrowserUtils_Loading(), JLabel.CENTER);
    loading.setEnabled(false);
    
    JPanel loadingContainer = new JPanel(new BorderLayout());
    loadingContainer.setOpaque(true);
    loadingContainer.setBackground(UIUtils.getProfilerResultsBackground());
    loadingContainer.setEnabled(false);
    loadingContainer.add(loading, BorderLayout.CENTER);
    
    return loadingContainer;
}
 
Example 13
private JPanel headerPanel() {
  JPanel header = new JPanel();
  header.setOpaque(false);
  header.setLayout(new BoxLayout(header, BoxLayout.PAGE_AXIS));

  JPanel fieldHeader = new JPanel(new FlowLayout(FlowLayout.LEADING, 3, 3));
  fieldHeader.setOpaque(false);
  fieldHeader.add(new JLabel(MessageUtils.getLocalizedMessage("documents.docvalues.label.doc_values")));
  fieldHeader.add(new JLabel(field));
  header.add(fieldHeader);

  JPanel typeHeader = new JPanel(new FlowLayout(FlowLayout.LEADING, 3, 3));
  typeHeader.setOpaque(false);
  typeHeader.add(new JLabel(MessageUtils.getLocalizedMessage("documents.docvalues.label.type")));
  typeHeader.add(new JLabel(docValues.getDvType().toString()));
  header.add(typeHeader);

  JPanel decodeHeader = new JPanel(new FlowLayout(FlowLayout.TRAILING, 3, 3));
  decodeHeader.setOpaque(false);
  decodeHeader.add(new JLabel("decoded as"));
  String[] decoders = Arrays.stream(Decoder.values()).map(Decoder::toString).toArray(String[]::new);
  decodersCombo.setModel(new DefaultComboBoxModel<>(decoders));
  decodersCombo.setSelectedItem(Decoder.LONG.toString());
  decodersCombo.addActionListener(listeners::selectDecoder);
  decodeHeader.add(decodersCombo);
  if (docValues.getValues().size() > 0) {
    decodeHeader.setEnabled(false);
  }
  header.add(decodeHeader);

  return header;
}
 
Example 14
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 15
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 16
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 17
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 18
public Component getListCellRendererComponent(JList<? extends PeakListRow> combo,
    PeakListRow value, int index, boolean isSelected, boolean cellHasFocus) {

  PeakListRow row = (PeakListRow) value;
  if (row == null)
    return new JPanel();
  Feature peak = row.getPeaks()[0];

  String labelText = "#" + row.getID() + " "
      + MZmineCore.getConfiguration().getMZFormat().format(row.getAverageMZ()) + " m/z ";
  JLabel textComponent = new JLabel(labelText);
  textComponent.setFont(combo.getFont());

  PeakXICComponent shapeComponent = new PeakXICComponent(peak);
  shapeComponent.setBorder(null);

  JPanel panel = new JPanel(new BorderLayout());

  panel.setOpaque(true);
  if (isSelected) {
    panel.setBackground(combo.getSelectionBackground());
    panel.setForeground(combo.getSelectionForeground());
  } else {
    panel.setBackground(combo.getBackground());
    panel.setForeground(combo.getForeground());
  }

  panel.setEnabled(combo.isEnabled());

  Border border = null;
  if (cellHasFocus) {
    if (isSelected) {
      border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
    }
    if (border == null) {
      border = UIManager.getBorder("List.focusCellHighlightBorder");
    }
  } else {
    border = noFocusBorder;
  }
  panel.setBorder(border);

  panel.add(textComponent, BorderLayout.WEST);
  panel.add(shapeComponent, BorderLayout.CENTER);

  return panel;
}
 
Example 19
private JPanel getAnimationSubPanel() {
    final JPanel panel = new SubPanel();
    panel.setEnabled(GeneralConfig.get(BooleanSetting.ANIMATE_GAMEPLAY));
    return panel;
}