below is my code
I'm using gridbaglayout.
the layout has created extra space from the outside borders of the gui.
Does anyone know in what direction i should study to eliminate this?
I'm also having problems on my file processing.
if there are any pointers, i would be very grateful.
Code:import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.io.*; public class homeworkJava extends JFrame { Container container= getContentPane(); GridBagLayout layout= new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); Box box1 = Box.createVerticalBox(); Box box2 = Box.createVerticalBox(); Box box3 = Box.createVerticalBox(); JTextField commands = new JTextField(18); JLabel GeneraLabel = new JLabel("Genera", JLabel.RIGHT); JLabel RatingLabel = new JLabel("Rating", JLabel.RIGHT); JLabel outputArea1Label = new JLabel("Details",JLabel.RIGHT); JMenuBar bar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenu editMenu = new JMenu("Edit"); Vector DetailsV = new Vector(); Vector GeneraV = new Vector(); Vector RatingV = new Vector(); Vector TableLabelsV = new Vector(); JComboBox GeneraCB = new JComboBox(GeneraV); JComboBox RatingCB = new JComboBox(RatingV); JTable jt = new JTable(DetailsV,TableLabelsV); //JScrollPane jsp = new JScrollPane(jt); File GeneraInputFile = new File("/home/buddha/code/homeworkJava","GeneraFile.txt"); public homeworkJava() { super("DVD Database"); container.setLayout(layout); readData(GeneraInputFile,GeneraV); commands.setText("COMMANDS"); GeneraLabel.setLabelFor(GeneraCB); RatingLabel.setLabelFor(RatingCB); outputArea1Label.setLabelFor(jt); box1.add(GeneraLabel); box1.add(GeneraCB); box2.add(RatingLabel); box2.add(RatingCB); box3.add(outputArea1Label); box3.add(jt); fileMenu.add(new JMenuItem("Open")); fileMenu.add(new JMenuItem("Close")); fileMenu.add(new JMenuItem("Search")); editMenu.add(new JMenuItem("Cut")); editMenu.add(new JMenuItem("Copy")); editMenu.add(new JMenuItem("Paste")); bar.add(fileMenu); bar.add(editMenu); TableLabelsV.add("Genera"); TableLabelsV.add("Rating"); TableLabelsV.add("Title"); TableLabelsV.add("Discription"); container.add(bar); box1.setBackground(Color.white); box2.setBackground(Color.white); box3.setBackground(Color.white); container.setBackground(Color.white); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 1; c.gridwidth=4; container.add(commands,c); c.fill = GridBagConstraints.BOTH; c.gridx=0; c.gridy=2; c.gridwidth=2; container.add(box1,c); c.fill = GridBagConstraints.BOTH; c.gridx=1; c.gridy=2; c.gridwidth=0; container.add(box2,c); c.fill = GridBagConstraints.BOTH; c.gridx=0; c.gridy=4; c.gridheight=9; c.gridwidth=3; container.add(box3,c); setSize(250,250); setVisible(true); } public static void main(String args[]) { homeworkJava application = new homeworkJava(); application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void readData(File inputFile,Vector DataStorage) {/////////////////work on this option /* try { FileReader fr = new FileReader(inputFile); BufferedReader in = new BufferedReader(fr); while(in.readLine()!=null) { DataStorage.add(in.readLine()); } } catch(FileNotFoundException e) { System.out.println("File Disappeared"); }*/ } }