Position « Button « Java Swing Q&A





1. Java: Swing: Set position of JButton    stackoverflow.com

I wanted to realize the following layout:

--------------------------------------------
|                         ...

2. get jButton position "deprecated" function    stackoverflow.com

I just want to ask you for the appropriate function for the button. BY using the function below, Eclipse notifies me that the function is "deprecated".

jButton.bounds();
My question to you is ...

3. change position of a JButton??????    coderanch.com

4. Positioning of JButton    coderanch.com

import javax.swing.*; import java.awt.*; class Testing { public void buildGUI() { JButton btn = new JButton("OK"); JPanel p = new JPanel(new GridBagLayout()); p.add(btn, new GridBagConstraints()); JFrame f = new JFrame(); f.getContentPane().add(p); f.setSize(600,400); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run(){ new Testing().buildGUI(); } }); } }

5. Position 5 buttons with GridBagConstraints in Swing    coderanch.com

How to position 5 buttons with GridBagConstraints in Swing so that the first button (B1) are at the first column, the next four buttons (B2, B3, B4, B5) are grouped together with some space between the first button and next four buttons, and the fifth button (B5) is placed at the end of the row of the screen? i.e. B1 ...

6. Problems positioning buttons in GridBagLayout    coderanch.com

public void makeMe() { // Frame to hold everything frameMe = new JFrame(); // Main panel so I can create a border panelMe = new JPanel( new BorderLayout() ); // Border title = new BorderFactory.createTitledBorder(titleString); // panelMe.setBorder(title); panelMe.setBorder( BorderFactory.createTitledBorder(titleString) ); panelButtons = new JPanel(); panelButtons.setBorder(BorderFactory.createLineBorder(Color.black)); // panelButtons.setLayout(new GridLayout(6,1,5,5)); // panelButtons.setLayout(new BoxLayout(panelButtons, BoxLayout.PAGE_AXIS)); panelButtons.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = ...

7. Position 5 buttons with GridBagConstraints in Swing    java-forums.org

How to position 5 buttons with GridBagConstraints in Swing so that the first button (B1) are at the first column, the next four buttons (B2, B3, B4, B5) are grouped together with some space ( ) between the first button and next four buttons, and the fifth button (B5) is placed at the end of the row of the screen? i.e. B1         ...

8. How to change position of JButtons in a CardLayout?    java-forums.org

... JPanel cards; //a panel that uses CardLayout Button BtGotoCard2; //awt button for test BUT DOESNT CHANGES POSITION EITHER Button BtGotoCard1; JButton myButton = new JButton("JB Go to Card2"); public void addComponentToPane(Container pane) { JPanel card1 = new JPanel(); BtGotoCard2 = new Button("Go to Card2"); [COLOR="Red"]BtGotoCard2.setBounds(50,150,80,20);[/COLOR] [COLOR="Red"]myButton.setBounds(50,150,80,20);[/COLOR] card1.add(BtGotoCard2); card1.add(new JButton("J Button 1")); card1.add(myButton); myButton.addActionListener(this); BtGotoCard2.addActionListener(this); BtGotoCard1 = new Button("Go to Card1"); ...

9. CHANGING THE POSITION OF A JBUTTON    forums.oracle.com

i tried the gridlayout, it puts one button on top of the other one filling up the entire screen, then flowlayout, puts the buttons side by side, but i want them one top of the other in the middle of the jframe and not filling up the entire frame. new code import javax.swing.*; import java.awt.*; import java.applet.Applet; public class Menu { ...