Hi. In my attempts to create an email client, netbean's GUI builder has made me very unhappy... so, I decided I'd rather code it by hand... not my best idea, but whatever. Now, I'm trying to nest a Vertical JSplitPane in a Horizontal JSplitPane, and I can't see the left side of the Pane that is split down the middle. When I run the program, I only see the handle for the bar that resizes up and down... I want it to look something like this, I got it to work in the GUI builder, but I've stopped using that...:

| |       |
| |       |
| +-------|
| |       |

where the lines that intersect the + can be moved.

Also, the GridBagLayout is starting at the top left corner, but in the center... does anyone know how to fix that????

Here's my code:

lines 79-99 are the problem area for the JSplitPanes i believe

package JEmail;

import javax.swing.*;
import java.awt.*;
 * Write a description of class JMail_Runner here.
 * @author (your name) 
 * @version (a version number or a date)
public class JMail_Runner{

    private static final int PWIDTH = 600;
    private static final int PHEIGHT = 500;

    static JFrame jMailWindow;
    public static void createAndShowGUI(){
//         try{ // Set the L&F to match the System - will have option to change later.
//             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//         }catch(Exception e){
//             e.printStackTrace();
//         }
        GridBagConstraints c = new GridBagConstraints();
        jMailWindow = new JFrame("JEmail");
        Container contentPane = jMailWindow.getContentPane();
        contentPane.setLayout(new GridBagLayout());
        jMailWindow.setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
        jMailWindow.setSize(PWIDTH, PHEIGHT);
         * Init the JMenuBar and add JMenus
        WindowComponents.menuBar = new JMenuBar();
        WindowComponents.file = new JMenu("File"); 
        WindowComponents.edit = new JMenu("Edit"); 
        WindowComponents.mail = new JMenu("Mail");
        WindowComponents.help = new JMenu("Help");
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridx = 0;
        c.gridy = 0;
        c.weightx = 0.5;
        contentPane.add(WindowComponents.menuBar, c);
         * Init the JToolBar and add JComponents
        WindowComponents.toolBar = new JToolBar();
        WindowComponents.previous = new JButton(" < ");
        WindowComponents.next = new JButton(" > ");
        WindowComponents.compose = new JButton("Compose Mail");
        WindowComponents.check = new JButton("Check Mail");
        WindowComponents.searchField = new JTextField("Enter Search Term", 30);

        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridx = 0;
        c.gridy = 1;
        c.weightx = 0.5;
        c.gridwidth = 1;
        contentPane.add(WindowComponents.toolBar, c);
         * Init the JSplitPanes and add them to the JFrame
        WindowComponents.vertical = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        WindowComponents.horizontal = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        WindowComponents.tabs = new JTabbedPane();
        WindowComponents.files = new JTree();
        WindowComponents.vertical.setBottomComponent(new JPanel());
        WindowComponents.tabs.setPreferredSize(new Dimension(400, 250));
        WindowComponents.tabs.add(new JPanel(), "Test");
        c.fill = GridBagConstraints.BOTH;
        c.gridx = 0;
        c.gridy = 2;
        c.weightx = 1.0;
        c.gridwidth = 1;
    	c.gridheight = GridBagConstraints.REMAINDER;      //make this component tall
        contentPane.add(WindowComponents.vertical, c);
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
package JEmail;

 * This class is comprised of a list of pre-init static
 * JComponents.  These components make up the GUI of the
 * JEmail program.  This class has only static values so
 * if one operation changes a menu/component, there is no 
 * confliction with other operations.  If there is a confliction,
 * it will be dealt with else-where. (Possibly here, I haven't
 * decided yet...)

 * Add another JPanel for the notesScrollPane's contents

import javax.swing.*;
import JEmail.util.*;

public class WindowComponents{
    // Components for the JEmail Window
    public static JMenuBar menuBar;
    public static JMenu file, edit, mail, help;
    public static JSplitPane vertical, horizontal;
    public static JTabbedPane tabs;
    public static JTree files;
    public static JPanel mailPanel, contactsPanel, notesPanel, inboxPanel;
    public static JScrollPane inboxScrollPane, notesScrollPane, contentsScrollPane,
//     public static InboxHeader inboxHeader;
    // for organizing/visualizing contacts
//     public static ContactsHeader contactsHeader;

    // JToolBar and components
    public static JToolBar toolBar;
    public static JButton next, previous, compose, check;
    public static JTextField searchField;
7 Years
Discussion Span
Last Post by llemes4011

Hello, can I get help, I am using netbeans 6 and I am now staring GUI, can i get a code for a simple game


Hi Peekay49.
This thread has already been solved. You can read through it if you would like, but posting here is going to do anything, people see that it's solved so most just ignore it. If you need help you need to start your own thread.
Also, Daniweb does not just give away code, we're here to help, not to do your work for you. You have to show that you have written your own, and we can help you if it isn't working properly.

If you need help building the GUI, look here:

or here:

As for the game, start with something simple: for example, when you press the mouse button, a circle appears and disappears when you press again.

All of this was explained in the rules. Please don't ask for code without showing any of your own work.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.