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

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

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

JDesktopPane.getComponents介绍

暂无

代码示例

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

public void watchGame(UUID gameId) {
  for (Component component : desktopPane.getComponents()) {
    if (component instanceof GamePane
        && ((GamePane) component).getGameId().equals(gameId)) {
      setActive((GamePane) component);
      return;
    }
  }
  GamePane gamePane = new GamePane();
  desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
  gamePane.setVisible(true);
  gamePane.watchGame(gameId);
  setActive(gamePane);
}

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

public void showTournament(UUID tournamentId) {
  for (Component component : desktopPane.getComponents()) {
    if (component instanceof TournamentPane
        && ((TournamentPane) component).getTournamentId().equals(tournamentId)) {
      setActive((TournamentPane) component);
      return;
    }
  }
  TournamentPane tournamentPane = new TournamentPane();
  desktopPane.add(tournamentPane, JLayeredPane.DEFAULT_LAYER);
  tournamentPane.setVisible(true);
  tournamentPane.showTournament(tournamentId);
  setActive(tournamentPane);
}

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

public void hideTables() {
  this.saveDividerLocations();
  for (Component component : MageFrame.getDesktop().getComponents()) {
    if (component instanceof TableWaitingDialog) {
      ((TableWaitingDialog) component).closeDialog();
    }
  }
  stopTasks();
  this.chatPanelMain.getUserChatPanel().disconnect();
  Component c = this.getParent();
  while (c != null && !(c instanceof TablesPane)) {
    c = c.getParent();
  }
  if (c != null) {
    ((TablesPane) c).hideFrame();
  }
}

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

public void changeGUISize() {
  ImageCaches.flush();
  setGUISize();
  setGUISizeTooltipContainer();
  Plugins.instance.changeGUISize();
  CountryUtil.changeGUISize();
  for (Component component : desktopPane.getComponents()) {
    if (component instanceof MageDialog) {
      ((MageDialog) component).changeGUISize();
    }
    if (component instanceof MagePane) {
      ((MagePane) component).changeGUISize();
    }
  }
  for (ChatPanelBasic chatPanel : CHATS.values()) {
    chatPanel.changeGUISize(GUISizeHelper.chatFont);
  }
  try {
    CardInfoPaneImpl cardInfoPane = (CardInfoPaneImpl) UI.getComponent(MageComponents.CARD_INFO_PANE);
    if (cardInfoPane != null) {
      cardInfoPane.changeGUISize();
    }
  } catch (Exception ex) {
    ex.printStackTrace();
  }
  this.revalidate();
  this.repaint();
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

public OVTKGraphManager(JDesktopPane desktopPane) {
  for (Component c : desktopPane.getComponents()) {
    if (c instanceof OVTK2PropertiesAggregator) {
      OVTK2PropertiesAggregator v = (OVTK2PropertiesAggregator) c;
      ONDEXGraph g = v.getONDEXJUNGGraph();
      graphsByName.put(g.getName(), g);
      List<OVTK2PropertiesAggregator> viewers = graphsToViewer.get(g);
      if (viewers == null) {
        viewers = new ArrayList<OVTK2PropertiesAggregator>();
        graphsToViewer.put(g, viewers);
      }
      viewers.add(v);
    }
  }
}

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

public class Window extends Frame {
  JScrollPane scrollContainer = new JScrollPane();
  JDesktopPane mainWorkingPane = new JDesktopPane();

  public Window() {
    scrollContainer.setViewportView(mainWorkingPane);

    addComponentListener(new ComponentAdapter() {
      public void componentResized(ComponentEvent evt) {
        revalidateDesktopPane();
      }
    });
  }

  private void revalidateDesktopPane() {
    Dimension dim = new Dimension(0,0);
    Component[] com = mainWorkingPane.getComponents();
    for (int i=0 ; i<com.length ; i++) {
      int w = (int) dim.getWidth()+com[i].getWidth();
      int h = (int) dim.getHeight()+com[i].getHeight();
      dim.setSize(new Dimension(w,h));
    }
    mainWorkingPane.setPreferredSize(dim);
    mainWorkingPane.revalidate();
    revalidate();
    repaint();  
  }
}

代码示例来源:origin: cytoscape/application

private void restoreDesktopState() {
  final List<NetworkFrame> frames = session.getSessionState()
      .getDesktop().getNetworkFrames().getNetworkFrame();
  final Map<String, NetworkFrame> frameMap = new HashMap<String, NetworkFrame>();
  for (NetworkFrame netFrame : frames)
    frameMap.put(netFrame.getFrameID(), netFrame);
  Component[] desktopFrames = Cytoscape.getDesktop()
      .getNetworkViewManager().getDesktopPane().getComponents();
  for (int i = 0; i < desktopFrames.length; i++) {
    Component cmp;
    cmp = desktopFrames[i];
    if (cmp instanceof JInternalFrame) {
      JInternalFrame frame = (JInternalFrame) cmp;
      NetworkFrame nFrame = frameMap.get(frame.getTitle());
      if (nFrame != null) {
        frame.setSize(nFrame.getWidth().intValue(), nFrame
            .getHeight().intValue());
        frame.setLocation(nFrame.getX().intValue(), nFrame.getY()
            .intValue());
      }
    }
  }
}

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

public void componentResized(ComponentEvent e) {
    if (frame != null && frame.isMaximum()) {
      JDesktopPane desktop = (JDesktopPane) e.getSource();
      for (Component comp : desktop.getComponents()) {
        if (comp instanceof SeaGlassDesktopPaneUI.TaskBar) {
          frame.setBounds(0, 0, desktop.getWidth(), desktop.getHeight() - comp.getHeight());
          frame.revalidate();
          break;
        }
      }
    }
    // Update the new parent bounds for next resize, but don't
    // let the super method touch this frame
    JInternalFrame f = frame;
    frame = null;
    super.componentResized(e);
    frame = f;
  }
};

代码示例来源:origin: cytoscape/application

private void setDesktopStates() throws JAXBException {
  DesktopSize dSize = factory.createDesktopSize();
  NetworkFrames frames = factory.createNetworkFrames();
  Component[] networkFrames = Cytoscape.getDesktop().getNetworkViewManager().getDesktopPane()
                     .getComponents();
  for (int i = 0; i < networkFrames.length; i++) {
    if(networkFrames[i] instanceof JInternalFrame) {
      JInternalFrame networkFrame = (JInternalFrame) networkFrames[i];
      NetworkFrame frame = factory.createNetworkFrame();
      frame.setFrameID(networkFrame.getTitle());
      frame.setWidth(BigInteger.valueOf(networkFrame.getWidth()));
      frame.setHeight(BigInteger.valueOf(networkFrame.getHeight()));
      frame.setX(BigInteger.valueOf(networkFrame.getX()));
      frame.setY(BigInteger.valueOf(networkFrame.getY()));
      frames.getNetworkFrame().add(frame);
    }
  }
  dSize.setHeight(BigInteger.valueOf(Cytoscape.getDesktop().getSize().height));
  dSize.setWidth(BigInteger.valueOf(Cytoscape.getDesktop().getSize().width));
  Desktop desktop = factory.createDesktop();
  desktop.setDesktopSize(dSize);
  desktop.setNetworkFrames(frames);
  sState.setDesktop(desktop);
}

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

protected void installDefaults() {
  updateStyle(desktop);
  if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
    taskBar = new TaskBar();
    for (Component comp : desktop.getComponents()) {
      JInternalFrame.JDesktopIcon desktopIcon;
      if (comp instanceof JInternalFrame.JDesktopIcon) {
        desktopIcon = (JInternalFrame.JDesktopIcon) comp;
      } else if (comp instanceof JInternalFrame) {
        desktopIcon = ((JInternalFrame) comp).getDesktopIcon();
      } else {
        continue;
      }
      // Move desktopIcon from desktop to taskBar
      if (desktopIcon.getParent() == desktop) {
        desktop.remove(desktopIcon);
      }
      if (desktopIcon.getParent() != taskBar) {
        taskBar.add(desktopIcon);
        desktopIcon.getInternalFrame().addComponentListener(taskBar);
      }
    }
    taskBar.setBackground(desktop.getBackground());
    desktop.add(taskBar, new Integer(JLayeredPane.PALETTE_LAYER.intValue() + 1));
    if (desktop.isShowing()) {
      taskBar.adjustSize();
    }
  }
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-experimental

@Override
public void internalFrameClosing(InternalFrameEvent e) {
  for (Component c : OVTK2Desktop.getInstance().getDesktopPane()
      .getComponents()) {
    if (c instanceof GCutAndPasteTransfer) {
      try {

相关文章