0
My problem is that I want to create a graphical interface with input fields vertically, but I can only create horizontally.
Code:
JTextField mapField = new JTextField(5);
JTextField tamField = new JTextField(5);
JTextField wordField = new JTextField(5);
JTextField politicaField = new JTextField(5);
JTextField numViasField = new JTextField(5);
JPanel myPanel = new JPanel();
myPanel.add(new JLabel("Mapeamento:"));
myPanel.add(mapField);
myPanel.add(Box.createVerticalStrut(15)); // a spacer
myPanel.add(new JLabel("Tamanho da Cache:"));
myPanel.add(tamField);
myPanel.add(Box.createVerticalStrut(15)); // a spacer
myPanel.add(new JLabel("Wors por bloco:"));
myPanel.add(wordField);
myPanel.add(Box.createVerticalStrut(15)); // a spacer
myPanel.add(new JLabel("Politica de substituição:"));
myPanel.add(politicaField);
myPanel.add(Box.createVerticalStrut(15)); // a spacer
myPanel.add(new JLabel("Numero de vias:"));
myPanel.add(numViasField);
Stackoverflow in Portuguese is not a forum. If you have found the answer to your question, do not edit the question, just answer it and mark it as accepted. It is also not necessary to put "solved" in the post title.
– ptkato