javax.swing.JPanel.validate()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(382)

本文整理了Java中javax.swing.JPanel.validate()方法的一些代码示例,展示了JPanel.validate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.validate()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:validate

JPanel.validate介绍

暂无

代码示例

代码示例来源:origin: kiegroup/optaplanner

@Override
public void updatePanel(CloudBalance cloudBalance) {
  Set<CloudComputer> deadCloudComputerSet = new LinkedHashSet<>(computerToPanelMap.keySet());
  deadCloudComputerSet.remove(null);
  for (CloudComputer computer : cloudBalance.getComputerList()) {
    deadCloudComputerSet.remove(computer);
    CloudComputerPanel computerPanel = computerToPanelMap.get(computer);
    if (computerPanel == null) {
      computerPanel = new CloudComputerPanel(this, computer);
      computersPanel.add(computerPanel);
      computerToPanelMap.put(computer, computerPanel);
    }
    computerPanel.clearProcesses();
  }
  unassignedPanel.clearProcesses();
  for (CloudProcess process : cloudBalance.getProcessList()) {
    CloudComputer computer = process.getComputer();
    CloudComputerPanel computerPanel = computerToPanelMap.get(computer);
    computerPanel.addProcess(process);
  }
  for (CloudComputer deadComputer : deadCloudComputerSet) {
    CloudComputerPanel deadComputerPanel = computerToPanelMap.remove(deadComputer);
    computersPanel.remove(deadComputerPanel);
  }
  for (CloudComputerPanel computerPanel : computerToPanelMap.values()) {
    computerPanel.update();
  }
  // If computersPanel.add() or computersPanel.remove() was called, the component needs to be validated.
  computersPanel.validate();
}

代码示例来源:origin: nodebox/nodebox

@Override
  public void itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
      boolean visible = e.getItem().toString().equals("CSV");
      delimiterPanel.setVisible(visible);
      quotesPanel.setVisible(visible);
      mainPanel.validate();
      ExportDialog.this.pack();
    }
  }
});

代码示例来源:origin: apache/pdfbox

/**
 * This shows the stream in text for any of  it's filtered or unfiltered version.
 * @param document StyledDocument instance that holds the text.
 * @param toolTipController ToolTipController instance.
 */
void showStreamText(StyledDocument document, ToolTipController toolTipController)
{
  contentPanel.removeAll();
  StreamTextView textView = new StreamTextView(document, toolTipController);
  contentPanel.add(textView.getView(), BorderLayout.CENTER);
  contentPanel.validate();
}

代码示例来源:origin: apache/pdfbox

/**
 * This shows the stream as image.
 * @param image BufferedImage instance that holds the text.
 */
void showStreamImage(BufferedImage image)
{
  contentPanel.removeAll();
  contentPanel.add(new StreamImageView(image).getView(), BorderLayout.CENTER);
  contentPanel.validate();
}

代码示例来源:origin: dboissier/mongo4idea

private void displayResult(JComponent tableView) {
  resultTreePanel.invalidate();
  resultTreePanel.removeAll();
  resultTreePanel.add(new JBScrollPane(tableView));
  resultTreePanel.validate();
}

代码示例来源:origin: nodebox/nodebox

private void selectSubCategory(SubCategory subCategory) {
  List<Example> examples = subCategory.examples;
  examplesPanel.removeAll();
  for (final Example e : examples) {
    ExampleButton b = new ExampleButton(e.title, new ImageIcon(e.thumbnail));
    b.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent actionEvent) {
        openExample(e);
      }
    });
    examplesPanel.add(b);
  }
  updateExamplesPanelSize();
  examplesPanel.validate();
  examplesPanel.repaint();
}

代码示例来源:origin: nodebox/nodebox

private void selectCategory(Category category) {
  subCategoriesPanel.removeAll();
  final List<SubCategory> subCategories = category.subCategories;
  for (final SubCategory subCategory : subCategories) {
    final SubCategoryButton b = new SubCategoryButton(subCategory);
    b.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent actionEvent) {
        for (Component c : subCategoriesPanel.getComponents()) {
          SubCategoryButton b = (SubCategoryButton) c;
          b.setSelected(false);
        }
        b.setSelected(true);
        selectSubCategory(subCategory);
      }
    });
    subCategoriesPanel.add(b);
  }
  subCategoriesPanel.validate();
  subCategoriesPanel.repaint();
  ((SubCategoryButton) subCategoriesPanel.getComponent(0)).setSelected(true);
  selectSubCategory(subCategories.get(0));
}

代码示例来源:origin: nodebox/nodebox

/**
 * Refresh the examples browser by loading everything from disk.
 */
private void reload() {
  final List<Category> categories = parseCategories(examplesDir);
  categoriesPanel.removeAll();
  for (final Category category : categories) {
    final CategoryButton b = new CategoryButton(category);
    b.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent actionEvent) {
        for (Component c : categoriesPanel.getComponents()) {
          CategoryButton b = (CategoryButton) c;
          b.setSelected(false);
        }
        b.setSelected(true);
        selectCategory(category);
      }
    });
    categoriesPanel.add(b);
  }
  categoriesPanel.validate();
  categoriesPanel.repaint();
  ((CategoryButton) categoriesPanel.getComponent(0)).setSelected(true);
  selectCategory(categories.get(0));
}

代码示例来源:origin: nodebox/nodebox

centerPanel.add(categoryList, BorderLayout.WEST);
centerPanel.add(nodeScroll, BorderLayout.CENTER);
centerPanel.validate();

代码示例来源:origin: dboissier/mongo4idea

void initCombo(final ComboBox combobox, final JPanel parentPanel) {
  combobox.setModel(new DefaultComboBoxModel<>(JsonDataType.values()));
  combobox.setRenderer(new ColoredListCellRenderer() {
    @Override
    protected void customizeCellRenderer(JList jList, Object o, int i, boolean b, boolean b2) {
      append(((JsonDataType) o).type);
    }
  });
  combobox.setSelectedItem(null);
  combobox.addItemListener(itemEvent -> {
    JsonDataType selectedType = (JsonDataType) combobox.getSelectedItem();
    currentEditor = UI_COMPONENT_BY_JSON_DATATYPE.get(selectedType);
    currentEditor.reset();
    parentPanel.invalidate();
    parentPanel.removeAll();
    parentPanel.add(currentEditor.getComponent(), BorderLayout.CENTER);
    parentPanel.validate();
  });
  combobox.setSelectedItem(JsonDataType.STRING);
}

代码示例来源:origin: geotools/geotools

page.validate();

代码示例来源:origin: dboissier/mongo4idea

@Override
  public void run(@NotNull ProgressIndicator indicator) {
    try {
      UIUtil.invokeLaterIfNeeded(() -> loadingDecorator.startLoading(false));
      final MongoQueryOptions queryOptions = wayPoint.getQueryOptions();
      if (!useCachedResults) {
        currentResults = mongoManager.findMongoDocuments(
            configuration,
            wayPoint.getCollection(),
            queryOptions);
      }
      UIUtil.invokeLaterIfNeeded(() -> {
        resultPanel.updateResultView(currentResults, pagination);
        rowCountLabel.setText(String.format("%s documents", currentResults.getDocuments().size()));
        initActions(resultPanel.resultTreeTableView);
      });
    } catch (final Exception ex) {
      UIUtil.invokeLaterIfNeeded(() -> {
        errorPanel.invalidate();
        errorPanel.removeAll();
        errorPanel.add(new ErrorPanel(ex), BorderLayout.CENTER);
        errorPanel.validate();
        errorPanel.setVisible(true);
      });
    } finally {
      UIUtil.invokeLaterIfNeeded(loadingDecorator::stopLoading);
    }
  }
});

代码示例来源:origin: nccgroup/AutoRepeater

@Override
public void removeUpdate(DocumentEvent e) {
 tabName.repaint();
 parent.validate();
}

代码示例来源:origin: sc.fiji/TrackMate_

@Override
  public void run()
  {
    // Register component instance with the layout on the fly
    jPanelMain.removeAll();
    jPanelMain.add( descriptor.getComponent(), BorderLayout.CENTER );
    jPanelMain.validate();
    jPanelMain.repaint();
  }
} );

代码示例来源:origin: nccgroup/AutoRepeater

@Override
 public void changedUpdate(DocumentEvent e) {
  tabName.repaint();
  parent.validate();
 }
});

代码示例来源:origin: robo-code/robocode

public void addRobotButton(JButton b) {
  if (b instanceof RobotButton) {
    robotButtons.add((RobotButton) b);
  }
  getRobotButtonsPanel().add(b);
  b.setVisible(true);
  getRobotButtonsPanel().validate();
}

代码示例来源:origin: org.ihtsdo/wb-api

public void run() {
  Component[] components = workflowPanel.getComponents();
  for (int i = 0; i < components.length; i++) {
    workflowPanel.remove(components[i]);
  }
  workflowPanel.validate();
  Container cont = workflowPanel;
  while (cont != null) {
    cont.validate();
    cont = cont.getParent();
  }
}

代码示例来源:origin: org.ihtsdo/wb-api

public void run() {
  Component[] components = workflowPanel.getComponents();
  for (int i = 0; i < components.length; i++) {
    workflowPanel.remove(components[i]);
  }
  workflowPanel.validate();
  Container cont = workflowPanel;
  while (cont != null) {
    cont.validate();
    cont = cont.getParent();
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private void revalidateDetailsPanel() {
  detailsPanel.invalidate();
  repaint();
  if (detailsPanel.getParent() != null) {
    detailsPanel.getParent().validate();
  } else {
    detailsPanel.validate();
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

private void revalidateDetailsPanel() {
  detailsPanel.invalidate();
  repaint();
  if (detailsPanel.getParent() != null) {
    detailsPanel.getParent().validate();
  } else {
    detailsPanel.validate();
  }
}

相关文章

JPanel类方法