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

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

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

JTabbedPane.getComponents介绍

暂无

代码示例

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

@Override public List<Component> containsComponentOfClass(Class comp) {
  List<Component> list = new ArrayList<Component>();
  synchronized (lock) {
    for (Component c : tabs.getComponents()) {
      if (comp.isInstance(c))
        list.add(c);
    }
  }
  return list;
}

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

/**
 * Gets the item of an open tab with the given URL and quality, if the
 * process isn't running anymore and the quality isn't null (which would
 * mean that the user wants to select the quality).
 * 
 * @param url The URL
 * @param quality The quality
 * @return An Item with the given requirements, or null if none was found
 */
private Item getExisitingItem(String url, String quality) {
  for (Object o : tabs.getComponents()) {
    if (o instanceof Item) {
      Item item = (Item)o;
      if (!item.running && item.quality != null
          && item.quality.equals(quality) && item.url.equals(url)) {
        return item;
      }
    }
  }
  return null;
}

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

private void addTab(final String title, final Component component, final char hotkey) {
 tabsPanel.addTab(title, null, component, "Hotkey: CTRL+" + hotkey);
 SwingComponents.addKeyListenerWithMetaAndCtrlMasks(this, hotkey,
   () -> tabsPanel.setSelectedIndex(Arrays.asList(tabsPanel.getComponents()).indexOf(component)));
}

代码示例来源:origin: igniterealtime/Spark

public SparkTab getTabContainingComponent(Component component) {
  for (Component comp : pane.getComponents()) {
    if (comp instanceof SparkTab) {
      SparkTab tab = (SparkTab) comp;
      if (tab.getComponent() == component)
        return tab;
    }
  }
  return null;
}

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

public void actionPerformed(ActionEvent e) {
    for (Component c:chats.getComponents()) {
      if (c instanceof ChatPanel) {
        removeChat((ChatPanel) c);
      }
    }
  }
}

代码示例来源:origin: tulskiy/musique

public SettingsDialog(JComponent owner, String tabName) {
  this(owner);
  for (Component component : tabs.getComponents()) {
    if (component.getName().equals(tabName)) {
      tabs.setSelectedComponent(component);
      break;
    }
  }
}

代码示例来源:origin: igniterealtime/Spark

public int indexOfComponent(Component component) {
  for (Component comp : pane.getComponents()) {
    if (comp instanceof SparkTab) {
      SparkTab tab = (SparkTab) comp;
      if (tab.getComponent() == component)
        return pane.indexOfComponent(tab);
    }
  }
  return -1;
}

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

public void actionPerformed(ActionEvent e) {
    for (Component c:chats.getComponents()) {
      if (c instanceof ChatPanel) {
        if (!c.isShowing())
          removeChat((ChatPanel) c);
      }
    }
  }
}

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

private void closeAll(boolean butCurrent) {
  Component current = tabPane.getSelectedComponent();
  Component[] c =  tabPane.getComponents();
  for (int i = 0; i< c.length; i++) {
    if (butCurrent && c[i]==current) {
      continue;
    }
    if(c[i] instanceof JSplitPane) {
      removeView((JSplitPane) c[i]);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-terminal-nb

private void closeAll(boolean butCurrent) {
if (soleComponent == null) {
  Component current = tabbedPane.getSelectedComponent();
  Component[] c = tabbedPane.getComponents();
  for (int i = 0; i < c.length; i++) {
  if (butCurrent && c[i] == current) {
    continue;
  }
  // remove only terminals, not scroll panes and viewports
  if (c[i] instanceof Terminal) {
    removeTab((JComponent)c[i]);
  }
  }
}
}

代码示例来源:origin: otros-systems/otroslogviewer

@Override
 protected void actionPerformedHook(ActionEvent e) {
  final StatsService statsService = getOtrosApplication().getServices().getStatsService();
  final Map<String, Long> stats = statsService.getStats();
  final OptionalInt max = stats.keySet().stream().mapToInt(String::length).max();
  String content = stats
   .entrySet()
   .stream()
   .sorted(Comparator.comparing(Map.Entry::getKey))
   .map(entry -> String.format("%1$-" + max.orElse(0) + "s", entry.getKey()) + "=" + entry.getValue())
   .collect(Collectors.joining("\n"));
  message.setText(content);
  final JTabbedPane jTabbedPane = getOtrosApplication().getJTabbedPane();
  final boolean alreadyOpen = Arrays
   .stream(jTabbedPane.getComponents())
   .anyMatch(c -> c == scrollPane);

  if (alreadyOpen) {
   jTabbedPane.setSelectedComponent(scrollPane);
  } else {
   getOtrosApplication().addClosableTab("Statistics", "Statistics", Icons.DOCUMENT_NUMBER, scrollPane, true);
  }

 }
}

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

private void closeAllButCurrent() {
  Component comp = getComponent(0);
  if (comp instanceof JTabbedPane) {
    JTabbedPane tabs = (JTabbedPane) comp;
    Component current = tabs.getSelectedComponent();
    Component[] c =  tabs.getComponents();
    for (int i = 0; i< c.length; i++) {
      if (c[i]!=current) {
        if (c[i] instanceof CallGraphPanel) {
          removePanel((CallGraphPanel) c[i]);
        }
      }
    }
  }
}

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

@Override
public void componentClosed() {
  if (getComponentCount() == 0) {
    return;
  }
  Component comp = getComponent(0);
  if (comp instanceof JTabbedPane) {
    JTabbedPane pane = (JTabbedPane) comp;
    Component[] c =  pane.getComponents();
    for (int i = 0; i< c.length; i++) {
      if (c[i] instanceof CallGraphPanel) {
        removePanel((CallGraphPanel) c[i]);
      }
    }
  } else if (comp instanceof CallGraphPanel) {
    removePanel((CallGraphPanel) comp);
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  if (!enabled) {
    grid.clearSelection();
    grid.getTableHeader().setEnabled(false);
    grid.setEnabled(false);
    for (Component c : tabbedPane.getComponents()) {
      c.setEnabled(false);
    }
    tabbedPane.setEnabled(false);
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  if (!enabled) {
    optionsGrid.clearSelection();
    optionsGrid.getTableHeader().setEnabled(false);
    optionsGrid.setEnabled(false);
    for (Component c : toolBar.getComponents()) {
      c.setEnabled(false);
    }
    toolBar.setEnabled(false);
    for (Component c : tabbedPane.getComponents()) {
      c.setEnabled(false);
    }
    tabbedPane.setEnabled(false);
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  if (!enabled) {
    grid.clearSelection();
    grid.getTableHeader().setEnabled(false);
    grid.setEnabled(false);
    for (Component c : toolBar.getComponents()) {
      c.setEnabled(false);
    }
    toolBar.setEnabled(false);
    for (Component c : tabbedPane.getComponents()) {
      c.setEnabled(false);
    }
    tabbedPane.setEnabled(false);
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  if (!enabled) {
    grid.clearSelection();
    grid.getTableHeader().setEnabled(false);
    grid.setEnabled(false);
    for (Component c : toolBar.getComponents()) {
      c.setEnabled(false);
    }
    toolBar.setEnabled(false);
    for (Component c : tabbedPane.getComponents()) {
      c.setEnabled(false);
    }
    tabbedPane.setEnabled(false);
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  if (!enabled) {
    schemasGrid.clearSelection();
    schemasGrid.getTableHeader().setEnabled(false);
    schemasGrid.setEnabled(false);
    for (Component c : schemasToolBar.getComponents()) {
      c.setEnabled(false);
    }
    schemasToolBar.setEnabled(false);
    for (Component c : tabbedPane.getComponents()) {
      c.setEnabled(false);
    }
    propsGrid.clearSelection();
    propsGrid.getTableHeader().setEnabled(false);
    propsGrid.setEnabled(false);
    for (Component c : propsToolBar.getComponents()) {
      c.setEnabled(false);
    }
    propsToolBar.setEnabled(false);
    for (Component c : tabbedPane.getComponents()) {
      c.setEnabled(false);
    }
    tabbedPane.setEnabled(false);
  }
}

代码示例来源:origin: org.boofcv/boofcv-swing

private void removeProcessTab(ActiveProcess process, boolean autoClose ) {
  //interval removed listener is called after element is removed, so the reference
  //can't be retrieved. we call removeProcessTab() here for that reason.
  int index = -1;
  //lookup tab by process, assume one tab per process
  for (int i = 0; i < outputPanel.getComponents().length; i++) {
    ProcessTabPanel component = (ProcessTabPanel) outputPanel.getComponent(i);
    if (component.getProcessId() == process.getId()) {
      if( autoClose && !checkRemoveOnDeath.isSelected() ) {
        processList.repaint();
        return;
      }
      index = i;
    }
  }
  if (index == -1)
    return;
  outputPanel.remove(index);
  listModel.removeElement(process);
  processList.invalidate();
}

代码示例来源:origin: fr.ifremer/isis-fish

factorWizardUI.getContextValue(SimulAction.class), factorWizardUI.isEditingState());
} else {
  Component[] discreteComponents = factorWizardUI.getTabPane().getComponents();
  saveDiscret(factorWizardUI.getFactorNameField().getText(),
      factorWizardUI.getComment().getText(), factorWizardUI.getFactorPath(), discreteComponents,

相关文章

JTabbedPane类方法