How do I use different Layouts?

I am trying to make a program that runs in a window like this:
http://www.exyt-web.com/Window.gif
The problem I'm having is with the layout.
How do I have more than one layout ?
For example - as you can see in the image (hyperlink above) I wish to have a border layout with a JFrame at the North position and then in the South position I want to have buttons laid out in a FlowLayout.
Also with my radio buttons I want these in a GridLayout(3, 0) layout.
I made up some example code to test using different layouts - but it seems one layout always overrides the other...
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class LayoutTest extends JFrame
    public LayoutTest()
        setTitle("Hello World");
        Container contents = getContentPane();
        Container contents2 = getContentPane();
        contents.setLayout(new FlowLayout());
        contents.add(new JLabel("<FILTER [Type a th|    ]>"));
        contents.add(contents2);
        contents.add(new JLabel("< Filter Button >"));
        contents.add(new JLabel("<  Add Button   >"));
        contents2.setLayout(new GridLayout());
        contents2.add(new JLabel("< Button 1 >"));
        contents2.add(new JLabel("< Button 2 >"));
        contents2.add(new JLabel("< Button 3 >"));
        contents2.add(new JLabel("< Button 4 >"));
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
    } // HelloWorld
    public static void main(String [] args)
        LayoutTest theLayoutTest = new LayoutTest();
        theLayoutTest.show();
    } // main
} // class HelloWorldI know this obviously doesn't work but I hoped it would show what I was trying to do.
I also tried creating a new 'contents2' and then adding it into 'contents'
e.g. contents.add(contents2); My current code for the window I'm trying to create so far is:
import java.awt.*;
import javax.swing.*;
public class Menus extends JFrame
    public static void Menus()
        // Creates a new JFrame, with the title specified in quotation marks.
        JFrame frame = new JFrame("Film Database");
        // Sets the default close operation of the frame.
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // Creates a new menu bar for the frame.
        JMenuBar menuBar = new JMenuBar();
        // Creates a new menu for the menu bar.
        JMenu menu = new JMenu("File");
        addFrameContents(frame, menuBar, menu);
        // Sets the new menu bar on the frame
        frame.setJMenuBar(menuBar);
        frame.pack();
        frame.setVisible(true);
    } // HelloWorld
    public static void addFrameContents(JFrame frame, JMenuBar menuBar, JMenu menu)
        // Adds the menu to the menu bar.
        menuBar.add(menu);
        // Creates a new item for the menu with a small icon.
        JMenuItem menuLoad = new JMenuItem("Load", new ImageIcon("C:/load.gif"));
        // Adds the new item to the menu.
        menu.add(menuLoad);
        JMenuItem menuSave = new JMenuItem("Save", new ImageIcon("C:/save.gif"));
        menu.add(menuSave);
        JMenuItem menuQuit = new JMenuItem("Quit", new ImageIcon("C:/quit.gif"));
        menu.add(menuQuit);
        // Creates a new container.
        Container contents = frame.getContentPane();
        // Sets a new layout for contents, in this case FlowLayout.
        contents.setLayout(new GridLayout(2, 0));
        // Adds new JLabels to the container.
        contents.add(new JLabel("< JLabel 1 >"));
        contents.add(new JLabel("< JLabel 2 >"));
        contents.add(new JLabel("< JLabel 3 >"));
        contents.add(new JLabel("< JLabel 4 >"));
        JLabel thisLabel = new JLabel("Hello");
        thisLabel.setLayout(new FlowLayout());
        JLabel thisLabel2 = new JLabel("Hello2");
        thisLabel2.setLayout(new FlowLayout());
        contents.add(thisLabel);
        contents.add(thisLabel2);
    public static void main(String [] args)
        Menus();
    } // main
} // class HelloWorldAny help on how I can use two separate layouts in the same frame would be great!
Regards,
Tom

doing this:
Container contents = getContentPane();
Container contents2 = getContentPane();
does not create 2 different containers. It's just creating 2 variables that refer to the same container. There is only 1 content pane in a window/frame. A container can only have 1 layout.
If you want to have 2 layouts, you create 2 panels with separate layouts and put what you want in each panel, and put both panels in the content page.

Similar Messages

  • How can I use different iTunes accounts on one iPad?

    How can I use different iTunes accounts on one iPad?

    You can't, well not easily anyway.  The iPad is not meant as a multi account device. 
    You can Sign Out of your iTunes account in Settings->iTunes and App Stores->Apple ID->Sign Out
    However if you sign in with another ID and then download past purchases with it you will lock out the previous ID for 90 days. Which means it will not be able to be used on the iPad for 90 days. 

  • Use different Layouts for Summary and Details in Drill down report

    Hi All,
    I have a 2 level drill down report in ALV.
    The summary report has certain fields and the Detail report has different fields. Now my problem is that when i use a default layout (with all fields of summary report) for the summary report, and drill down to the detail report i'm missing the fields on detail that are not in Summary. And if i save the default layout as default (with all fields of Detail) and go back to sumary, I'm missing the some other fields on summary (which are not on detail report).
    Is there a way to make different default layouts for each of those summary and detail reports:
    Also as the layouts are choosen by the user, i cannot hardcode any particular layout;
    So if the user chooses a layout for detail; it has to stay the same layout for the detail report if he goes to summary and then back to detail; unless the user changes the layout again.
    I'm using two different Layout types for each report. but i still cannot get the desired effect.
    Data:
          gt_layout_s             type slis_layout_alv,
          gt_layout_d             type slis_layout_alv,
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = g_repid
          is_layout                = <b>gt_layout_s</b>
          i_callback_top_of_page   = g_top_of_page
          i_callback_user_command  = g_user_command
          i_callback_pf_status_set = g_status
          i_save                   = g_save
          is_variant               = gs_variant
          it_fieldcat              = gt_fieldcat[]
          it_events                = gt_events[]
        importing
          es_exit_caused_by_user   = gs_exit_caused_by_user
        tables
          t_outtab                 = it_summary.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = g_repid
          is_layout                = <b>gt_layout_d</b>
          i_callback_top_of_page   = g_top_of_page
          i_callback_user_command  = g_user_command
          i_callback_pf_status_set = g_status
          i_save                   = g_save
          is_variant               = gs_variant
          it_fieldcat              = gt_fieldcat[]
          it_events                = gt_events[]
        importing
          es_exit_caused_by_user   = gs_exit_caused_by_user
        tables
          t_outtab                 = it_detail_disp.

    Here is how you differentiate between the layout of two different grids. There is the parameter, IS_VARIANT in the function. You usually leave it empty or pass only the report name and username. <b>What you need to do is to pass unique string for each grids to the HANDLE field of the parameter IS_VARIANT.</b> You can probably hard code it as HEADER and DETAILS in your case. Once that is done, system identified that these two different layout for different grids.
    Regards,
    Ravi
    Note : Please mark all the helpful answers<u></u>

  • How can I use different calendars associated with different emails to see appointmen​ts separately​?

    I have 3 emails accounts on my Blackberry curve. I want to use different calendars for different type of reminders/appointments. How can I do that? In calendar I pressed menu key and then clicked on select calendar, choose one email address (email 1) then entered an alarm but now if I go to a different calendar associated with different email ( email 2), it also shows me that alarm which I entered in email 1 calendar. Thanks for help

    Don't have LV handy to open the old code, but I did read through the thread you referenced.  It sounds like the example configured 2 counters to create the variable-freq finite pulse train and configured a 3rd counter to count the # steps generated as verification.   That 3rd counter would be a problem for you as there is no internal timing signal connection between your 2 USB devices.  You would need to run a physical wire connection and change some of the config code to match.  Alternately, you could just delete all the code associated with the 3rd counter for now because it isn't strictly necessary.
    Further advice/questions:  Are you planning on a pure sine wave of frequency such that you oscillate with both positive and negative velocity (example: varying from -1000 to +1000 Hz clockwise)?  Or is there a nominal average frequency with a small sine wave superimposed (example: nominal of 1000 Hz clockwise, variation of +/- 50 Hz)?
    I *think* you may be dealing with more of a continuous pulsetrain situation, which is actually much simpler.  You would only need 1 counter/timer, though you would still perform the freq changes in a timed loop which uses the pulsetrain as its timing source.  You'd just need to keep track of your total elapsed time so you could figure out the right sinusoidal freq value at the moment you're ready to update it.
    Another subtlety to watch out for if you're oscillating about 0 velocity  -- don't try to create a frequency that is lower than the rate at which you need to update.  Also, with steppers you may have mechanical stability issues at low freqs like 10's to low 100's of Hz.    These kinds of things may need to be managed as special cases which force you to deviate from a "pure" sine wave.
    -Kevin P.

  • How can I use different presets on the same instrument?

    I use Session Horns Pro with Kontakt Played in Mainstage 3.
    You can choose different presets within Session Horns without having to load additional samples and take up more memory.
    How can I create different patches that use the changes of Session Horn Patches without duplicating the samples in Kontakt?
    If I copy the channel strip and 'Paste as alias" changes made to one copy are the same as the alias. It seems there must be a way to "Automate" controls in an alias that is unique to each patch. I could also use to do this on instruments like Vintage Clav and Vintage B3 where I don't want to create duplicate instances of CPU hungry plug ins just to use different presets in different patches.
    Thanks in advance to anyone out there who knows of a workaround!
    Larry Ketchell

    Yes.  You can sync apps/music/etc to as many of your iphones/ipads/ipods as you like.
    Here is how to use the iphone without a wireless plan:
    Using an iPhone without a wireless service plan

  • How can I use different fonts?

    Id like to know how I can use a different font from the standard one when Im typing things. Any help is appreciated.

    if you are talking about the internet, you will have to go to the preferences of the browser you are using...for instance, in Camino, it is Camino>Preferences>Appearance>Fonts>then you select the font...i don't know about Safari
     Mac Mini Intel Core Solo- 1 GB RAM- Superdrive- Production week 18   Mac OS X (10.4.7)  

  • How can i use different computer to manage iPhone?

    I have been using iTunes on a Win7 machine since i had my iPhone4.
    Now, since i have some problems in Win7, i'd like to switch to my Mac mini (mac os x Lion) to manage (sync, backup, update) from now on.
    If i connect, i am not allowed to backup since this is not the computer "attached" to this iPhone. I do have most of the stuff on both machines (music, apps, and so on...)
    How can i change this? Indeed i want to avoid replacing my iPhone content by different things...
    Thanks,
    Robert

    you need to move your iTunes Library from your Windows machine to your Mac.  Apple has iTunes set up so that you can't simply use multiple computers to back up and download files to your phone.  It keeps us honest and doesn't allow you to share music, movies, books etc.
    You should be able to copy your library to a flash drive or DVD on your PC, unless it is really huge.
    Or you can turn on home sharing on both machines and copy your files from the PC to the Mac.
    http://www.apple.com/support/homesharing/

  • How do i use different Apple ID on my iPhone?

    Is there a way to use a different ID from the App Store for iMessage on mu iPhone?

    To fix this go to Settings>Messages>Send & Receive and do one of the following:
    Either uncheck the email address shown under "You can be reached by iMessage at" on both phones; or
    If you want to continue to receive iMessages at this email address, on one of the phones, tap the Apple ID at the top, sign out, then sign back in using a different Apple ID.  Note: you can continue to share an Apple ID for purchasing from the iTunes and App stores.  It does not need to be the same as the ID you are using for iMessage, FaceTime and other services.

  • How can i use different suffix for read-only and read-write?

    I have a directory server with 11.1.1.5,I have created the root dn:o=test.com.cn. This dn is replication enabled and it is the consumer.
    I want to create another suffix:ou=test1,o=test.com.cn and I wish to write some data from own.
    However,when I use dscc to create the suffix,I can not find any entry under the suffix.
    When I use the command:
    ldapsearch -b "ou=test1,o=test.com.cn" -s sub "objectclass=*"
    I get this:ldap_search:no such object
    I can not import any ldif to this suffix.
    I get the error:
    import test1: WARNING: Skipping entry "uid=jwalker, ou=People, ou=test1,o=test.com.cn" which has no parent, ending at line 280 of file "/opt/dsinst/test1.ldif"
    When I use dscc to change the suffix to rootdn,I get the same error too.
    How can i do now?
    Thank u very much.

    There are a few issues here, ie
    "uid=jwalker, ou=People, ou=test1,o=test.com.cn" has no parent.
    Did you create ou=People, ou=test1,o=test.com.cn before you tried to create above dn?
    Also, your suffix naming is very poor and will result in more problems later on especially since you want to create sub suffices.
    you should use the DC notation, ie dc=test,dc=com,dc=cn that way you can easily attach o=test1,dc=test,dc=com,dc=cn
    This way you would be able to keep your separate suffices inside separate database files and you will have less headaches when you try to replicate and do bulk re-initialisations.

  • How can i use different language in Forms9i or 10g

    Hi,
    I want to use two languages at a time on forms9i.So i have Configured my NLS_LANG parameter on Form 9i by REGEDIT. and also install that others language setup by REGIONAL SETTING.After it on run time i am abled to insert
    data in other language and successfully saved it.BUT when i query that particular data they are showing me bug valuse.or like some currpt data.
    but when same configration,i use forms6i then form6i working well and retrieving
    fine data.as it is as i entered.
    plz Help me.
    i am worried about that issue.why form9i not returning fine data.
    Regards
    Mr.khan

    This is most likely due to a mismatch of the NLS_LANG you have on the client and the one you have for the database.
    Exactly what settings to do you have for the two?

  • How can I create multiple pages, with different layouts to the others, in DW fluid grid layouts?

    Hi everyone,  : )
    I am creating a website using FGL in DW CS6, v12.0 build 5808.  I do not have Creative Cloud (do you have to pay to use this service?).
    I have created one layout for my home page.
    I would like to create several more pages, but I want them to use different layouts (as well as different content).
    I tried to do something similar before using 'save as' (this was with a non-FGL), but whenever I changed the original page that I had 'save as'd' from, the layout in all the other pages would change too!
    I found a possibility from someone else online suggesting using a template, but have not tried it yet: http://www.linkedin.com/groups/Adding-second-fluid-page-in-119937.S.192422240
    I'm a bit scared of breaking everything, as I am new to web design and have had to restart the whole process a few times due to messing up the fluid.css etc and other issues, so I am taking baby steps.
    Happy to try whatever's suggested and, while I wait for (I hope) your responses, I think I will try the template thing, but from the reply the person who asked the question gave, it sounds like his subsequent pages changed too, as I mentioned above?  *scared*  ; )
    If anyone can help me with this query I would be very grateful.  Thank you!  : )

    Thanks David.
    I tried using different IDs for the other pages, but eventually one of the divs seems to 'break' - it overlaps other divs, or cannot be moved or resized (you can select the outline and it goes blue, but no 'move up a row' or down a row or 'lock to grid' etc icons appear and it can't be drag-re-sized), plus the green overlay disappears (just from that div.  I'm aware of how to turn visual aids on and off), so it seems broken.  This often seems to happen if you rename a div once it's been created; it does not rename in the layout.css on the right side panel (CSS Styles) in DW and the 'broken' behaviour above is exhibited.  Do you know anything about this?  Is this the 'edit this doc at your peril' stuff that most tutorials seem to mention?  Am I doing something wrong?
    I also tried making an FGL and saving out the original boilerplate.css, layout.css and respond.js.  Then created multiple new FGLs and each time it created new versions of layout.css (called 'untitled-1', 2 etc.).  Once I had created all the FGLs, I deleted all the new boilerplates and untitled.css files.  Then restored the original ones and changed the link at the top of each page's html to refer to the same filename (the original layout.css), rather than untitled.css.  I thought this might work and it seemed to for a while, but then as I had to add new div names for the sections on each page, it eventually broke (as above).
    Anyway, I think you have a good point about different layouts and it occurred to me also while I was exploring and waiting for replies here.  I think I will make one layout for all pages and go with that.  I have a couple of questions about that though:
    1. I think the max number of divs I want for one of the pages is 10, but some pages need less divs.  If I only fill e.g. 8 divs on one page, will the other ones be sat there empty?  I think they will actually...I guess I'm asking because I have not tried it yet (will do after this) and it takes so long to do this trial and error.
    2. If the amount of content in each div is different, e.g.  let's say Page 1 has 6 lines of content in div1, but page 2 may have an unlimited amount of content (I will want to add to it in the future).  Will this result in the div on page 1 being a huge block of empty space after its 6 lines?
    Thanks so much for your help!

  • How to use different Vlans outside another gateway in sg-300 28?

    dear all
    how shall i use different vlans outside another gateway in sg-300 28?
    Example:
    vlan2 192.168.2.0/24 gateway 192.168.2.1 outside router gateway 192.168.2.254
    vlan3 192.168.3.0/24 gateway 192.168.3.1 outside router gateway 192.168.3.254
    should me doing in sg-300 28?
    thanks.

    Hi Amin,
    Leave the switch in Layer 2 mode 
    Cable  VLAN2  to the to the outside router gateway 192.168.2.254 interface
    cable  VLAN3  to the to the outside router gateway 192.168.3.254 interface
    Excuse the rough diagram
    Make the port going to the outside router gateway,  untagged in the vlans they will be transporting. (I am assuming that the router gateway is not vlan aware.)
    IP hosts will most likely get DHCP from the router gateway.  The IP hosts will then automatically send IP traffic to the router gateway.
    VLAN 1 in my switch,  could  then be the only interface within the switch  that has a IP address associated  with it,  for management purposes.
    I can see from you post,  that English is not your first language,  if you want to speak to someone,  you can ask a question by going to;
    www.cisco.com/go/sbsc
    regards Dave

  • How to use different stylesheets for ChangeAttributeRequest workflow in OAM

    Hi,
    We have a requirement to invoke different change attribute request workflows (change password ,change email etc..) from external JSPs..
    I want to apply different stylesheets for each workflow. In the workflow URL if i enter style=stylesheet-name its not using that stylesheet. Always its using the same base stylesheet (wf_changeattr.xsl). How can i use different stylesheets? Any pointers on this is appreciated.
    Thanks inadvance..
    Regards,
    Srikanth

    Hi Colin,
    Thanks for your response. Now i am able to invoke different xsls for different workflows.
    I did a mistake by entering style=stylesheet-name. I verified the same with xsl=stylesheet-name.
    Its working fine now..
    Thanks & Regards,
    Srikanth

  • How can I use the same session for different components acroos application ?

    I am trying to include the components(chat, filesharing, whitboard) in different parts of my application. User should be able to access any of the component. We would like to have a single "ConnectSessionContainer" so that we don't see same user creating a seperate session for each component.
    Is there a better way of dealing with this other than declaring the "ConnectSessionContainer" in the main application ? Is there a way to check if we have a "ConnectSessionContainer" session already established ? Please help . Thanks.

    Thanks for the response. Let me explain what I am trying to do..
    I am trying to create components at different places(screens) of the flex application (not in the same .mxml file).
    Each time I create a component, I am using a "AdobeHSAuthenticator" and "ConnectSessionContainer" which is resulting a new participant in the room.
    For example
    screen1.mxml -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:Roster id="myRoster" width="100%" height="100%" />
            <rtc:Chat id="mychat" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    screen2.mxml (in the same application) -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:SharedWhiteBoard id="wb" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    Here, I open a screen1 and authenticate as UserA and when I try to open screen2 flex is considering me as another user though I am in the same application.
    1) How can I use different components which are in different flex files as a same User ?
    2) Should I place my <rtc:AdobeHSAuthenticator> and <rtc:ConnectSessionContainer> in the main application which calls the screen.mxml?
    3) What is the best way to do it ?
    Thanks for your time !

  • Best Practice in using Tracking Layout

    Can anyone tell me how best to use Tracking Layout and how to create the different new layout in tracking layout view.
    Kindly let me know whether the layout as explained below can be shown:
    Toplayout shows the list of projects and the bottom layout should show the list of resources and while selecting the resources should show either histogram or spreadsheet to show the resources based on the usage for all the projects. With that we need to find out which is oveallocated and which resource is free.
    Thanks in advance.
    Regards,
    Olby

    user8410696,
    Sounds like you need a simple resource loading histogram with a threshold limit displayed for each project. I don't know if you are layout saavy but layouts can be customized to fit your exact needs. Sometimes P6 cannot display exactly what you desire but most basic layouts can be tweaked to fit. I believe that you need a combo of resource profiles and columns.
    I'll take some time today and do some tweeking on my end to see if I can modify one of my resource layouts to fit your needs. I'll let you know what I find out.
    talk to you later,

Maybe you are looking for

  • Why did my iPhone (not PCs) suddenly require a change in POP/SMTP server spec's for one (only one) of my email accounts?

    Hello! Why has my (iPhone only) POP and SMTP settings suddenly changed for one (oddly only one) of my email sub-accounts? -It changed from "incoming.verizon.net" and "outgoing.verizon.net" to pop.verizon.net and smtp.verizon.net, respectively, ALL BY

  • Starting listener

    I tried to check the status of the listener lsnrctl and I got an error . the Net configuration assistant failed when I installed the database . please give me detailed instructions because I am new to oracle D:\Oracle_DB_Enterprise_11_Base_Dir\Oracle

  • Time Machine crashing Adobe Dreamweaver and CS#

    I just got TimeMachine working with a TimeCapsule. Ever since I've seen incredible slowdowns and stalls in Fireworks and DW3 keeps crashing on open. I have to repair permissions to get it to work. Anyone else seen this muddled behavior? I also am see

  • Sequencing of photos when streaming to iCloud

    HI All I recently streamed a project to icloud from aperture. I altered the order of photos in my Aperture project workflow (i.e. from the original chronological as taken). Having seen stories of streamed photo sequencing in icloud reverting to the o

  • Convert "select top 5 ..." in Oracle8i

    -- We are in the process of migrating application from SQLserver7 to Oracle8i, -- and trying to convert a procedure to return top 5 -- rows given a search string. -- In SQLserver7, "select top 5 ... " -- The Oracle8i Application Developer's Guide - F