Solved

Need alot of help with panels

Posted on 2003-11-29
23
323 Views
Last Modified: 2010-03-31
I have a Border layout-North, South, East, West and Center.  I need to split the center panel into subpanels so my labels and checkboxes will not fill the box left to right. I need to put the Daily cashout label in top center, the total due in the middle centerand then the cash charge buttons at the bottom center. Below is what I have tried.


Panel ButtonPanel = new Panel();
                              Label quantLabel = new Label("Quantity Taxable");
                              TextField quantityField = new TextField(5);
                              Label unitPriceLabel = new Label("Unit Price");
                              TextField unitPriceField = new TextField(5);
                              Label extendPriceLabel = new Label("Extended Price");
                              Button nextItemButton = new Button("Next Item");
                              Button cancelButton = new Button("Cancel");

                        Panel ButtonPanelTwo = new Panel();
                              Label quantTLabel = new Label("Quantity NonTaxable");
                              TextField quantityTField = new TextField(5);
                              Label unitPriceTLabel = new Label("Unit Price");
                              TextField unitPriceTField = new TextField(5);
                              Label extendPriceTLabel = new Label("Extended Price");
                              Button nextItemTButton = new Button("Next Item");
                              Button cancelTButton = new Button("Cancel");
                        Panel InputPanel = new Panel();
                              Label dailyCashoutLabel = new Label("Daily Total");
                              Label totalDueLabel = new Label("Total Amount Due");
                              CheckboxGroup options = new CheckboxGroup();
                              Checkbox cash = new Checkbox("Cash",false,options);
                              Checkbox charge = new Checkbox("Charge",false,options);
                              Checkbox hidden = new Checkbox("",true,options);

                        Panel FinishPanel = new Panel();
                              Button checkOutButton = new Button("Checkout");
                              Button resetButton = new Button("Cancel Order");

                        Panel LastButtonPanel = new Panel();
                              Button dailyCashoutButton = new Button("Daily Cashout");
                              Button exitProgramButton = new Button("Exit");

                        public CashRegFinalTest()
                        {
                              //set layouts for Frame and five Panels
                              this.setLayout(new BorderLayout());
                              this.add("CENTER",InputPanel);
                              InputPanel.setLayout(new GridLayout(2,2));
                              LastButtonPanel.setLayout( new FlowLayout());
                              ButtonPanel.setLayout(new GridLayout(8,2));
                              ButtonPanelTwo.setLayout(new GridLayout(8,2));
                              //InputPanel.setLayout (new FlowLayout(FlowLayout.CENTER));
                              FinishPanel.setLayout( new FlowLayout());

                              setBackground(blue);
                              quantityField.requestFocus();

                              //add components to ButtonPanel
                              ButtonPanel.add(quantLabel);
                              ButtonPanel.add(quantityField);
                              ButtonPanel.add(unitPriceLabel);
                              ButtonPanel.add(unitPriceField);
                              ButtonPanel.add(extendPriceLabel);
                              ButtonPanel.add(nextItemButton);
                              ButtonPanel.add(cancelButton);

                              //add components to ButtonPanel
                              ButtonPanelTwo.add(quantTLabel);
                              ButtonPanelTwo.add(quantityTField);
                              ButtonPanelTwo.add(unitPriceTLabel);
                              ButtonPanelTwo.add(unitPriceTField);
                              ButtonPanelTwo.add(extendPriceTLabel);
                              ButtonPanelTwo.add(nextItemTButton);
                              ButtonPanelTwo.add(cancelTButton);

                              //add components to InputPanel

                              InputPanel.add(dailyCashoutLabel);
                              InputPanel.add(totalDueLabel);
                              InputPanel.add(cash);
                              InputPanel.add(charge);

                              //add components to FinishPanel
                              FinishPanel.add(checkOutButton);
                              FinishPanel.add(resetButton);

                              //add components to LastButtonPanel
                              LastButtonPanel.add(dailyCashoutButton);
                              LastButtonPanel.add(exitProgramButton);

                              //add Panels to Frame
                              add(LastButtonPanel, BorderLayout.NORTH);
                              add(ButtonPanel, BorderLayout.WEST);
                              add(ButtonPanelTwo, BorderLayout.EAST);
                              //add(InputPanel, BorderLayout.CENTER);
                              add(FinishPanel, BorderLayout.SOUTH);



Can someone help with what I have here?

Thanks

Kevin
0
Comment
Question by:KevinGen
  • 13
  • 10
23 Comments
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Is this close enough?

import java.awt.*;
import java.awt.event.*;

public class PanelTest extends Frame
{
    public PanelTest()
    {
        Panel ButtonPanel = new Panel();
        Label quantLabel = new Label("Quantity Taxable");
        TextField quantityField = new TextField(5);
        Label unitPriceLabel = new Label("Unit Price");
        TextField unitPriceField = new TextField(5);
        Label extendPriceLabel = new Label("Extended Price");
        Button nextItemButton = new Button("Next Item");
        Button cancelButton = new Button("Cancel");

        Panel ButtonPanelTwo = new Panel();
        Label quantTLabel = new Label("Quantity NonTaxable");
        TextField quantityTField = new TextField(5);
        Label unitPriceTLabel = new Label("Unit Price");
        TextField unitPriceTField = new TextField(5);
        Label extendPriceTLabel = new Label("Extended Price");
        Button nextItemTButton = new Button("Next Item");
        Button cancelTButton = new Button("Cancel");
        Panel InputPanel = new Panel();
        Label dailyCashoutLabel = new Label("Daily Total");
        Label totalDueLabel = new Label("Total Amount Due");
        CheckboxGroup options = new CheckboxGroup();
        Checkbox cash = new Checkbox("Cash", false, options);
        Checkbox charge = new Checkbox("Charge", false, options);
        Checkbox hidden = new Checkbox("", true, options);

        Panel FinishPanel = new Panel();
        Button checkOutButton = new Button("Checkout");
        Button resetButton = new Button("Cancel Order");

        Panel LastButtonPanel = new Panel();
        Button dailyCashoutButton = new Button("Daily Cashout");
        Button exitProgramButton = new Button("Exit");
        //set layouts for Frame and five Panels
        this.setLayout(new BorderLayout());
        this.add(InputPanel, BorderLayout.CENTER);
        InputPanel.setLayout(new BorderLayout());
        LastButtonPanel.setLayout(new FlowLayout());
        ButtonPanel.setLayout(new GridLayout(8, 2));
        ButtonPanelTwo.setLayout(new GridLayout(8, 2));
        //InputPanel.setLayout (new FlowLayout(FlowLayout.CENTER));
        FinishPanel.setLayout(new FlowLayout());

        setBackground(Color.blue);
        quantityField.requestFocus();

        //add components to ButtonPanel
        ButtonPanel.add(quantLabel);
        ButtonPanel.add(quantityField);
        ButtonPanel.add(unitPriceLabel);
        ButtonPanel.add(unitPriceField);
        ButtonPanel.add(extendPriceLabel);
        ButtonPanel.add(nextItemButton);
        ButtonPanel.add(cancelButton);

        //add components to ButtonPanel
        ButtonPanelTwo.add(quantTLabel);
        ButtonPanelTwo.add(quantityTField);
        ButtonPanelTwo.add(unitPriceTLabel);
        ButtonPanelTwo.add(unitPriceTField);
        ButtonPanelTwo.add(extendPriceTLabel);
        ButtonPanelTwo.add(nextItemTButton);
        ButtonPanelTwo.add(cancelTButton);

        //add components to InputPanel

        Panel dcLabelPanel = new Panel(new FlowLayout());
        dcLabelPanel.add(dailyCashoutLabel);
        InputPanel.add(dcLabelPanel, BorderLayout.NORTH);
        Panel tdLabelPanel = new Panel(new FlowLayout());
        tdLabelPanel.add(totalDueLabel);
        InputPanel.add(tdLabelPanel, BorderLayout.CENTER);
       
        Panel cashChargePanel = new Panel(new FlowLayout());
        cashChargePanel.add(cash);
        cashChargePanel.add(charge);
        InputPanel.add(cashChargePanel, BorderLayout.SOUTH);

        //add components to FinishPanel
        FinishPanel.add(checkOutButton);
        FinishPanel.add(resetButton);

        //add components to LastButtonPanel
        LastButtonPanel.add(dailyCashoutButton);
        LastButtonPanel.add(exitProgramButton);

        //add Panels to Frame
        add(LastButtonPanel, BorderLayout.NORTH);
        add(ButtonPanel, BorderLayout.WEST);
        add(ButtonPanelTwo, BorderLayout.EAST);
        //add(InputPanel, BorderLayout.CENTER);
        add(FinishPanel, BorderLayout.SOUTH);
    }


    public static void main(String[] args)
    {
        PanelTest pt = new PanelTest();
        pt.pack();
        pt.show();
    }
}

The main changes are:

InputPanel is now created with a BorderLayout.
Some new containing panels added in the section that adds the components to the InputPanel.
0
 

Author Comment

by:KevinGen
Comment Utility
jimmack

If your still online do you have a place I can send all my code so you can look at it. I'm not sure where to put in what you did. If I send the whole thing perhaps you can show me.
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
I'm still around (at the moment ;-)), but we need to keep the discussion here on EE (the guidelines you know ;-))

Can you define your problem any more clearly?

I moved your code that appeared before the constructor into the constructor (just so that I could compile it more easily).

Is this an application or an applet?

What does your class definition for CashRegFinalTest look like?  ie.

public class CashRegFinalTest ... (extends?  implements?)
0
 

Author Comment

by:KevinGen
Comment Utility
Here is all the code. It's nothing special I just didn't want to post it.

import javax.swing.JOptionPane;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;

public class CashRegFinal extends Frame implements ActionListener
{
      // declare variables
      int quantity;
      double unitPrice, extendedPrice, total;
      double grandTotal = 0, totalTax = 0, subTotal = 0, dailyTotal = 0;
      double quantityInT = 0, priceInT = 0, priceIn = 0, quantityIn = 0;
      double subtotalT, nextItemtotal = 0,checkoutSubtotal = 0,dailyCashout, price;
      double salesTax = .06;
      Color blue = new Color(255, 90, 90);


                        Panel ButtonPanel = new Panel();
                              Label quantLabel = new Label("Quantity Taxable");
                              TextField quantityField = new TextField(5);
                              Label unitPriceLabel = new Label("Unit Price");
                              TextField unitPriceField = new TextField(5);
                              Label extendPriceLabel = new Label("Extended Price");
                              Button nextItemButton = new Button("Next Item");
                              Button cancelButton = new Button("Cancel");

                        Panel ButtonPanelTwo = new Panel();
                              Label quantTLabel = new Label("Quantity NonTaxable");
                              TextField quantityTField = new TextField(5);
                              Label unitPriceTLabel = new Label("Unit Price");
                              TextField unitPriceTField = new TextField(5);
                              Label extendPriceTLabel = new Label("Extended Price");
                              Button nextItemTButton = new Button("Next Item");
                              Button cancelTButton = new Button("Cancel");
                        Panel InputPanel = new Panel();
                              Label dailyCashoutLabel = new Label("Daily Total");
                              Label totalDueLabel = new Label("Total Amount Due");
                              CheckboxGroup options = new CheckboxGroup();
                              Checkbox cash = new Checkbox("Cash",false,options);
                              Checkbox charge = new Checkbox("Charge",false,options);
                              Checkbox hidden = new Checkbox("",true,options);

                        Panel FinishPanel = new Panel();
                              Button checkOutButton = new Button("Checkout");
                              Button resetButton = new Button("Cancel Order");

                        Panel LastButtonPanel = new Panel();
                              Button dailyCashoutButton = new Button("Daily Cashout");
                              Button exitProgramButton = new Button("Exit");

                        public CashRegFinal()
                        {
                              //set layouts for Frame and five Panels
                              this.setLayout(new BorderLayout());
                              LastButtonPanel.setLayout( new FlowLayout());
                              ButtonPanel.setLayout(new GridLayout(8,2));
                              ButtonPanelTwo.setLayout(new GridLayout(8,2));
                              InputPanel.setLayout (new FlowLayout(FlowLayout.CENTER));
                              FinishPanel.setLayout( new FlowLayout());

                              setBackground(blue);
                              quantityField.requestFocus();

                              //add components to ButtonPanel
                              ButtonPanel.add(quantLabel);
                              ButtonPanel.add(quantityField);
                              ButtonPanel.add(unitPriceLabel);
                              ButtonPanel.add(unitPriceField);
                              ButtonPanel.add(extendPriceLabel);
                              ButtonPanel.add(nextItemButton);
                              ButtonPanel.add(cancelButton);

                              //add components to ButtonPanel
                              ButtonPanelTwo.add(quantTLabel);
                              ButtonPanelTwo.add(quantityTField);
                              ButtonPanelTwo.add(unitPriceTLabel);
                              ButtonPanelTwo.add(unitPriceTField);
                              ButtonPanelTwo.add(extendPriceTLabel);
                              ButtonPanelTwo.add(nextItemTButton);
                              ButtonPanelTwo.add(cancelTButton);

                              //add components to InputPanel

                              InputPanel.add(dailyCashoutLabel);
                              InputPanel.add(totalDueLabel);
                              InputPanel.add(cash);
                              InputPanel.add(charge);

                              //add components to FinishPanel
                              FinishPanel.add(checkOutButton);
                              FinishPanel.add(resetButton);

                              //add components to LastButtonPanel
                              LastButtonPanel.add(dailyCashoutButton);
                              LastButtonPanel.add(exitProgramButton);

                              //add Panels to Frame
                              add(LastButtonPanel, BorderLayout.NORTH);
                              add(ButtonPanel, BorderLayout.WEST);
                              add(ButtonPanelTwo, BorderLayout.EAST);
                              add(InputPanel, BorderLayout.CENTER);
                              add(FinishPanel, BorderLayout.SOUTH);

                              //add ActionListener
                              nextItemButton.addActionListener(this);
                              cancelButton.addActionListener(this);
                              checkOutButton.addActionListener(this);
                              resetButton.addActionListener(this);
                              dailyCashoutButton.addActionListener(this);
                              exitProgramButton.addActionListener(this);
                              nextItemTButton.addActionListener(this);
                              cancelTButton.addActionListener(this);

                        //WindowClosing method() will allow the user to  click the Close button
                        addWindowListener(
                        new WindowAdapter()
                        {
                              public void windowClosing(WindowEvent e)
                              {
                              System.exit(0);
                              }
                        }
                        );


                        }
      public static void main(String[] args)
      {

            CashRegFinal f = new CashRegFinal();
            f.setBounds(400,100,400,425);
            f.setTitle("      Cash Register Simulator");
            f.setVisible(true);
      }


                  public void clearFields()//clear fields and reset focus for cancel button
                  {
                        quantityField.setText("");
                        unitPriceField.setText("");
                        quantityField.requestFocus();

                  }

                  public void clearFieldsT()//clear fields and reset focus for cancel buttonT
                  {
                        quantityTField.setText("");
                        unitPriceTField.setText("");
                        quantityTField.requestFocus();

                  }

                  public void clearFieldsCancelOrder()//clear fields and reset focus for cancel buttonT
                  {

                        quantityTField.setText("");
                        unitPriceTField.setText("");
                        quantityField.setText("");
                        unitPriceField.setText("");
                        quantityField.requestFocus();
                        extendPriceLabel.setText("Extended Price");
                        extendPriceTLabel.setText("Extended Price");
                        totalDueLabel.setText("Total Amount Due");
                        nextItemtotal = 0;
                        subtotalT = 0;
                  }

      public void actionPerformed(ActionEvent e)
      {


            if (e.getSource() == cancelButton)  //clear text fields for cancel button
            {
            clearFields();
            }

            if (e.getSource() == cancelTButton)  //clear text fields for cancel ButtonT
            {
            clearFieldsT();
            }

            if (e.getSource() == exitProgramButton)  //clear text fields for Exit Button
            {
            System.exit(0);
            }

            if (e.getSource() == resetButton)  //cancels order
            {
                  clearFieldsCancelOrder();
            }

            if (e.getSource() == nextItemButton)

            {
                  try
                  {
                        priceIn = getPrice();
                        quantityIn = getQuantity();
                        nextItemtotal = nextItemtotal + (quantityIn * priceIn);
                  }

                  catch (NumberFormatException ex)
                  {
                        extendPriceLabel.setText(      "");
                        unitPriceField.setText("");
                        quantityField.setText("");
                  }

                  extendPriceLabel.setText("SubTotal: " + (nextItemtotal));

                  clearFields();

            }

                  if (e.getSource() == nextItemTButton)
                  {
                              try
                              {
                                    priceInT = getPriceT();
                                    quantityInT = getQuantityT();
                                    subtotalT = subtotalT + (quantityInT * priceInT);
                              }

                              catch (NumberFormatException ex)
                              {
                                    extendPriceTLabel.setText(      "");
                                    unitPriceTField.setText("");
                                    quantityTField.setText("");
                              }

                  extendPriceTLabel.setText("SubTotal: " + (subtotalT));

                  }

                  if (e.getSource() == checkOutButton)
                  {
                  try
                  {
                        total = (nextItemtotal * salesTax);
                        checkoutSubtotal = ((nextItemtotal + total) + subtotalT);
                        clearFields();
                        clearFieldsT();
                  }

                  catch (NumberFormatException ex)
                  {

                  }

                  totalDueLabel.setText("Total: " + (checkoutSubtotal));

                  }

                  if (e.getSource() == dailyCashoutButton)
                  {
                  try
                  {
                        dailyTotal = dailyTotal + (checkoutSubtotal);
                        dailyCashoutLabel.setText("Daily Total is: " + (dailyTotal));
                  }

                  catch (NumberFormatException ex)
                  {

                  }

                  }
      }

      public double getPrice()
      {
            double priceIn = Double.parseDouble(unitPriceField.getText());
            if (priceIn <= 0) throw new NumberFormatException();
            return priceIn;
      }

      public double getQuantity()
      {
            double quantityIn = Double.parseDouble(quantityField.getText());
            if (quantityIn <= 0) throw new NumberFormatException();
            return quantityIn;
      }



      public double getPriceT()
            {
                  double priceInT = Double.parseDouble(unitPriceTField.getText());
                  if (priceInT <= 0) throw new NumberFormatException();
                  return priceInT;
            }

            public double getQuantityT()
            {
                  double quantityInT = Double.parseDouble(quantityTField.getText());
                  if (quantityInT <= 0) throw new NumberFormatException();
                  return quantityInT;
            }

}



0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
OK.  That compiles alright.  The main difference seems to be that it has an unpleasant ;-) pink background.

That can be resolved by changing the line:

 setBackground(blue);

to

  setBackground(Color.blue);

Now. The labels and radio buttons you mention are just in a FlowLayout in the main center panel.  How do you want these organized?
0
 

Author Comment

by:KevinGen
Comment Utility
I need to split the center panel into subpanels so my labels and checkboxes will not fill the box left to right. I need to put the Daily cashout label in top center, the total due in the middle centerand then the cash charge buttons at the bottom center. When I do daily cashout the way it is now my total can't be seen. If I make the frame wider then everything moves.
0
 

Author Comment

by:KevinGen
Comment Utility
What I sent before doesn't have any of your code in it.
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Perhaps you could try this and let me know if it's what you're looking for:

Change the layout of the InputPanel:

        InputPanel.setLayout(new GridLayout(3, 1));

Change the addition of elements to the InputPanel as follows:
        //add components to InputPanel
/*
        InputPanel.add(dailyCashoutLabel);
        InputPanel.add(totalDueLabel);
        InputPanel.add(cash);
        InputPanel.add(charge);
*/
        Panel dcLabelPanel = new Panel(new FlowLayout());
        dcLabelPanel.add(dailyCashoutLabel);
        InputPanel.add(dcLabelPanel);
        Panel tdLabelPanel = new Panel(new FlowLayout());
        tdLabelPanel.add(totalDueLabel);
        InputPanel.add(tdLabelPanel);
0
 

Author Comment

by:KevinGen
Comment Utility
The daily cashout label and the total due look good but I lost mycash and charge buttons. Also is there a way to make my center panel wider. What I do is put a number in quantity and price. I click next item and then checkout. After I check out I click dailt total and I can't see what the toal for the day is.
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Oops :-(  Sorry.  I didn't paste the whol bit.  Add the following onto the end of the code above:

        Panel cashChargePanel = new Panel(new FlowLayout());
        cashChargePanel.add(cash);
        cashChargePanel.add(charge);
        InputPanel.add(cashChargePanel);

To widen the center panel, increase the third parameter in your setBounds call, eg. change:

        f.setBounds(400, 100, 400, 425);

to:

        f.setBounds(400, 100, 600, 425);

For the last part, this is because the frame is not being repainted after you change the label.  If I may, I would like to suggest that you display the value in an uneditable text field instead of changing the label, eg.

Add another attribute at the top of the file (just the commented one below):

    Panel InputPanel = new Panel();
    Label dailyCashoutLabel = new Label("Daily Total");
    TextField dailyCashoutField = new TextField(5);             // This is the new field
    Label totalDueLabel = new Label("Total Amount Due");
    CheckboxGroup options = new CheckboxGroup();


Then, replace the following lines:

        Panel dcLabelPanel = new Panel(new FlowLayout());
        dcLabelPanel.add(dailyCashoutLabel);

with:

        Panel dcGridPanel = new Panel(new GridLayout(2, 1));
        Panel dcLabelPanel = new Panel(new FlowLayout());
        dcGridPanel.add(dailyCashoutLabel);
        dcGridPanel.add(dailyCashoutField);
        dcLabelPanel.add(dcGridPanel);

Finally, in actionPerformed():

//                dailyCashoutLabel.setText("Daily Total is: " + (dailyTotal));
                dailyCashoutField.setText("" + dailyTotal);
0
 

Author Comment

by:KevinGen
Comment Utility
That works great. Could I ask one more question? Could you just explain to me the code behind getting the center panel? I want to understand it so I can use it again another time. Not right now though because I need to try and figure out  the error checking.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Sure.

Let's work from the bottom up (in the design, not the layout ;-))

The radio buttons (cash and charge) are added to a Panel with a FlowLayout.  This keeps them centered (and on one line, where width allows).

The totalDue label is also contained within it's own FlowLayout Panel, again to keep it centered (vertically and horizontally) in the available area.

The slightly more complex part is the daily cashout sub-panel.  This is made up of a grid layout with two vertical "spaces".  In the top part is the daily cashout label and in the bottom part is the text field.  A grid layout will expand to fill the space available and this would distort the text field, so I placed it inside yet another panel with a FlowLayout to prevent this.

Each of these panels is then added, respectively, to the south, center and north of another Panel (BorderLayout) which is finally added to the center of the main panel.

I find that surrounding some components with their own FlowLayout tends to prevent distortions when resizing the screen.

If that's not totally clear, please let me know and I'll try to clarify it some more ;-)

Some suggestions:

Try putting your "next item" and "cancel" buttons inside simple FlowLayout panels before adding them to the GUI.  That will stop them stretching when you change the size of the window.

Try updating the display of the totalDue to use a text field (like the daily total).
0
 

Author Comment

by:KevinGen
Comment Utility
I tried adding a textfield and messed up the alignment.
0
 
LVL 15

Accepted Solution

by:
jimmack earned 150 total points
Comment Utility
:-)

Did you put the label and text field into a 2 x 1 GridLayout panel, then put this panel into a FlowLayout panel?
0
 

Author Comment

by:KevinGen
Comment Utility
I fixed the textfield. I left off the new GridLayout(2,1) thinking I didn't need it. Now I'll work on the  putting your "next item" and "cancel" buttons inside simple FlowLayout panels
0
 

Author Comment

by:KevinGen
Comment Utility
Try putting your "next item" and "cancel" buttons inside simple FlowLayout panels before adding them to the GUI.  That will stop them stretching when you change the size of the window.

Thought I could figure it out but I don't have a clue.
0
 

Author Comment

by:KevinGen
Comment Utility
Guess your gone. Thank you very much for all your help. I couldn't have gone this without you

Kevin
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
;-)  No problem.

The suggestion about putting your buttons into FlowLayouts would go like this (for one of them):

  Panel niBut1Panel = new Panel(new FlowLayout());
  niBut1Panel.add(nextItemButton);
//  ButtonPanel.add(nextItemButton);
  ButtonPanel.add(niBut1Panel);

Try this first.  When you run it, stretch the frame vertically and you'll see that the next item button on the left hand side stays the same size, whereas the other buttons expand/shrink as the vertical size of the window changes.
0
 

Author Comment

by:KevinGen
Comment Utility
Worked out very nice. The only large parts I have left are the quantityField and the unit PriceField. I played with them and it scattered everything in the panel. It looks alot nicer than I thought possible .
Thanks again
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
;-) No problem.
0
 

Author Comment

by:KevinGen
Comment Utility
I was playing with this again. If I open this as a new question with points and ask how to resize the four textfieds will you be around to answer?
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Sure.
0
 

Author Comment

by:KevinGen
Comment Utility
I'll send it as a new question named "Textfield help" with the new code from yesterday. Give me two minutes.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java asynchronous logging 4 31
JAVA part two 5 39
Java and GPO 11 45
what is a "java.lang.System Property"   ? 20 34
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now