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

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

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

JPanel.setBounds介绍

暂无

代码示例

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

lpane.setBounds(0, 0, 600, 400);
panelBlue.setBackground(Color.BLUE);
panelBlue.setBounds(0, 0, 600, 400);
panelBlue.setOpaque(true);
panelGreen.setBackground(Color.GREEN);
panelGreen.setBounds(200, 100, 100, 100);
panelGreen.setOpaque(true);
lpane.add(panelBlue, new Integer(0), 0);

代码示例来源:origin: alibaba/druid

@Override
public void componentResized(ComponentEvent arg0) {
  scrollPane.setBounds(10, 10, getWidth() - 20, getHeight() - 80);
  copyrightPanel.setBounds(10, getHeight() - 60, getWidth() - 20, 60);
}

代码示例来源:origin: alibaba/druid

copyrightPanel.setBounds(10, getHeight() - 60, getWidth() - 20, 60);

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

@Override
public void setBounds(Rectangle r) {
  super.setBounds(r);
  this.textOffsetY = r.height - this.textOffsetButtonY;
  this.buttonSize = r;
}

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

@Override
public void setBounds(int x, int y, int width, int height) {
  super.setBounds(x, y, width, height);
  this.textOffsetY = height - this.textOffsetButtonY;
  this.buttonSize = new Rectangle(x, y, width, height);
}

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

JFrame f = new JFrame();
f.setLayout(null);
f.setDefaultCloseOperation(3);
f.setSize(500, 500);
JPanel p = new JPanel() {
  @Override
  protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Dimension arcs = new Dimension(15,15);
   int width = getWidth();
   int height = getHeight();
   Graphics2D graphics = (Graphics2D) g;
   graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   //Draws the rounded opaque panel with borders.
   graphics.setColor(getBackground());
   graphics.fillRoundRect(0, 0, width-1, height-1, arcs.width, arcs.height);//paint background
   graphics.setColor(getForeground());
   graphics.drawRoundRect(0, 0, width-1, height-1, arcs.width, arcs.height);//paint border
  }
};
p.setBounds(10,10,100,30);
p.setOpaque(false);
f.getContentPane().setBackground(Color.red);
f.add(p);
f.show();

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

private void setGUISizeTooltipContainer() {
  try {
    int height = GUISizeHelper.enlargedImageHeight;
    int width = (int) ((float) height * (float) 0.64);
    JPanel cardPreviewContainer = (JPanel) UI.getComponent(MageComponents.CARD_PREVIEW_CONTAINER);
    cardPreviewContainer.setBounds(0, 0, width + 80, height + 30);
    BigCard bigCard = (BigCard) UI.getComponent(MageComponents.CARD_PREVIEW_PANE);
    bigCard.setSize(width, height);
    JPanel cardPreviewContainerRotated = (JPanel) UI.getComponent(MageComponents.CARD_PREVIEW_CONTAINER_ROTATED);
    cardPreviewContainerRotated.setBounds(0, 0, height + 80, width + 100 + 30);
    BigCard bigCardRotated = (BigCard) UI.getComponent(MageComponents.CARD_PREVIEW_PANE_ROTATED);
    bigCardRotated.setSize(height, width + 30);
  } catch (Exception e) {
    LOGGER.warn("Error while changing tooltip container size.", e);
  }
}

代码示例来源:origin: com.alibaba/druid

@Override
public void componentResized(ComponentEvent arg0) {
  scrollPane.setBounds(10, 10, getWidth() - 20, getHeight() - 80);
  copyrightPanel.setBounds(10, getHeight() - 60, getWidth() - 20, 60);
}

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

pnlLeft.setBounds(0, 5, 90, 136);
pnlRight.setBounds(140, 5, 90, 136);

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

cardPreviewContainer.setBounds(0, 0, width + 80, height + 30);
cardPreviewContainerRotated.add(bigCard);
cardPreviewContainerRotated.setVisible(false);
cardPreviewContainerRotated.setBounds(0, 0, height + 80, width + 100 + 30);

代码示例来源:origin: com.alibaba/druid

copyrightPanel.setBounds(10, getHeight() - 60, getWidth() - 20, 60);

代码示例来源:origin: cytoscape.coreplugins/cpath2

/**
 * Our implementation of set bounds.
 */
public void setBounds(int x, int y, int width, int height) {
  super.setBounds(x, y, width, height);
  m_img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
}

代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget

@Override
public void setBounds(Rectangle r) {
  r.height = Math.round(r.height / scale);
  r.width = Math.round(r.width / scale);
  super.setBounds(r);
}

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

@Override
public void layoutContainer(Container parent) {
  Dimension fpp = fixedPanel.getPreferredSize();
  int dx = (parent.getWidth() - fpp.width) / 2;
  int dy = (parent.getHeight() - fpp.height) / 2;
  fixedPanel.setBounds(dx, dy, fpp.width, fpp.height);
}

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

ExamplePanel panel = new ExamplePanel();
panel.setLayout( null ); // now you set the size/location of any component you add to the panel

JPanel example1 = new JPanel();
example1.setBackground( Color.GREEN );
example1.setBorder( new LineBorder(Color.BLACK) );
example1.setBounds( new Rectangle(....) );

panel.add(example1);

代码示例来源:origin: org.mobicents.protocols.ss7.tools.simulator/simulator-gui

private JPanel createSection(JPanel tab,String name,int y_pos, int height) {
  JPanel panel = new JPanel();
  panel.setLayout(null);
  panel.setBorder(new LineBorder(new Color(0, 0, 0)));
  panel.setBounds(26, y_pos, 511, height);
  tab.add(panel);
  JLabel label = new JLabel(name);
  label.setBounds(10, 0, 266, 14);
  panel.add(label);
  return panel;
}

代码示例来源:origin: org.mobicents.protocols.ss7.tools.simulator/simulator-gui

private JPanel createSection(JPanel tab,String name,int y_pos, int height) {
  JPanel panel = new JPanel();
  panel.setLayout(null);
  panel.setBorder(new LineBorder(new Color(0, 0, 0)));
  panel.setBounds(26, y_pos, 511, height);
  tab.add(panel);
  JLabel label = new JLabel(name);
  label.setBounds(10, 0, 266, 14);
  panel.add(label);
  return panel;
}

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

@Override
public void setBounds(int x, int y, int width, int height) {
  super.setBounds(x, y, width, height);
  Insets insets = getOverlayLocationInsets();
  x = Math.max(0, insets.left);
  y = Math.max(0, insets.top);
  width -= Math.max(0, insets.left) + Math.max(0, insets.right);
  height -= Math.max(0, insets.top) + Math.max(0, insets.bottom);
  getActualComponent().setBounds(x, y, width, height);
  updateLocation();
}

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

public void setBounds(int x, int y, int w, int h) {
  super.setBounds(x, y, w, h);
  sp.setBounds(0, y + 12, w, h - 23);
  sp.revalidate();
  jt.setBounds(0, 0, w, 20);
}

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

public Triangle() {
  Dimension size = new Dimension(14, 14);
  super.setBounds(getX(), getY(), size.width, size.height);
  setMinimumSize(size);
  setPreferredSize(size);
  setMaximumSize(size);
}

相关文章

微信公众号

最新文章

更多

JPanel类方法