javax.swing.JButton.setLayout()方法的使用及代码示例

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

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

JButton.setLayout介绍

暂无

代码示例

代码示例来源: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: stackoverflow.com

public Window() {

  JButton button = new JButton("=");
  button.setBounds(530, 510, 50, 50);
  button.setLayout(null);
  button.setVisible(true);

  JPanel panel = new drawPanel();

  JFrame frame = new JFrame("Title");

//  frame.setLayout(new FlowLayout());
  frame.setVisible(true);
  frame.setSize(600, 600);
  frame.setResizable(false);
  frame.setLocationRelativeTo(null);
  frame.add(panel);

  panel.add(button);
}

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

JButton btn = new JButton();
btn.add(new JLabel(text));
btn.add(new JLabel(img));
btn.setLayout(/*best layout choice here*/);
btn.setPreferredSize(new Dimension(x,y));
btn.setMaximumSize(new Dimension(maxX, minY));
btn.setMinimumSize(new Dimension(minX, minY)); //this one is most important when it comes to layoutmanagers

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

letter.setLayout(null);
letter.setSize(btnSize, btnSize);
letter.setLocation(x,y);

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

JButton j1=new JButton("a");
j1.setLayout(null);
j1.setBackground(Color.red);
JButton j2=new JButton("b");
j2.setBackground(Color.yellow);
j2.setBounds(100, 100, 50, 50);
j1.add(j2);
add(j1);

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

public class JavaApplication51 extends JApplet {
  public  void something() {
    JButton button = new JButton("Click for more");             
    add(button);
    setLayout(null);
    button.setLayout(null);
    button.setLocation(100,100);
    button.setSize(101,20);
    setVisible(true); 
  }

  public void paint(Graphics g) {
    super.paint(g);
    g.drawString("Hello", 200, 50);
  }

  public void init() {
    something();
  }
}

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

public class MainAc extends JFrame {

public static void main(String[] args) {
  new MainAc();
}

public MainAc() {
  super("Class Paint");       
  JButton button = new JButton("Click for more");             
  setSize(800, 600);    
  add(button);
  setLayout(null);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  button.setLayout(null);
  button.setLocation(100,100);
  button.setSize(200,100);
  setVisible(true);
}

public void paint(Graphics g) {
  super.paint(g);
  g.drawString("Hello", 200, 50);
}

}

代码示例来源:origin: com.googlecode.gstreamer-java/gstreamer-java

player.setControlsVisible(false);
JButton button = new JButton(file.getName());
button.setLayout(new BoxLayout(button, BoxLayout.Y_AXIS));
button.add(player);

代码示例来源:origin: CFPAOrg/I18nUpdateMod

btCancel.setLayout(new GridLayout(3, 2, 5, 5));
btCancel.setSize(width / 5, height / 5);
contentPane.add(btCancel);
btBackground.setLayout(new GridLayout(3, 2, 5, 5));
btBackground.setSize(width / 5, height / 5);
contentPane.add(btBackground);

代码示例来源:origin: net.sf.mmax2/mmax2

searchButton.setLayout(new FlowLayout(FlowLayout.RIGHT));
searchButton.addActionListener(this);
searchButton.setActionCommand("search");
clearButton.setLayout(new FlowLayout(FlowLayout.RIGHT));

相关文章

JButton类方法