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

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

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

JPanel.setComponentZOrder介绍

暂无

代码示例

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

@Override
public void mouseDragged(MouseEvent e, TransferData transferData) {
  CardPanel cardPanel = ((CardPanel) transferData.component);
  if (cardPanel.getZone() == null || !cardPanel.getZone().equalsIgnoreCase("hand")) {
    // drag'n'drop is allowed for HAND zone only
    return;
  }
  if (!SwingUtilities.isLeftMouseButton(e)) {
    // only allow draging with the left mouse button
    return;
  }
  isDragging = true;
  prevCardPanel = cardPanel;
  Point cardPanelLocationOld = cardPanel.getLocation();
  Point mouse = new Point(e.getX(), e.getY());
  SwingUtilities.convertPointToScreen(mouse, transferData.component);
  int xOffset = cardPanel.getXOffset(cardPanel.getCardWidth());
  int newX = Math.max(initialCardPos.x + (int) (mouse.getX() - initialMousePos.x) - xOffset, 0);
  cardPanel.setCardBounds(
      newX,
      cardPanelLocationOld.y + cardPanel.getCardYOffset(),
      cardPanel.getCardWidth(),
      cardPanel.getCardHeight());
  cardPanel.getCardArea().setComponentZOrder(cardPanel, 0);
  sort(cardPanel, cardPanel.getCardArea(), false);
  if (!this.startedDragging) {
    this.startedDragging = true;
  }
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

/**
 * Defines the object z order.
 *
 * @param c the component to chnge
 * @param index the new index of the component
 */
public void setObjectZOrder(Component c, int index) {
  super.setComponentZOrder(c, index);
  super.setComponentZOrder(effectPane, 0);
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

private void adicionaBotaoConfiguracaoEditor(int margemDireita) {
  GridBagConstraints constraints = new GridBagConstraints(3, 0, 1, 1, 0, 0,
      GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
      new Insets(0, 0, 0, margemDireita), 0, 0);
  painelEditor.add(barraBotoesEditor, constraints);
  painelEditor.setComponentZOrder(barraBotoesEditor, 0);
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

private void adicionaBotaoConfiguracaoInspetor(int margemDireita) {
  GridBagConstraints constrainsts = new GridBagConstraints(0, 1, 1, 1, 0, 0,
      GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
      new Insets(0, 0, 0, margemDireita), 0, 0);
  treePanel.add(barraBotoesInspetorArvore, constrainsts);
  treePanel.setComponentZOrder(barraBotoesInspetorArvore, 0);
}

代码示例来源:origin: RPTools/maptool

public void showControlPanel(JPanel... panels) {
  JPanel layoutPanel = new JPanel(new GridBagLayout());
  layoutPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
  int i = 0;
  for (JPanel panel : panels) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = i;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.BOTH;
    layoutPanel.add(panel, gbc);
    i++;
  }
  layoutPanel.setSize(layoutPanel.getPreferredSize());
  zoneRendererPanel.add(layoutPanel, PositionalLayout.Position.NE);
  zoneRendererPanel.setComponentZOrder(layoutPanel, 0);
  zoneRendererPanel.revalidate();
  zoneRendererPanel.repaint();
  visibleControlPanel = layoutPanel;
}

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

public static void main(String[] args) {
  final JFrame f = new JFrame("foo");
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  final JPanel c = new JPanel(null);
  f.setContentPane(c);
  c.setPreferredSize(new Dimension(500, 500));
  final JPanel a = new JPanel();
  a.setBounds(0, 0, 300, 300);
  a.setBackground(Color.red);
  c.add(a);
  final JPanel b = new JPanel();
  b.setBounds(200, 200, 300, 300);
  b.setBackground(Color.green);
  c.add(b);
  c.setComponentZOrder(a, 0);
  f.pack();
  f.setVisible(true);
  f.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      c.repaint();
    }
  });
}

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

page.setLocation(0, 0);
pages.add(page);
pages.setComponentZOrder(page, pages.getComponentCount() - 1);
SwingUtilities.invokeLater(new Runnable() {
  @Override public void run() { doLayout(); }});
direction = true;
Component next = pages.getComponents()[pages.getComponentCount() - 1];
pages.setComponentZOrder(next, 1);
animation.start();
leftButton.setEnabled(false);
  } else {
    if (direction) {
      pages.setComponentZOrder(onTop, 1);
    } else {
      pages.setComponentZOrder(onTop, pages.getComponentCount() - 1);

相关文章

JPanel类方法