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

x33g5p2x  于2022-01-16 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(124)

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

Box.revalidate介绍

暂无

代码示例

代码示例来源:origin: lbalazscs/Pixelitor

public void setLayersVisibility(boolean v, boolean revalidate) {
  if (v) {
    verticalBoxEast.add(LayersContainer.INSTANCE);
  } else {
    verticalBoxEast.remove(LayersContainer.INSTANCE);
  }
  if (revalidate) {
    verticalBoxEast.revalidate();
  }
}

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

final JFrame frame = new JFrame("Scroll Demo");
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 frame.setLayout(new BorderLayout());
 final Box textArea = Box.createVerticalBox();
 final JScrollPane textAreaScroll = new JScrollPane(textArea);
 textAreaScroll.setPreferredSize(new Dimension(80,150)); /* essential! */
 JButton addButton = new JButton("ADD");
 addButton.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent arg0) {
     textArea.add(new JLabel("abc"));
     textArea.revalidate();
   }
 });
 frame.getContentPane().add(textAreaScroll, BorderLayout.SOUTH);
 frame.getContentPane().add(Box.createRigidArea(new Dimension(10,10)), BorderLayout.CENTER);
 frame.getContentPane().add(addButton, BorderLayout.NORTH);
 frame.pack();
 frame.setVisible(true);

代码示例来源:origin: lbalazscs/Pixelitor

public void setHistogramsVisibility(boolean v, boolean revalidate) {
  if (v) {
    verticalBoxEast.add(histogramsPanel);
    OpenComps.onActiveComp(histogramsPanel::updateFromCompIfShown);
  } else {
    verticalBoxEast.remove(histogramsPanel);
  }
  if (revalidate) {
    verticalBoxEast.revalidate();
  }
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Removes the option fields from the previous selection.
 *
 * @param box the box
 * @param fieldConfigManager the field config manager
 */
private void removeOptionFields(Box box, GraphicPanelFieldManager fieldConfigManager) {
  if (optionPanel != null) {
    box.remove(optionPanel);
    for (FieldConfigBase field : optionFieldList) {
      fieldConfigManager.removeField(field);
    }
    optionFieldList.clear();
    optionPanel = null;
    box.revalidate();
  }
}

代码示例来源:origin: antlr/antlrworks

public void showLevel(int level) {
  if(level == Console.LEVEL_NORMAL)
    return;
  if(!visible) {
    visible = true;
    box.removeAll();
    box.add(label);
    box.revalidate();
  }
  if(level > currentDisplayedLevel) {
    currentDisplayedLevel = level;
    if(level == Console.LEVEL_ERROR)
      showMessage("Errors reported in console", Color.red);
    else
      showMessage("Warnings reported in console", Color.blue);
  }
}

代码示例来源:origin: cmu-phil/tetrad

public void refreshLabels() {
  formulasBox.removeAll();
  java.util.List<String> parameters = new ArrayList<>(semPm().getParameters());
  Collections.sort(parameters);
  for (String parameter : parameters) {
    Box c = Box.createHorizontalBox();
    final JLabel label = new JLabel(parameter + " ~ " + semPm().getParameterExpressionString(parameter));
    final String _parameter = parameter;
    label.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent mouseEvent) {
        if (mouseEvent.getClickCount() == 2) {
          beginParamEdit(_parameter, label, label);
        }
      }
    });
    c.add(label);
    c.add(Box.createHorizontalGlue());
    formulasBox.add(c);
    formulasBox.add(Box.createVerticalStrut(5));
  }
  formulasBox.setBorder(new CompoundBorder(new TitledBorder("Double click expressions to edit."),
      new EmptyBorder(5, 5, 5, 5)));
  formulasBox.revalidate();
  formulasBox.repaint();
}

代码示例来源:origin: com.googlecode.jannocessor/jannocessor-ui

private void refresh() {
  output.removeAll();
  try {
    RenderData current = current();
    String text = render(current.getAttributes());
    Map<String, String> contents = splitter.split(text);
    if (!contents.isEmpty()) {
      for (Entry<String, String> a : contents.entrySet()) {
        output.add(createOutput(a.getKey(), a.getValue()));
      }
    } else {
      output.add(createOutput("FILE NAME NOT SPECIFIED!", text));
    }
  } catch (Exception e) {
    logger.warn("Rendering error occured!", e);
    Throwable cause = e;
    String message = "";
    while (cause != null) {
      message += cause.getMessage() + "\n\n";
      cause = cause.getCause();
    }
    output.add(createOutput("RENDERING ERROR OCCURED!", message));
  }
  output.revalidate();
  repaint();
}

代码示例来源:origin: cmu-phil/tetrad

this.main.revalidate();
this.main.repaint();

代码示例来源:origin: eseifert/vectorgraphics2d

public void setLeftComponent(JComponent leftComponent) {
  if (this.leftComponent != null) {
    leftPanel.remove(this.leftComponent);
  }
  this.leftComponent = leftComponent;
  leftPanel.add(leftComponent);
  leftPanel.revalidate();
  leftPanel.repaint();
}

代码示例来源:origin: eseifert/vectorgraphics2d

public void setRightComponent(JComponent rightComponent) {
  if (this.rightComponent != null) {
    rightPanel.remove(this.rightComponent);
  }
  this.rightComponent = rightComponent;
  rightPanel.add(rightComponent);
  rightPanel.revalidate();
  rightPanel.repaint();
}

代码示例来源:origin: cmu-phil/tetrad

public void refreshLabels() {
  formulasBox.removeAll();
  for (Node node : semPm().getNodes()) {
    if (!semPm().getGraph().isParameterizable(node)) {
      continue;
    }
    Box c = Box.createHorizontalBox();
    String symbol = node.getNodeType() == NodeType.ERROR ? " ~ " : " = ";
    final JLabel label = new JLabel(node + symbol + semPm().getNodeExpressionString(node));
    c.add(label);
    c.add(Box.createHorizontalGlue());
    final Node _node = node;
    label.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent mouseEvent) {
        if (mouseEvent.getClickCount() == 2) {
          beginNodeEdit(_node, label, label);
        }
      }
    });
    formulasBox.add(c);
    formulasBox.add(Box.createVerticalStrut(5));
  }
  formulasBox.revalidate();
  formulasBox.repaint();
  formulasBox.setBorder(new CompoundBorder(new TitledBorder("Double click expressions to edit."),
      new EmptyBorder(5, 5, 5, 5)));
}

代码示例来源:origin: cmu-phil/tetrad

new EmptyBorder(5, 5, 5, 5)));
formulasBox.revalidate();
formulasBox.repaint();

代码示例来源:origin: cmu-phil/tetrad

equationsBox.revalidate();
equationsBox.repaint();

代码示例来源:origin: robward-scisys/sldeditor

box.revalidate();

代码示例来源:origin: icza/scelight

@Override
  public void valuesChanged( final ISettingChangeEvent event ) {
    if ( event.affected( LSettings.PAGE_TITLE_FONT_SIZE ) ) {
      titleLabel.setFont( titleFont.deriveFont( event.get( LSettings.PAGE_TITLE_FONT_SIZE ).floatValue() ) );
      // Have at least 16x16 icon:
      final int iconSize = Math.max( 16, event.get( LSettings.PAGE_TITLE_FONT_SIZE ) );
      if ( selectedPage != null )
        titleLabel.setIcon( selectedPage.getRicon().size( iconSize ) );
      // Have at least 16x16 icon:
      closeButton.setIcon( LIcons.F_CROSS_BUTTON.size( iconSize ) );
      closeButton.setPressedIcon( LIcons.F_CROSS_BUTTON.size( iconSize - 2 ) );
      closeButton.setDisabledIcon( LIcons.F_CROSS_BUTTON.size( iconSize, true, true ) );
    }
    if ( event.affected( LSettings.PAGE_LIST_FONT_SIZE ) ) {
      pageListCellRenderer.setFont( pageListFont.deriveFont( event.get( LSettings.PAGE_LIST_FONT_SIZE ).floatValue() ) );
      rebuildPageTree( false );
    }
    if ( event.affected( LSettings.MULTI_PAGE_DIVIDER_SIZE ) )
      setDividerSize( event.get( LSettings.MULTI_PAGE_DIVIDER_SIZE ) );
    if ( event.affected( LSettings.SHOW_CONTROL_BAR ) ) {
      controlsScrollPane.setVisible( event.get( LSettings.SHOW_CONTROL_BAR ) );
      northBox.revalidate();
    }
  }
};

相关文章