So I'm working on a GUI program in Java, and I'm having problems dealing with some text fields i have.
The text fields are resizing themselves the same size of the window, making them much larger than I wish.
[IMG]http://i6.photobucket.com/albums/y201/ElChibo/tioex-2.jpg[/IMG]
I would like all of the text labels to be about the same size as the file loaded box (except for venue fee, that should be a little shorter.
As for how the GUI is setup..
(im not including all my code because its really long lol, and most of it is unneeded for this problem)
There's a JTabbedPane JTabbedPane tabbedPane = new JTabbedPane();
in which is the tournament panel tabbedPane.addTab("Tournament", tournamentIcon, makeTournamentPanel(), "Manage your tournament");
The Jcomponent makeTournamentPanel() returns the JPanel tournamentPanel which has a box layout made up of 3 other panels (the 3 clear segments in the tournament tab)
JPanel tournamentPanel = new JPanel();
tournamentPanel.setLayout(new BoxLayout(tournamentPanel, BoxLayout.PAGE_AXIS));
tournamentPanel.add(filePanel);
tournamentPanel.add(entryPanel);
tournamentPanel.add(setPanel);
return tournamentPanel;
The filePanel resizes fine and the text box doesn't resize itself at all JTextField fileText = new JTextField(20);
However for the entryPanel...
JPanel entryPanel = new JPanel();
entryPanel.setLayout(new BoxLayout(entryPanel, BoxLayout.PAGE_AXIS));
entryPanel.add(new JLabel("Name:"));
tourneyName = new JTextField(25);
entryPanel.add(tourneyName);
entryPanel.add(new JLabel("Organizer: (optional)"));
tourneyOrganizer = new JTextField(25);
entryPanel.add(tourneyOrganizer);
entryPanel.add(new JLabel("Location: (optional)"));
tourneyLocation = new JTextField(25);
entryPanel.add(tourneyLocation);
entryPanel.add(new JLabel("Date:"));
tourneyDate = new JTextField(25);
entryPanel.add(tourneyDate);
entryPanel.add(new JLabel("Venue Fee:"));
tourneyPrice = new JTextField("0",25);
entryPanel.add(tourneyPrice);
(all the jtextfields are initialized as attributes of the class)
iv had problems with the layouts and stuff to get this right. I tried using a border layout for tournamentpanel originally, but it didnt work so i had to switch to box.