Layout of Buttons and TextFields

How can i have the layout of this frame to be in panels 11 and 12, to have the textboxes on the left side, one on top of the other and the button on the right side. And in panel 13, to have the buttons one on top of each other?
ex.
FRAME ORDER
PANEL 11
textbox NAME
textbox ADDRESS button ONE
textbox CARD
PANEL 12
textbox PRODUCT
textbox QUANTITY button TWO
PANEL 13
button THREE
button FOUR
THIS IS THE CODE I AM USEING
class Order extends JFrame implements ActionListener
     public JButton One,Two,Three,Four;
     JTextArea text,text2;
     public Order()
          JTextField name,address,card,product,quantity;
          JPanel p1 = new JPanel();
          JPanel p11 = new JPanel();
          JPanel p12 = new JPanel();
          JPanel p13 = new JPanel();
          JPanel p2 = new JPanel();
          getContentPane( ).setLayout ( new BorderLayout( ) );
          getContentPane().add ( p1, BorderLayout.WEST );
          getContentPane().add ( p2, BorderLayout.EAST );
          p1.setLayout ( new BorderLayout ( ) );
          p1.add ( p11, BorderLayout.NORTH );
          p1.add ( p12, BorderLayout.CENTER );
          p1.add ( p13, BorderLayout.SOUTH );
          p11.add(name = new JTextField("NAME",10));
          p11.add(address = new JTextField("ADDRESS",10));
          p11.add(card = new JTextField("CARD NUMBER",10));
          p11.add(One = new JButton("Enter"));
          p12.add(product = new JTextField("PRODUCT ID",10));
          p12.add(quantity = new JTextField("QUANTITY",10));
          p12.add(Two = new JButton("Enter"));
          p13.add(Three = new JButton("Inventory"));
          p13.add(Four = new JButton("Invoice"));
          p2.setLayout ( new BorderLayout ( ) );
          JScrollPane p21 = new JScrollPane(text = new JTextArea(10,30));
     //     text.append(Inventory.inventory);
     //     text.setBackground(Color.red);
          p2.add(p21,BorderLayout.NORTH);
          JScrollPane p22 = new JScrollPane(text2 = new JTextArea(10,30));
          p2.add(p22,BorderLayout.SOUTH);
          System.out.println("Order clicked");

How is this:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.text.*;
import javax.swing.border.*;
public class Pans extends JFrame
     JButton    One,Two,Three,Four;
     JTextArea  text,text2;
     JTextField name,address,card,product,quantity;
public Pans() 
     super("");
     JPanel p1  = new JPanel();
     JPanel p11 = new JPanel();
     JPanel p12 = new JPanel();
     JPanel p13 = new JPanel();
     JPanel p2  = new JPanel();
     getContentPane().setBackground(Color.black);
     getContentPane().setLayout(new GridLayout(0,2,1,0));
     getContentPane().add(p1,BorderLayout.WEST);
     getContentPane().add(p2,BorderLayout.EAST);
     p1.setLayout(new GridLayout(3,0,0,4));
     p1.setBackground(Color.black);
     p1.add (p11,BorderLayout.NORTH);
     p1.add(p12,BorderLayout.CENTER);
     p1.add(p13,BorderLayout.SOUTH);
     p11.setLayout(new GridLayout(3,2));
     p11.add(name    = new JTextField("NAME",10));
     p11.add(new JLabel(""));
     p11.add(address = new JTextField("ADDRESS",10));
     p11.add(One     = new JButton("Enter"));
     p11.add(card    = new JTextField("CARD NUMBER",10));
     p12.setLayout(new GridLayout(2,2));
     p12.add(product = new JTextField("PRODUCT ID",10));
     p12.add(new JLabel(""));
     p12.add(quantity = new JTextField("QUANTITY",10));
     p12.add(Two = new JButton("Enter"));
     p13.setLayout(new GridLayout(2,0));
     p13.add(Three = new JButton("Inventory"));
     p13.add(Four = new JButton("Invoice"));
     p2.setLayout(new GridLayout(2,0));
     JScrollPane p21 = new JScrollPane(text = new JTextArea(10,30));
     p2.add(p21,BorderLayout.NORTH);
     JScrollPane p22 = new JScrollPane(text2 = new JTextArea(10,30));
     p2.add(p22,BorderLayout.SOUTH);
     setBounds(10,10,400,300);
     setVisible(true);
public static void main (String[] args) 
     new Pans();
}     

Similar Messages

  • Java Button and Textfield size

    Hi i think i have asked this question before but didnt gott any suitable answer.
    I have problems with giving a JButton and JText.. fixed alignments with that i mean
    when the window is draget/maximized then the buttons and the textfield are also maximized.
    what can i do to give the buttons and the textfield fixed size and positions?
    sorry iam not able to paste the code here since iam working on two diffrent platforms.
    thanks.

    Look at the javadoc for LayoutManager and LayoutManager2 and check the javadoc for a Layout Manager implements these interfaces that does what you want. If you don't want to use a layout manager, call setLayout(null). A null layout will enable you to position and size the components wherever you want to using setBounds().
    Graeme

  • A Canvas, Button and TextField

    What is the best way to fit these 3 components to a JFrame?
    I want the Canvas object to take 90 % of the page and the textfield and Button along the bottom?
    Cheers ...

    About like this:
        Container c = getContentPane();
        Canvas can = new Canvas();
        can.setSize(350, 350);
        c.add( can );
        JPanel jp = new JPanel();
        jp.setLayout( new FlowLayout() );
        jp.add( new JButton("hi") );
        jp.add(new JTextField("hi back at ya") );
        c.add( jp, BorderLayout.SOUTH);
        pack();

  • AS3 Buttons and textfields

    Hi,
    I coming from an AS2 environment and trying to get my head around AS3.
    I have a dynamic Textfield on stage (instance name tfval)
    a movieclip named mcPlan, this contains a btn called s4
    but I cannot get the following to work:
    import flash.text.TextField;
    var tfval:String="Start";
    root.mcPlan.s4.addEventListener(MouseEvent.MOUSE_OVER,onOver);
    root.mcPlan.s4.addEventListener(MouseEvent.MOUSE_OUT,onOut);
    function onHover(event:MouseEvent):void{
    trace("dsds");
    root.tfval.text="Test From onOver";
    function onOut(event:MouseEvent):void{
    root.tfval.text="Test From onOut";
    Any help is apreciated!
    Thanks!

    aren't you seeing an error message about the lack of an onOver() function?  are you seeing any other error messages?

  • Basic Layout stuff (adding) and Clearing screens

    Ok I have 2 problems I cannot figure out
    1) I am using a gridlayout (6,1) inside a panel inside the southern border of a borderlayout. I have 2 textfields and 4 buttons added to the panel. I want the buttons and textfields to be a certain size and not the size of my applet. Any Help?? Can I add buttons and Textfields to specific pixels instead of on a layout???
    2) My applet is actually a game. I have multiple classes and stuff and I need to clear objects at times to hide them so they are not visible. I know in VB there is a .visible() method. How do i make buttons, images, and textfields, invisible and visible????
    Please help
    Sam

    (1)
    Not all Layout managers repect the requested size.
    When using GridLayout each cell in the Grid will be the same size - the size of the largest component added - and the other components expand to fill the available space.
    You can position components absolutely by using a null Layout and then using the specific method - setPosition(x,y) or whatever it is. However, you can normally get the desired effect using the Layout Managers by adding Panels inside Panels.
    GridbagLayout gives you a lot more flexibility but this is also more complicated to use.
    Ideally, you should have a look at the Swing tutorial on using Layout Managers.
    For the problem at hand however, I'd set the Panel holding your button's and textfield's to be a FlowLayout as this does respect the preferred component size:
    // new Panel - components added left to right with centre alignment
    JPanel myPanel = new JPanel (new FlowLayout(FlowLayout.CENTER));
    JButton myButton = new JButton("CLICK");
    // set size of new button
    myButton.setPreferredSize(new Dimension(40,40));
    JTextField myTextField = new JTectField(5);
    // add to Panel
    myPanel.add(myButton);
    myPanel.add(myTextField);(2)
    yourComponent.setVisible(boolean);

  • RadioButtons some buttons and layout

    Hi,
    I try several times to create a particular layout with jsf using panelgrid and selectoneradio but after a lot of attempts I need hlp please.
    In practice I need to create a table where in each row there is a radio button, some text and a button image.
    I try in a way like this
    <h:panelGrid columns="2">
    <h:selectOneRadio ... >
    <f:selecitem itemLabel="..." itemValue="..."/>
    </h:panelGrid>
    <h:commandLink> <h:graphicImage value="/registration.jpg"/> </h:commandLink>
    </h:panelGrid>
    I try in many ways like add css style for vertical-align, for td height but I dont reach the goal to get and the same line radio button and text aligned with button image.
    Perhaps the problem is that the selectone radio create an html radio.
    Anyone has an idea?
    Thanks in advance

    Well if you are stuck with out of the box JSF components you will have to use the table and put the elements in columns to insure things line up.
    Look at the HTML source also for clues, it will absolutely create an HTML radio and I forget exactly what HTML panelGrid is using for layout

  • I downloaded Dreamweaver CC 2014.1, started using it but cannot find Show Fluid Grid Layout Guides button, Resize LI.link sizing handle and 'move up a Row' arrow. Where can I find them?

    I downloaded Dreamweaver CC 2014.1, started using it but cannot find Show Fluid Grid Layout Guides button, Resize LI.link sizing handle and 'move up a Row' arrow. Where can I find them?

    You have the latest version (CC 2014.1 or 2014.1.1) in which the interface condenses Design View with Live View buttons in normal layouts.  See screenshot.
    However, in FGLayouts, Live View is the only option which poses some editing problems and has been highly criticized.
    Is there any way to display the Design View in fluid grid pages?
    New Features in CC 2014.1 October Release
    http://helpx.adobe.com/dreamweaver/using/whats-new.html
    New Features in CC 2014.1.1 February Release
    https://helpx.adobe.com/dreamweaver/using/whats-new.html#Enhancements%20to%20Live%20View%2 0editing
    You can disable this restriction by adding an X to the FGLayout CSS.
        Dreamweaver Fluid Grid Properties
        dw-num-cols-mobile:      X 4;
        dw-num-cols-tablet:        8;
        dw-num-cols-desktop:    12;
        dw-gutter-percentage:    25;
    =====================================
    Having said that, it might just  be simpler to revert to an earlier version.  Log-in to Creative Cloud Desktop app.  Go to Filters & Versions > Previous Version.  See screenshot.
    Nancy O.

  • Buttons and Forms and Layout Adjustments

    I have an InDesign form in which there is a radio button that toggels the visabiltiy of a form field. It functions fine; no problems. However, when the the form field is visable, it covers other areas of text. I would like to know whether it is possible to have a layout make adjustments to accomodate space for the form field. In this case, have the text boxes shift down if the form field is open or shift up if the form field is closed. 

    It is possible, but not for radio buttons and not for PDF. I tested it. You can use a normal button to make the form field appear and make the text box jump down. You can use another button, to do vice versa. Both would be action type "Animation", which can't be assigned to radio buttons. So no toggling.

  • Recently did upgrade from OS 10.6.8 and to Mainstage 2.2.2 and have lost lights on my Gio pedal only in Mainstage - still have them with Logic.  Tried holding button and replugging USB cable, but did not fix it.

    Recently did upgrade from OS 10.6.8 and to Mainstage 2.2.2 and have lost lights on my Gio pedal only in Mainstage - still have them with Logic.  Tried holding button and replugging USB cable, but did not fix it.

    Hi
    Chamie7 wrote:
    Recently did upgrade from OS 10.6.8 and to Mainstage 2.2.2 and have lost lights on my Gio pedal only in Mainstage - still have them with Logic. 
    I presume that you mean that the switches do not light up as appropriate when you select a Patch in MS?
    If so, in Layout Mode, select each of the buttons in turn, and check that they are a) Assigned to the correct MIDI CC number etc, and b) that "Send Value to" has the correct Port selected.
    CCT

  • Difference between Submit Button and Button

    Hi,
    Please help me understanding the difference bewteen the following cases.
    1) Submit Button + ActionType : None
    2) Submit Button + Action Type :fire partial action
    3) Submit Button + Action Type : Fire Action
    4) Button + Action Type : fireAction
    5) Button + Action Type : firePartialAction
    My Understanding is 1st and 4th Both submits the form.
    Also, please let me know, is it a valid scenario where we use the SubmitButton and still gives ActionType. What difference it makes when action type is given with submit button.
    I understand that when we use 4th then it submits the form and whereas in case of 5th it doesnt.
    Thanks in advance
    Saurabh Agrawal

    Hi,
    Thanks for your replies.
    Actually i wanted to understand this in context of the issue we are facing.
    We have a text field and a button besides it. We have a TAB OUT even associated with the text field which is captured using firePartialAction event. Also, the button is a SUBMIT BUTTON with a partialFireAction associated with it.
    1) When you give % in textfield and tab out a popups come and load the data in a table - WORKS FINE
    2) When you dont enter anything in textfiled and clicks on the button, same popups comes and loads data into the table. - WORKS FINE
    3) When you give % in Text Field and clicks on the BUTTON, from JDEV, we verified that TAB OUT event gets triggered.Once that event is over, we can see the HOUR GLASS which doesnt go away. --- ISSUE
    Resolution Tested : When i just remove ACTIONTYPE from button and do NAVIGATION - 3, issue is resolved.
    Also, if i make that button as BUTTON and give FIRE ACTION, issue is resolved.
    Now the main concern is the same combination SUBMIT BUTTON and ACTIONTYPE: firePartialAction works fine in 11i and causes issue in R12.
    Please let me know your comments.
    Thanks in advance
    Saurabh Agrawal

  • I want to know how to clear the text area by the push off my next question button and ask a new ques

    I want to know how to clear the text area by the push off my next question button and ask a new question - also I want to know how to code in my project to where a user can enter a math question in one border container and the answer enters into the next container
    heres my code so far
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" backgroundColor="#1E5C75">
        <fx:Script>
            <![CDATA[
                protected function button1_clickHandler(event:MouseEvent):void
                    //convert text area into labelid to be identified by actionscript
                    richTextLabel.text = myArea.text;
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <!--container 1-->
        <s:BorderContainer borderWeight="7" x="28" y="10" width="200" height="138">
            <s:layout>
                <s:VerticalLayout paddingTop="10" paddingBottom="10"
                                  paddingLeft="10" paddingRight="10"/>
            </s:layout>
            <!--data Entry control-->
            <s:TextArea id="myArea" width="153" height="68"/>
            <!--end of data entry control-->
            <s:Button width="151" label="ask a question" click="button1_clickHandler(event)"/>
        </s:BorderContainer>
        <!--container2-->
        <s:BorderContainer borderWeight="7" x="509" y="10" width="200" height="138">
            <s:layout>
                <s:VerticalLayout paddingTop="10" paddingBottom="10"
                                  paddingLeft="10" paddingRight="10"/>
            </s:layout>
    <!--data entry control-->
            <!--convert tne data entry control into a label id in actionscript-->
            <s:Label id="richTextLabel" width="153" height="68"/>
            <s:Button width="151" label="next question" click="button1_clickHandler(event)"/>
        </s:BorderContainer>
        </s:Application>

    This is a user to user support forum.  We are all iphone users just like you.
    You are not addressing Apple here at all.
    This is an odd way to ask your fellow iphone users for help. Berating oterh users will not help you.
    "it's too fragile"
    No it is not.  i have never damaged one, nor has anyone I know.
    " U loose data when Ur phone is locked"
    No you don't.  Why do you think this?
    "and there is no customer support!!!  "
    Wrong yet again.  Apple has an 800 number and they have many retail stores and they have support articles that you can access using the search bar. Or you can contact them throgh express lane online
    "but I will go back with Blackberry "
    Please do.
    Good ridance

  • How to connect one page using button and by link in BSP

    how to connect one page using button and by link in BSP

    hi,
    use on 'onclick' functionality.
    1. In layout, onclick = 'NEXT_PAGE' of the button
    2. Capture the event in onInputprocessing,
    DATA: event_id TYPE REF TO  cl_htmlb_event.
    case event_id.
    when 'NEXT_PAGE'.
                navigation->goto_page( 'URPAGE URL' ).

  • Graphics and Textfields

    I was wondering if you use Graphics and objects like Buttons, Labels, and TextFields are they all drawn on the same graphics layer or is one of them drawn on top, if so which one?

    Are your components realy intersecting?
    If you want two components to intersect, the last of them will be partly hidden.
    import java.awt.*;
    class myPan extends Panel
         Button but1;
         Button but2;
         public void doLayout()
              but1.setBounds(0, 10, 40, 40);
              but2.setBounds(20,5, 40, 50);
         myPan()
              but1=new Button("but1");
              but2=new Button("but2");
              add(but1);
              add(but2);
    }In the code above, but1 will be partly hidden by but2.
    Ragnvald Barth
    Software engineer

  • Where to find names for buttons and toolbars for use in userChrome.css?

    I'm trying to change the layout of the new beta 8 browser, I would like to put the tab bar up into the title bar. The only problem with this is that the Home button and the New Tab button then stop working. I know that the Home button is called "home-button" but I don't know what the new tab button is called. I was merely wondering if there was a way of finding this out at all and if so how I would go about it.
    Thanks.

    Yes, you need to inspect a Chrome window.
    The DOM Inspector (DOMi) has a menu item (Search > Select Element By Click) and a button to "Find a node to inspect by clicking on it" (left icon on the toolbar).<br />
    You first need to open the browser window in the DOMi (File > Inspect Chrome Document) and choose the first from the list or choose the window that you want to inspect if you ave opened more.<br />
    Click the Find button and use the keyboard (Alt Tab) or the Task bar to go back to the browser window (do not click in the browser window).<br />
    Click that element with the mouse and keep the button pressed until you see a red border to indicate the the DOMi has located that element in the DOM tree.<br />

  • Lost my Edit Layout/Content Buttons

    Hi,
    I know it's probably a simple one, but I lost my Edit Layout and Edit Content Buttons and don't know what I did. It was probably something simple I hit. Help?
    Thanks!

    What do you mean by "extracting"?
    You are aware that Pages is not a Word clone? It will open and convert Word .doc/x files but may change the content.
    If you want a Word clone try LibreOffice [free] or use Word for Mac.
    Peter

Maybe you are looking for