Hi:

I am really struggling to develop a simple swing frame that 
needs to look the same as the MS Outlook mail status frame.

But, the Swing GUI capabilities so far seem pathetic.
Just trying to get the button's in a decent shape is
exasperating. I haven't been able to get them to the correct
shape as yet!

I am posting the code here and if anybody has ideas on how
I can improve this, I would be thankful.

--------------------------------------------------------------------

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public
class StatusGUI
    extends JFrame
{
    public StatusGUI( )
    {
        this.setTitle( "Microsoft Outlook Look Alike" );
        this.setSize( 475, 450 );

        GridBagLayout gbl = new GridBagLayout( );
        Container contentPane = getContentPane( );
        contentPane.setLayout( gbl );

        // --------------------------------------------
        JLabel statusLabel  = new JLabel( "Mail" );
        JLabel mailStatusLabel  = new JLabel( "Downloading mail ..." );
        
        JProgressBar progressBar    = new JProgressBar( );
        JCheckBox checkBox          = new JCheckBox( );
        checkBox.setLabel( "Always hide this dialog" );

        JButton detailsButton       = new JButton( "Details" );
        JButton stopButton          = new JButton( "Stop" );
        JButton hideButton          = new JButton( "Hide" );

        detailsButton.setSize( 100, 2 );
        stopButton.setSize( 100, 2 );
        hideButton.setSize( 100, 2 );

        String[] columnNames = 
        {
            "Tasks",
            "Status",
            "Connection"
        };

        Object[][] cells =
        {
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
            { "Receiving mail ... ", "Success", "Using Dialer" },
        };

        JTable table = new JTable( cells, columnNames );
        JScrollPane pane = new JScrollPane( table );

        JTabbedPane tabbedPane  = new JTabbedPane( );
        tabbedPane.addTab( "Tasks", null, pane );
        tabbedPane.addTab( "Errors", null, null );

        String msg = "0 of 22 tasks have completed successfully";
        JLabel taskStatusLabel = new JLabel( msg ); 
        JLabel pinLabel = new JLabel( "pin" ); 

        GridBagConstraints gbc = new GridBagConstraints( );
        gbc.weightx = 100;
        gbc.weighty = 100;

        gbc.insets = new Insets( 2, 2, 2, 2 );

        gbc.fill = GridBagConstraints.NONE;
        gbc.anchor = GridBagConstraints.NORTH;
        add( mailStatusLabel, gbc, 1, 0, 1, 1 );

        gbc.fill = GridBagConstraints.NONE;
        gbc.anchor = GridBagConstraints.WEST;
        add( statusLabel, gbc, 0, 1, 1, 1 );

        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.WEST;
        add( progressBar, gbc, 0, 2, 2, 1 );

        gbc.fill = GridBagConstraints.BOTH;
        gbc.anchor = GridBagConstraints.EAST;
        add( detailsButton, gbc, 2, 2, 1, 1 );

        gbc.fill = GridBagConstraints.BOTH;
        gbc.anchor = GridBagConstraints.EAST;
        add( stopButton, gbc, 2, 3, 1, 1 );

        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.WEST;
        add( checkBox, gbc, 0, 4, 2, 1 );

        gbc.fill = GridBagConstraints.BOTH;
        gbc.anchor = GridBagConstraints.EAST;
        add( hideButton, gbc, 2, 4, 1, 1 );

        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.WEST;
        int nr = 5;
        int r = 5;
        add( tabbedPane, gbc, 0, r, 3, nr );

        gbc.fill = GridBagConstraints.NONE;
        gbc.anchor = GridBagConstraints.WEST;
        add( taskStatusLabel, gbc, 0, r + nr, 1, 1 );

        gbc.fill = GridBagConstraints.NONE;
        gbc.anchor = GridBagConstraints.EAST;
        add( pinLabel, gbc, 2, r + nr, 1, 1 );
    }


    /* Main */
    public
    void 
    add(    Component component,
            GridBagConstraints  gbc,
            int c,
            int r,
            int nc,
            int nr )
    {
        gbc.gridx       = c;
        gbc.gridy       = r;
        gbc.gridwidth   = nc;
        gbc.gridheight  = nr;

        Container contentPane = getContentPane( );
        contentPane.add( component, gbc );
    }


    public static void main( String[] args )
    {
        StatusGUI statusGUI = new StatusGUI( );
        statusGUI.show( );
    }
}

--------------------------------------------------------------------

I would also like to know if it is possible to do Professional Quality
GUI development using Swing.

Thanks for your time.
Tom.


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to