public BoxLayout(){ panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS)); } When i try to uses this code my IDE gives a error messages with the PAGE_AXIS because it can't find the symbol? But i have everything you have and extra. This is the full code: package boxlayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class BoxLayout { JFrame frame = new JFrame("BoxLayout"); JPanel panel = new JPanel(); JButton Button1 = new JButton("1"), Button2 = new JButton("2"); public BoxLayout(){ panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS)); } public static void main(String[] args) {
Hahaha i found the problem the name of the class is BoxLayout the same as BoxLayout so that cause the problem............ This truely a facepalm moment ........
Very nice tutorial. Clear, easy-to-understand demonstration. Better than many tutorials I've been seeing. Will subcribe.
very helpful thankyou! I love how you go through everything and explain what everything means without assuming that I know it.
short and understandable tutorial... Great !!
Thanks for this video. I was really struggling with this but you are video was very helpful
great tutorial man you saved my life
thank you so much!! very good and simple explanation
Great tutorial.
Thank you! MigLayout coming soon. :)
How can I center my buttons??
You probably want to use MigLayout. Combined with CardLayout, it solves pretty much everything.
i want to work in it hub for great learning in silicon valley can any one help me
in these days can java developer get us visa for job
Thankss!! :D
public BoxLayout(){
panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS));
}
When i try to uses this code my IDE gives a error messages with the PAGE_AXIS because it can't find the symbol? But i have everything you have and extra.
This is the full code:
package boxlayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class BoxLayout {
JFrame frame = new JFrame("BoxLayout");
JPanel panel = new JPanel();
JButton Button1 = new JButton("1"), Button2 = new JButton("2");
public BoxLayout(){
panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS));
}
public static void main(String[] args) {
}
}
Hahaha i found the problem the name of the class is BoxLayout the same as BoxLayout so that cause the problem............ This truely a facepalm moment ........
How bout just using a designer?
It gives me multiple errors when i try to use boxlayout for my jframe...whats the problem??
Why does every single aspect of Java have to be such a massive pain in the ass?
+1
disliked. add some commentary next time