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

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

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

JLabel.setBounds介绍

暂无

代码示例

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

public void createOptions()
  {
    options = new JPanel();
    options.setLayout(null);
    JLabel labelOptions = new JLabel("Change Company Name:");
    labelOptions.setBounds(120, 10, 150, 20);
    options.add(labelOptions);
    newTitle = new JTextField("Some Title");
    newTitle.setBounds(80, 40, 225, 20);
    options.add(newTitle);
//        myTitle = new JTextField("My Title...");
//        myTitle.setBounds(80, 40, 225, 20);
//        myTitle.add(labelOptions);
    JButton newName = new JButton("Set New Name");
    newName.setBounds(60, 80, 150, 20);
    newName.addActionListener(this);
    options.add(newName);
    JButton Exit = new JButton("Exit");
    Exit.setBounds(250, 80, 80, 20);
    Exit.addActionListener(this);
    options.add(Exit);
  }

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

private void addRow(String label, JComponent component) {
  JLabel l = new JLabel(label);
  l.setFont(Theme.SMALL_BOLD_FONT);
  l.setBounds(18, y, 400, 18);
  add(l);
  y += 18;
  int componentHeight = (int) component.getPreferredSize().getHeight();
  component.setBounds(16, y, 400, componentHeight);
  y += componentHeight;
  y += 2; // vertical gap
  add(component);
}

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

private void addRow(String label, JComponent component) {
  JLabel l = new JLabel(label);
  l.setFont(Theme.SMALL_BOLD_FONT);
  l.setBounds(18, y, 400, 18);
  add(l);
  y += 18;
  int componentHeight = (int) component.getPreferredSize().getHeight();
  component.setBounds(16, y, 400, componentHeight);
  y += componentHeight;
  y += 2; // vertical gap
  add(component);
}

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

public ProgressDialog(Frame owner, String title) {
  super(owner, title, false);
  getRootPane().putClientProperty("Window.style", "small");
  setResizable(false);
  setLayout(null);
  Container contentPane = getContentPane();
  contentPane.setLayout(null);
  tasksCompleted = 0;
  this.taskCount = 0;
  progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, taskCount);
  progressBar.setIndeterminate(true);
  progressBar.setBounds(10, 10, 300, 32);
  contentPane.add(progressBar);
  progressLabel = new JLabel();
  progressLabel.setBounds(320, 10, 50, 32);
  progressLabel.setVisible(false);
  contentPane.add(progressLabel);
  messageLabel = new JLabel();
  messageLabel.setBounds(10, 40, 380, 32);
  contentPane.add(messageLabel);
  updateProgress();
  setSize(400, 100);
  setLocationRelativeTo(owner);
}

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

tabResult = new javax.swing.JLayeredPane();
pnlText = new javax.swing.JLayeredPane();
lblGameInfo = new javax.swing.JLabel();
lblMatchInfo = new javax.swing.JLabel();
lblAdditionalInfo = new javax.swing.JLabel();
lblResultImage = new javax.swing.JLabel();
tabStatistics = new javax.swing.JPanel();
lblGameInfo.setText("gameInfo");
pnlText.add(lblGameInfo);
lblGameInfo.setBounds(11, 1, 550, 25);
lblMatchInfo.setText("matchInfo");
pnlText.add(lblMatchInfo);
lblMatchInfo.setBounds(10, 30, 550, 25);
lblAdditionalInfo.setText("additionalInfo");
pnlText.add(lblAdditionalInfo);
lblAdditionalInfo.setBounds(10, 60, 550, 25);
lblResultImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
tabResult.add(lblResultImage);
lblResultImage.setBounds(0, 0, 610, 250);

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

private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle) {
  if (cardDimension == null) {
    cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
  }
  final MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, cardDimension, gameId, true, true);
  cardImg.setBounds(rectangle);
  jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 10);
  cardImg.update(card);
  cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimensions.frameWidth, cardDimensions.frameHeight);
  cardImg.setCardCaptionTopOffset(8); // card caption below real card caption to see full name even with mana icons
  // card number label
  JLabel cardNumber = new JLabel();
  int dy = -5; // image panel have empty space in bottom (bug?), need to move label up
  cardNumber.setBounds(rectangle.x, rectangle.y + cardImg.getHeight() + dy, cardDimensions.frameWidth, 20);
  cardNumber.setHorizontalAlignment(SwingConstants.CENTER);
  //cardNumber.setBorder(BorderFactory.createLineBorder(new Color(180, 50, 150), 3, true));
  cardNumber.setFont(jLayeredPane.getFont().deriveFont(jLayeredPane.getFont().getStyle() | Font.BOLD));
  cardNumber.setText(card.getCardNumber());
  jLayeredPane.add(cardNumber);
}

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

public static JXPanel getDescription(CardView card, int width, int height) {
  JXPanel descriptionPanel = new JXPanel();
  //descriptionPanel.setAlpha(.8f);
  descriptionPanel.setBounds(0, 0, width, height);
  descriptionPanel.setVisible(false);
  descriptionPanel.setLayout(null);
  //descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green));
  JButton j = new JButton("");
  j.setBounds(0, 0, width, height);
  j.setBackground(Color.black);
  j.setLayout(null);
  JLabel cardText = new JLabel();
  cardText.setBounds(5, 5, width - 10, height - 10);
  cardText.setForeground(Color.white);
  cardText.setFont(cardNameFont);
  cardText.setVerticalAlignment(SwingConstants.TOP);
  j.add(cardText);
  TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card);
  cardText.setText(getRulefromCardView(card, textLines).toString());
  descriptionPanel.add(j);
  return descriptionPanel;
}

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

draftLeftPane = new javax.swing.JPanel();
btnQuitTournament = new javax.swing.JButton();
lblPack1 = new javax.swing.JLabel();
txtPack1 = new javax.swing.JTextField();
chkPack1 = new javax.swing.JCheckBox();
lblPack2 = new javax.swing.JLabel();
txtPack2 = new javax.swing.JTextField();
chkPack2 = new javax.swing.JCheckBox();
lblPack3 = new javax.swing.JLabel();
txtPack3 = new javax.swing.JTextField();
chkPack3 = new javax.swing.JCheckBox();
lblTableImage.setVerifyInputWhenFocusTarget(false);
jPanel1.add(lblTableImage);
lblTableImage.setBounds(95, 5, 40, 136);

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

public void Gamelabel() {
   JLabel mylabel = new JLabel();
   mylabel.setBounds(0, 0, 1280, 720);
   mylabel.setVisible(true); //unnecessary 
   this.add(mylabel);
 }

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

private void createLabel(JPanel section, String name, int y_pos) {
  JLabel label = new JLabel(name);
  label.setBounds(10, y_pos, 450, 14);
  section.add(label);
}

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

public class SomeClass {
 private JLabel label03; 

 public void someMethod() {
  label03 = new JLabel("0");
  label03.setIcon(icon);
  label03.setBounds(204, 130, 46, 14);
  getContentPane().add(label03);
 }

 public void setText(String message) {
  label03.setText(message);
 }
}

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

JLabel label = new JLabel("  Games played: " + i);
desktopPane.add(label, JLayeredPane.DEFAULT_LAYER + 1);
label.setVisible(true);
label.setForeground(Color.white);
label.setBounds(0, 0, 180, 30);

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

ImageIcon background = new ImageIcon("Background/background.png");
JLabel label = new JLabel();
label.setBounds(0, 0, x, y);
label.setIcon(background);

JPanel panel = new JPanel();
panel.setLayout(null);
panel.add(label);

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

private JTextField cretateTextField(JPanel section,String name, int y_pos) {
  JLabel label = new JLabel(name);
  label.setBounds(10, y_pos, 174, 14);
  section.add(label);
  JTextField textField = new JTextField();
  textField.setBounds(194, y_pos, 307, 20);
  textField.setColumns(10);
  section.add(textField);
  return textField;
}

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

private JTextField cretateTextField(JPanel section,String name, int y_pos) {
  JLabel label = new JLabel(name);
  label.setBounds(10, y_pos, 174, 14);
  section.add(label);
  JTextField textField = new JTextField();
  textField.setBounds(194, y_pos, 307, 20);
  textField.setColumns(10);
  section.add(textField);
  return textField;
}

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

private JTextField cretateTextField(JPanel section,String name, int y_pos) {
  JLabel label = new JLabel(name);
  label.setBounds(10, y_pos, 174, 14);
  section.add(label);
  JTextField textField = new JTextField();
  textField.setBounds(194, y_pos, 307, 20);
  textField.setColumns(10);
  section.add(textField);
  return textField;
}

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

private JComboBox createCombo(JPanel section, String name, int y_pos) {
  JLabel label = new JLabel(name);
  label.setBounds(10, y_pos, 174, 14);
  section.add(label);
  JComboBox comboBox = new JComboBox();
  comboBox.setBounds(194, y_pos, 307, 20);
  section.add(comboBox);
  return comboBox;
}

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

public void paintComponent(Graphics g) {
  super.paintComponent(g);

  // Draw Text
  g.drawString("This is my custom Panel!",10,20);

  JLabel c = new JLabel("Label");
  c.setBounds(0, 0, 400, 30);
  c.paint(g);
}

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

private JComboBox createCombo(JPanel section,String name, int y_pos) {
  JLabel label = new JLabel(name);
  label.setBounds(10, y_pos, 174, 14);
  section.add(label);
  JComboBox comboBox = new JComboBox();
  comboBox.setBounds(194, y_pos, 307, 20);
  section.add(comboBox);
  return comboBox;
}

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

private JComboBox createCombo(JPanel section,String name, int y_pos) {
  JLabel label = new JLabel(name);
  label.setBounds(10, y_pos, 174, 14);
  section.add(label);
  JComboBox comboBox = new JComboBox();
  comboBox.setBounds(194, y_pos, 307, 20);
  section.add(comboBox);
  return comboBox;
}

相关文章

微信公众号

最新文章

更多

JLabel类方法