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

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

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

JPanel.revalidate介绍

暂无

代码示例

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

@Override
  public void run() {
    label.setBackground(PROGRESS_COLOR);
    label.setToolTipText("Running...");
    label.setBorder(javax.swing.BorderFactory.createLineBorder(new Color(0, 0, 0)));
    label.setOpaque(true);
    messagePanel.add(label);
    messagePanel.revalidate();
  }
});

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

private void runButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runButtonActionPerformed
  final Main.Config config = new Main.Config(uriField.getText(), syncRadio.isSelected(),
      Integer.parseInt(requestCountField.getText()));
  runButton.setEnabled(false);
  finishStatusLabel.setText(" ");
  successRateStatusLabel.setText(" ");
  messagePanel.removeAll();
  messagePanel.revalidate();
  messagePanel.repaint();
  Executors.newSingleThreadExecutor().submit(new Runnable() {
    @Override
    public void run() {
      sendMessages(config);
    }
  });
}//GEN-LAST:event_runButtonActionPerformed

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

/**
 * Creates new form MainWindow
 */
public MainWindow() {
  initComponents();
  uriField.setText(Main.Config.DEFAULT_BASE_URI);
  ((FlowLayout) messagePanel.getLayout()).setAlignment(FlowLayout.LEADING);
  messagePanel.removeAll();
  messagePanel.revalidate();
}

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

display.removeAll();
display.add(selectedTab.getContent());
display.revalidate();
display.repaint();

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

trackerWrapper.add(tracker, BorderLayout.NORTH);
for (VarType cb : VarType.values())
  trackerOpts.add(cb.getCheckBox());
clearBtn.addActionListener(e ->
  tracker.removeAll();
  tracker.revalidate();
});
trackerOpts.add(clearBtn);

代码示例来源:origin: magefree/mage

/**
 * Adds new arrow.
 *
 * @param startX
 * @param startY
 * @param endX
 * @param endY
 * @param color
 */
public void addArrow(UUID gameId, int startX, int startY, int endX, int endY, Color color, Type type) {
  JPanel p = getArrowsPanel(gameId);
  Arrow arrow = new Arrow();
  arrow.setColor(color);
  arrow.setArrowLocation(startX, startY, endX, endY);
  arrow.setBounds(0, 0, Math.max(startX, endX) + 40, Math.max(startY, endY) + 30); // 30 is offset for arrow heads (being cut otherwise)
  synchronized (map) {
    p.add(arrow);
    Map<Type, java.util.List<Arrow>> innerMap = map.computeIfAbsent(gameId, k -> new HashMap<>());
    java.util.List<Arrow> arrows = innerMap.computeIfAbsent(type, k -> new ArrayList<>());
    arrows.add(arrow);
  }
  p.revalidate();
  p.repaint();
}

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

public void setAtlas (TextureAtlas atlas) {
  atlasPanel.clearSelection();
  atlasPanel.setAtlas(atlas);
  CustomCardLayout cardLayout = (CustomCardLayout)content.getLayout();
  cardLayout.show(content, "atlas");
  showGenerationPanel(false);
  content.revalidate();
  content.repaint();
  revalidate();
  repaint();
}

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

private void rebuildLapList()
  lapsContainer.removeAll();
      lapsContainer.add(createSmallLabel("" + (c.gridy + 1)), c);
      lapsContainer.add(createSmallLabel(getFormattedDuration(lap - previousLap)), c);
      lapsContainer.add(createSmallLabel(getFormattedDuration(lap)), c);
  lapsContainer.revalidate();
  lapsContainer.repaint();

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

private void settingsSelected() {
  editorPanel.removeAll();
  NodeSettingsEditor editor = new NodeSettingsEditor(dialog);
  editorPanel.add(editor, BorderLayout.CENTER);
  editorPanel.revalidate();
  selectedPort = null;
}

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

private void addVarLog(VarType type, String name, String old, String neew)
{
  if (!type.getCheckBox().isSelected())
  {
    return;
  }
  int tick = client.getTickCount();
  SwingUtilities.invokeLater(() ->
  {
    if (tick != lastTick)
    {
      lastTick = tick;
      JLabel header = new JLabel("Tick " + tick);
      header.setFont(FontManager.getRunescapeSmallFont());
      header.setBorder(new CompoundBorder(
        BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR),
        BorderFactory.createEmptyBorder(3, 6, 0, 0)
      ));
      tracker.add(header);
    }
    tracker.add(new JLabel(String.format("%s %s changed: %s -> %s", type.getName(), name, old, neew)));
    // Cull very old stuff
    for (; tracker.getComponentCount() > MAX_LOG_ENTRIES; )
    {
      tracker.remove(0);
    }
    tracker.revalidate();
  });
}

代码示例来源:origin: stackoverflow.com

JPanel contentPane = (JPanel)displayFrames.get(f).getContentPane();
contentPane.add(new EnterPINPanel(), BorderLayout.CENTER);
contentPane.revalidate();
contentPane.repaint();

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

/**
 * Rebuilds all the boxes from scratch using existing listed records, depending on the grouping mode.
 */
private void rebuild()
{
  logsContainer.removeAll();
  boxes.clear();
  int start = 0;
  if (!groupLoot && records.size() > MAX_LOOT_BOXES)
  {
    start = records.size() - MAX_LOOT_BOXES;
  }
  for (int i = start; i < records.size(); i++)
  {
    buildBox(records.get(i));
  }
  boxes.forEach(LootTrackerBox::rebuild);
  updateOverall();
  logsContainer.revalidate();
  logsContainer.repaint();
}

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

public void setTexture(Texture texture){
  texturePanel.clearSelection();
  texturePanel.setTexture(texture);
  CustomCardLayout cardLayout = (CustomCardLayout)content.getLayout();
  cardLayout.show(content, "texture");
  showGenerationPanel(true);
  content.revalidate();
  content.repaint();
  revalidate();
  repaint();
}

代码示例来源:origin: com.google.code.findbugs/findbugs

public void clearSummaryTab() {
  summaryHtmlArea.setText("");
  summaryTopPanel.removeAll();
  summaryTopPanel.revalidate();
}

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

});
listContainer.removeAll();
  listContainer.add(row);
listContainer.revalidate();
listContainer.repaint();

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

private void portSelected(Port port) {
  editorPanel.removeAll();
  PortAttributesEditor editor = new PortAttributesEditor(dialog, port.getName());
  editorPanel.add(editor, BorderLayout.CENTER);
  editorPanel.revalidate();
  selectedPort = port;
}

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

JPanel rootPanel = new JPanel(layoutManager);
Spacer spacer = new Spacer();
rootPanel.add(spacer, new GridConstraints(configurables.size(), 0, 1, 1, GridConstraints.ANCHOR_SOUTH,
                     GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                     GridConstraints.SIZEPOLICY_FIXED, null, null, null));
 JPanel hideablePanel = new JPanel(new BorderLayout());
 rootPanel.add(hideablePanel, configurableConstrains(i));
 rootPanel.setPreferredSize(new Dimension(400, 600));
rootPanel.revalidate();
return rootPanel;

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

protected void addProgressBar() {
    progressBar = ProgressBar.create(progressComponent); //NOI18N
    GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    progressImpl.add(progressBar, gridBagConstraints);
    progressImpl.repaint();
    progressImpl.revalidate();
}

代码示例来源:origin: magefree/mage

/**
 * Removes all arrows from the screen.
 */
public void removeAllArrows(UUID gameId) {
  if (map.containsKey(gameId)) {
    Map<Type, List<Arrow>> innerMap = map.get(gameId);
    JPanel p = getArrowsPanel(gameId);
    synchronized (map) {
      if (p != null && p.getComponentCount() > 0) {
        p.removeAll();
        p.revalidate();
        p.repaint();
      }
      innerMap.clear();
      map.remove(gameId);
    }
  }
}

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

public void setTexture(Texture texture){
  texturePanel.clearSelection();
  texturePanel.setTexture(texture);
  CustomCardLayout cardLayout = (CustomCardLayout)content.getLayout();
  cardLayout.show(content, "texture");
  showGenerationPanel(true);
  content.revalidate();
  content.repaint();
  revalidate();
  repaint();
}

相关文章

微信公众号

最新文章

更多

JPanel类方法