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

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

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

JButton.setLayout介绍

暂无

代码示例

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

  1. public static JXPanel getDescription(CardView card, int width, int height) {
  2. JXPanel descriptionPanel = new JXPanel();
  3. //descriptionPanel.setAlpha(.8f);
  4. descriptionPanel.setBounds(0, 0, width, height);
  5. descriptionPanel.setVisible(false);
  6. descriptionPanel.setLayout(null);
  7. //descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green));
  8. JButton j = new JButton("");
  9. j.setBounds(0, 0, width, height);
  10. j.setBackground(Color.black);
  11. j.setLayout(null);
  12. JLabel cardText = new JLabel();
  13. cardText.setBounds(5, 5, width - 10, height - 10);
  14. cardText.setForeground(Color.white);
  15. cardText.setFont(cardNameFont);
  16. cardText.setVerticalAlignment(SwingConstants.TOP);
  17. j.add(cardText);
  18. TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card);
  19. cardText.setText(getRulefromCardView(card, textLines).toString());
  20. descriptionPanel.add(j);
  21. return descriptionPanel;
  22. }

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

  1. public Window() {
  2. JButton button = new JButton("=");
  3. button.setBounds(530, 510, 50, 50);
  4. button.setLayout(null);
  5. button.setVisible(true);
  6. JPanel panel = new drawPanel();
  7. JFrame frame = new JFrame("Title");
  8. // frame.setLayout(new FlowLayout());
  9. frame.setVisible(true);
  10. frame.setSize(600, 600);
  11. frame.setResizable(false);
  12. frame.setLocationRelativeTo(null);
  13. frame.add(panel);
  14. panel.add(button);
  15. }

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

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

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

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

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

  1. JButton j1=new JButton("a");
  2. j1.setLayout(null);
  3. j1.setBackground(Color.red);
  4. JButton j2=new JButton("b");
  5. j2.setBackground(Color.yellow);
  6. j2.setBounds(100, 100, 50, 50);
  7. j1.add(j2);
  8. add(j1);

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

  1. public class JavaApplication51 extends JApplet {
  2. public void something() {
  3. JButton button = new JButton("Click for more");
  4. add(button);
  5. setLayout(null);
  6. button.setLayout(null);
  7. button.setLocation(100,100);
  8. button.setSize(101,20);
  9. setVisible(true);
  10. }
  11. public void paint(Graphics g) {
  12. super.paint(g);
  13. g.drawString("Hello", 200, 50);
  14. }
  15. public void init() {
  16. something();
  17. }
  18. }

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

  1. public class MainAc extends JFrame {
  2. public static void main(String[] args) {
  3. new MainAc();
  4. }
  5. public MainAc() {
  6. super("Class Paint");
  7. JButton button = new JButton("Click for more");
  8. setSize(800, 600);
  9. add(button);
  10. setLayout(null);
  11. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  12. button.setLayout(null);
  13. button.setLocation(100,100);
  14. button.setSize(200,100);
  15. setVisible(true);
  16. }
  17. public void paint(Graphics g) {
  18. super.paint(g);
  19. g.drawString("Hello", 200, 50);
  20. }
  21. }

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

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

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

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

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

  1. searchButton.setLayout(new FlowLayout(FlowLayout.RIGHT));
  2. searchButton.addActionListener(this);
  3. searchButton.setActionCommand("search");
  4. clearButton.setLayout(new FlowLayout(FlowLayout.RIGHT));

相关文章

JButton类方法