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

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

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

JTabbedPane.validate介绍

暂无

代码示例

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

public static void addTag(JTabbedPane tab, String title, Icon icon, int index){
  MouseListener close = new MouseAdapter() {
   @Override
   public void mouseClicked(MouseEvent e) {
     //your code to remove component
     //I use this way , because I use other methods of control than normal: tab.remove(int index);
   }
 };
 final ButtonClose buttonClose = new ButtonClose (title, icon, close );
 tab.setTabComponentAt(index, buttonClose);
 tab.validate();
 tab.setSelectedIndex(index);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf-testrunner-ui

/**
 */
private void addView(final JSplitPane view) {
  assert EventQueue.isDispatchThread();
  view.setMinimumSize(new Dimension(0, 0));
  tabPane.addTab(view.getToolTipText(), view);
  tabPane.setSelectedComponent(view);
  tabPane.validate();
}

代码示例来源:origin: triplea-game/triplea

@Override
protected void initLayout() {
 this.removeAll();
 this.setLayout(new GridBagLayout());
 add(new JLabel("Attack | Defense | Movement"),
   new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL,
     new Insets(8, 8, 8, 0), 0, 0));
 final JTabbedPane tabs = new JTabbedPane();
 add(tabs, new GridBagConstraints(0, 1, 1, 1, 100, 100, GridBagConstraints.EAST, GridBagConstraints.BOTH,
   new Insets(8, 8, 8, 8), 0, 0));
 final ProductionTabsProperties properties = ProductionTabsProperties.getInstance(id, rules);
 final List<Tuple<String, List<Rule>>> ruleLists = getRuleLists(properties);
 calculateRowsAndColumns(properties, largestList(ruleLists));
 for (final Tuple<String, List<Rule>> ruleList : ruleLists) {
  if (ruleList.getSecond().size() > 0) {
   tabs.addTab(ruleList.getFirst(), new JScrollPane(getRulesPanel(ruleList.getSecond())));
  }
 }
 final JPanel totals = new JPanel();
 totals.add(left);
 totals.add(remainingResources);
 add(totals, new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE,
   new Insets(8, 8, 0, 12), 0, 0));
 done = new JButton(doneAction);
 add(done, new GridBagConstraints(0, 3, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE,
   new Insets(0, 0, 8, 0), 0, 0));
 tabs.validate();
 this.validate();
}

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

/**
 * 2
 * Replaces the getModel Datamodels with the given one. Note, that by calling this
 * you are removing ALL the getModel data-models, they will be lost forever!
 *
 * @param graphs - The graphs to display now.
 */
public final void replace(List<Graph> graphs) {
  tabbedPane.removeAll();
  setPreferredSize(new Dimension(600, 400));
  // now rebuild
  removeAll();
  if (graphs.isEmpty()) {
    // Do nothing.
  } else if (graphs.size() > 1) {
    for (int i = 0; i < graphs.size(); i++) {
      this.tabbedPane.addTab(tabName(i + 1), new JScrollPane(graphDisplay(graphs.get(i))));
    }
    add(this.tabbedPane, BorderLayout.CENTER);
  } else {
    this.tabbedPane.addTab(tabName(1), new JScrollPane(graphDisplay(graphs.get(0))));
    add(this.tabbedPane, BorderLayout.CENTER);
  }
  this.tabbedPane.validate();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf-testrunner-ui

private void replaceView(JSplitPane oldView, JSplitPane newView){
  for (int i=0; i < tabPane.getTabCount(); i++){
    if (oldView.equals(tabPane.getComponentAt(i))){
      tabPane.setComponentAt(i, newView);
      tabPane.setSelectedComponent(newView);
      tabPane.validate();
      copyFilterMask(oldView, newView);
      continue;
    }
  }
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

public boolean setEditedObject(OWLClassExpression expression) {
  this.expression = expression;
  activeEditors.clear();
  tabbedPane.removeChangeListener(changeListener);
  tabbedPane.removeAll();
  for (OWLClassExpressionEditor editor : editors){
    if (editor.setDescription(this.expression)){
      activeEditors.add(editor);
      tabbedPane.add(editor.getEditorName(), editor.getComponent());
      editor.addStatusChangedListener(inputListener);
    }
  }
  tabbedPane.validate();
  tabbedPane.addChangeListener(changeListener);
  
  selectPreferredEditor();
  
  return !activeEditors.isEmpty(); // then no editors are appropriate for this expression
}

代码示例来源:origin: protegeproject/protege

public boolean setEditedObject(OWLClassExpression expression) {
  this.expression = expression;
  activeEditors.clear();
  tabbedPane.removeChangeListener(changeListener);
  tabbedPane.removeAll();
  for (OWLClassExpressionEditor editor : editors){
    if (editor.setDescription(this.expression)){
      activeEditors.add(editor);
      tabbedPane.add(editor.getEditorName(), editor.getComponent());
      editor.addStatusChangedListener(inputListener);
    }
  }
  tabbedPane.validate();
  tabbedPane.addChangeListener(changeListener);
  
  selectPreferredEditor();
  
  return !activeEditors.isEmpty(); // then no editors are appropriate for this expression
}

代码示例来源:origin: org.protege/protege-editor-owl

public boolean setEditedObject(OWLClassExpression expression) {
  this.expression = expression;
  activeEditors.clear();
  tabbedPane.removeChangeListener(changeListener);
  tabbedPane.removeAll();
  for (OWLClassExpressionEditor editor : editors){
    if (editor.setDescription(this.expression)){
      activeEditors.add(editor);
      tabbedPane.add(editor.getEditorName(), editor.getComponent());
      editor.addStatusChangedListener(inputListener);
    }
  }
  tabbedPane.validate();
  tabbedPane.addChangeListener(changeListener);
  
  selectPreferredEditor();
  
  return !activeEditors.isEmpty(); // then no editors are appropriate for this expression
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

public boolean setEditedObject(OWLClassExpression expression) {
  this.expression = expression;
  activeEditors.clear();
  tabbedPane.removeChangeListener(changeListener);
  tabbedPane.removeAll();
  for (OWLClassExpressionEditor editor : editors){
    if (editor.setDescription(this.expression)){
      activeEditors.add(editor);
      tabbedPane.add(editor.getEditorName(), editor.getComponent());
      editor.addStatusChangedListener(inputListener);
    }
  }
  tabbedPane.validate();
  tabbedPane.addChangeListener(changeListener);
  
  selectPreferredEditor();
  
  return !activeEditors.isEmpty(); // then no editors are appropriate for this expression
}

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

private void ensureCurrentLayout()
{
  if (!tabPane.isValid())
  {
    tabPane.validate();
  }
  /* If tabPane doesn't have a peer yet, the validate() call will
   * silently fail.  We handle that by forcing a layout if tabPane
   * is still invalid.  See bug 4237677.
   */
  if (!tabPane.isValid())
  {
    TabbedPaneLayout layout= (TabbedPaneLayout) tabPane.getLayout();
    layout.calculateLayoutInfo();
  }
}

代码示例来源:origin: khuxtable/seaglass

/**
 * Make sure we have laid out the pane with the current layout.
 */
private void ensureCurrentLayout() {
  if (!tabPane.isValid()) {
    tabPane.validate();
  }
  /*
   * If tabPane doesn't have a peer yet, the validate() call will silently
   * fail. We handle that by forcing a layout if tabPane is still invalid.
   * See bug 4237677.
   */
  if (!tabPane.isValid()) {
    TabbedPaneLayout layout = (TabbedPaneLayout) tabPane.getLayout();
    layout.calculateLayoutInfo();
  }
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Ensures the current layout.
 */
protected void ensureCurrentLayout() {
  if (!this.tabPane.isValid()) {
    this.tabPane.validate();
  }
  /*
   * If tabPane doesn't have a peer yet, the validate() call will silently
   * fail. We handle that by forcing a layout if tabPane is still invalid.
   * See bug 4237677.
   */
  if (!this.tabPane.isValid()) {
    LayoutManager lm = this.tabPane.getLayout();
    if (lm instanceof BasicTabbedPaneUI.TabbedPaneLayout) {
      BasicTabbedPaneUI.TabbedPaneLayout layout = (BasicTabbedPaneUI.TabbedPaneLayout) lm;
      layout.calculateLayoutInfo();
    }
  }
}

代码示例来源:origin: org.java.net.substance/substance

/**
 * Ensures the current layout.
 */
protected void ensureCurrentLayout() {
  if (!this.tabPane.isValid()) {
    this.tabPane.validate();
  }
  /*
   * If tabPane doesn't have a peer yet, the validate() call will silently
   * fail. We handle that by forcing a layout if tabPane is still invalid.
   * See bug 4237677.
   */
  if (!this.tabPane.isValid()) {
    LayoutManager lm = this.tabPane.getLayout();
    if (lm instanceof BasicTabbedPaneUI.TabbedPaneLayout) {
      BasicTabbedPaneUI.TabbedPaneLayout layout = (BasicTabbedPaneUI.TabbedPaneLayout) lm;
      layout.calculateLayoutInfo();
    }
  }
}

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

tabs.validate();

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

tabbedPane.validate();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

kenaiProjectsTabPane.validate();

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

void addTabPanel(JPanel panel) {
  if (getComponentCount() == 0) {
    add(panel, BorderLayout.CENTER);
  } else {
    Component comp = getComponent(0);
    if (comp instanceof JTabbedPane) {
      ((JTabbedPane) comp).addTab(panel.getName() + "  ", null, panel, panel.getToolTipText()); // NOI18N
      ((JTabbedPane) comp).setSelectedComponent(panel);
      comp.validate();
    } else if (comp instanceof JButton) {
      setName(panel.getToolTipText());
      remove(comp);
      add(panel, BorderLayout.CENTER);
    } else {
      setName(getMessage("CTL_CallGraphTopComponent")); // NOI18N
      remove(comp);
      JTabbedPane pane = TabbedPaneFactory.createCloseButtonTabbedPane();
      pane.addMouseListener(listener);
      pane.addPropertyChangeListener(closeL);
      add(pane, BorderLayout.CENTER);
      pane.addTab(comp.getName() + "  ", null, comp, ((JPanel) comp).getToolTipText()); //NOI18N
      pane.addTab(panel.getName() + "  ", null, panel, panel.getToolTipText()); //NOI18N
      pane.setSelectedComponent(panel);
      pane.validate();
    }
  }
  validate();
  requestActive();
}

相关文章

JTabbedPane类方法