I'd like to make a list of interactive Swing components....

EDIT: I've been doing more research about Layout Managers and it appears that BoxLayout may provide me with the solution I need. I'll mess around with it for awhile and report back if I still need help. Thanks pals!+
I would like to make a list of JPanels laid out in basically a column. One on top of the other. That's not so difficult, but I need to make it able able to add and remove panels in response to user-driven events (in other words, I can't just hard-code them all, and the panels are generated on the fly, so I don't even know how many I'll need to be displaying until I need to display them.
Here's a simple mockup of the window I'm talking about.
|      - o x |
|____________|
|            |
|            |
|   Panel1   |
|   Panel2   |
|   Panel3   |
|   Panel4   |
|____________|At first, I thought a JList would serve my purpose, but you can't add interactive Swing components to JLists (or JTables)... they'll render, but that's all. My panels will contain a button and a checkbox, so this is a no-go.
I was also thinking I could just manage the placement with GridBagLayout and just keep indexes for the current y position, but if there's an easier way, I'd rather not go this route. It has me writing a lot of extra code and manipulating a lot of fields of GridBagConstraints, which opens me to less-understandable code and more error-prone code, on account of I'm great at making little mistakes when I'm setting craploads of constraints.
Does anyone have any ideas? It'd be ideal if there was just some sort of container I could plop them in with add and remove methods (a la JTabbedPane or something).
I'm pretty new to Swing, so maybe I'm missing something obvious.
Edited by: Caryy on Sep 30, 2010 4:15 PM

I would recommend using BoxLayout or Box.createVerticalBox(). As mKorbel already mentioned, you need to call revalidate() after adding any component to an already realized/visible container, and additionally call repaint() after removing a component. To resize the top level window to accommodate its new content, you would call pack(). Or, again as suggested by mKorbel, wrap your panel/Box in a JScrollPane.
db

Similar Messages

  • I have a long numbers document, that I'd like to make more print friendly. It is a list of my DVD's that I just listed one after the other (1-200) when I tried to print it, it would be 18 pages, can I change it to be more like columns side by side to save

    I have a long numbers document, that I'd like to make more print friendly.
    It is a list of my DVD's that I just listed one after the other (1-200) when I tried to print it, it would be 18 pages,
    can I change it to be more like columns side by side to save paper?

    S,
    I assume that you also have Pages on your computer (or some other capable WP program). I also assume that you have eliminated any unnecessary columns, so you have a 1-column table in Numbers.
    When it comes time to print, Copy the entire Table: Click on the table name in the Sheets Pane and Command-C.
    Switch to Pages, open a blank WP template and set the number of columns to 3 or so. With the Text Insertion Cursor flashing on the first line of the first column of the blank template, Command-V. Your table should paste into the Pages document as an Inline Object and will Wrap on the page as you desire. Then Print in Pages.
    Jerry

  • HT2458 How do i make my voicemail look kind of like my recent calls list?

    Right now i have to Call my voice mail but my friend told me that you could make your voicemail a list like the recent calls list. Please help me i am super confused.

    if your with an official US carrier what you are refering to is visual voicemail. 
    Go to settings then general, then Cellular.
    There turn cellular data off, then back on.
    Now go to voicemail and add your voicemail password, now you should have visual voicemail.

  • How can i make a list like Razer Game Booster in wpf C#

    Hello every one
    I asked this question in stackoverflow, and they just gave me negative points! I don't know why,
    but at least
    I expected to get answer in here.
    I trying to make a software with WPF in C# that the theme is
    similar to Razer Game Booster.
    I made many effect similar to
    Razer Game Booster in my software but I don't Know how can i make a list like that software!
    You can download Razer Game Booster in this link: http://www.razerzone.com/cortex/download
    Now, What exactly i want?! I'll show you with following pics:
    After adding a few items, a scroll bar will appear and if you do nothing, it will be hidden after a few seconds:
    Image link: http://imgur.com/XIl3Bk9
    After placing the mouse on the items (on hover status):
    Image link: http://imgur.com/8NbUrIx
    Which one of objects in visual C# and WPF Application can do this?!
    if you interested to see what I've done, unfortunately I tried it and
    failed! Now I asking you to help me and show me how can i do that?
    any advice can help me. I'm waiting for your answer.
    thank you guys so much.
    I'm sorry
    if I bothering you.

    There are probably 1000's of tutorial about layout in WPF but I have found that the people on this forum have the best handle on how to use WPF.  I am now near a workstation and have the following code example which should get you started. (the example
    is in VB but it is the XAML which is important).
    <Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
    <Window.Resources>
    <Style TargetType="ListBox" x:Key="myListbox" >
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"></Setter>
    <Style.Triggers>
    <Trigger Property="IsMouseOver" Value="True">
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Visible" ></Setter>
    </Trigger>
    </Style.Triggers>
    </Style>
    </Window.Resources>
    <Grid Background="#FF040404">
    <ListBox Style="{StaticResource myListbox }"
    HorizontalAlignment="Left" Height="237" Margin="23,46,0,0"
    VerticalAlignment="Top" Width="470"
    ItemsSource="{Binding theList}" Background="Transparent" >
    <ListBox.ItemsPanel>
    <ItemsPanelTemplate>
    <UniformGrid Rows="2"></UniformGrid>
    </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemTemplate>
    <DataTemplate>
    <Grid Background="#FF574A4A" Width="150" Height="75" Margin="0,0,10,0" >
    <TextBlock Text="{Binding theCaption}" VerticalAlignment="Bottom" Foreground="#FFF5EFEF"></TextBlock>
    </Grid>
    </DataTemplate>
    </ListBox.ItemTemplate>
    </ListBox>
    </Grid>
    </Window>
    Class MainWindow
    Public Property theList As New List(Of theItem)
    Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
    For i As Integer = 0 To 5
    Dim ti As New theItem With {.theCaption = "Caption " + i.ToString}
    theList.Add(ti)
    Next
    DataContext = Me
    End Sub
    End Class
    Public Class theItem
    Public Property theCaption As String
    End Class
    The above XAML define a listbox with the properties I mentioned in my previous post.  There is a listbox with an ItemTemplate (define how each item should be displayed) and a definition of how the layout
    should be done (ItemsPanel).  The is also a style which uses datatriggers to show/hide your scrollbar.  If you have questions about what I presented please ask but I would ask that you try it first so that you can see how it looks .
    And I'm sorry for the small font above but this forum editor constantly give me problems.
    Lloyd Sheen

  • How can i create my BC featured product list in to a slide show for multiple products in one row. i have products aligned in a row i just would like to make it a slide show of the multiple (20) products.

    i have products aligned in a row already using custom css.i just would like to make it a slide show of the multiple (20) products in the one row.
    i am using the featured product module from the development section of business catalyst. i would love to display as many new products as possible in one row of products. so i can just click a arrow left button and scroll through the products.
    holy-shippers.businesscatalyst.com is the site i am mentioning.

    Hello,
    Aside from any custom implementations that may be suggested by any other members, you could also consider using some hero-type slider like those found on our new responsive templates, and have each web-app item contain a product.
    Kind Regards,
    Alex Pavelescu

  • I like to manually create lists when I take notes, so is there a way to create a shortcut/hot key for different symbols in the Pages inspector?

    Not really a Pages user, but I am trying to make the switch from Word if I can figure out a few ways to customize Pages. I don't want to create a new paragraph style because I rearrange my lists a lot. I think there is a way to automatically create a custom list style, but I like to make lists manually because I frequently change things around. I would like to be able to manually add symbols. I know that Option + 8 will give me a bullet, but I would also like to use different symbols I found in inspector, like a black square and a black triangle. Anyone know if this is possible?

    If what you're looking for is a more flexible way of quickly just including any symbol of your preference when you're taking notes (without establishing a more structured list like picas suggestion) there are a number of ways to use keyboard shortcuts to get a variety of symbols. Here is a link that you can use to hopefully find what you're looking for:
    http://www.wikihow.com/Make-Symbols-on-a-Mac
    You can also try http://support.apple.com/kb/ht1343 to find other keyboard shortcuts.

  • My iPhoto Library is on an EHD, I would like to make a backup on a second EHD

    My iPhoto Library is stored on an Seagate 1TB external hard drive (which is also my Time Machine or automatic backup), not on my MacBook Air. That means that I always carry the external hard drive wherever I go to access my photos (and to keep backing up my documents). I travel quite a bit so just in case the Seagate stops working, I would like to make a backup of my iPhoto library on a second EHD to leave at home.
    I have another Seagate 500GB which I used in the past on a wifi for my iPad, which also contains some photos straight from my camera (that means they did not get the 'iPhoto treatment' as I don't want to clog up the iPad through Airdrop).
    There is still plenty of room on this Seagate 500GB (300GB free) for an extra iPhoto Library backup. It should be simple enough but so far I have been unable to understand how. Clear steps to how to do it would be much appreciated.
    Many thanks!
    pilot03

    To check how the drive is formatted, connect it and run Disk Utility (in your Utiilty folder). Click on the drive's icon. (You'll see to icons, the top one is the drive itself and will have a name including the manufacturere's name and a second one is indented. Click on the top on. Now look in the bottom right corner of the DU window. WHat you want to see is: Partition Map Scheme : GUID Partition Table
    If you don't the drive should be repartitioned. Click on the partition tab, Click on Current & select 1 partiton, click on options and select GUID. That will erase the drive. Now Click on the indented icon, click on the erase tab and make sure you see MacOS Extended (Journaled) next to the Format label. If not, click on the popup menu and select it. Then erase. Now the disk is ready.
    If it is formatted for Mac already, after mounting the drive select its icon and select Get Info from the File menu. Look at the very bottom of the long dialog box. You should see a list of permissions, your user name should be listed and your permissions should be Read & Write. Or there might be a checkmark next to a label called Ignore Ownership. That should be checkmarked.

  • How to make Mutt list messages in a descending order

    Hey.
    How do I make mutt list my messages with the newest message at the top, like in the web interface of Gmail? It is called descending listing starting with the newest message, I suppose.

    .:B:. wrote:
    I have recently switched to Mutt myself, and the manual is unfortunately not a good thing to start. I have pieced together a nice config mainly by googling and stealing stuff from other people's configuration files.
    The setting you want is
    set sort = reverse-date-received
    That will show the most recent mails on top.
    If you want it threaded according to the most recent e-mail in a thread, this should work:
    set sort=threads
    set sort_browser=reverse-date
    set sort_aux=last-date-received
    Alternatively you might use
    sort_aux=reverse-last-date-received
    Hey, thanks. The first one did not work for me, but the second (alternate) did, so this would be the correct config:
    set sort=threads
    set sort_browser=date
    set sort_aux=reverse-last-date-received

  • How can I make the list of all bookmarks as my startpage?

    How can I make the list of all bookmarks as my startpage?

    i am also like what you asked because the bookmark i like chrome bookmarks arragement but not good on firefox and the current bookmarks makes hard to know where and what i am look i said the bookmarks not shows well and its hard
    I like bookmark must have a small image whenever saving the page and it have a small details about the page that helps to find easily

  • I want to convert a series of names into a table (in either numbers or pages). The list I have has a name and then an email address in brackets, followed by a 'yes' or a 'no'. I would like to separate the list into three columns

    I want to convert a series of names into a table (in either numbers or pages). The list I have has a name and then an email address in brackets, followed by a 'yes' or a 'no'. I would like to separate the list into three columns - the first containing the name, the second containing the email address and the third containing the 'yes' or 'no'.
    Can you help me ?

    The question that needs to be answered is what is separating the columns? Is it a single tab, one or more tabs, spaces, or what?  Or is it the brackets that makes the separation between the three pieces of data?
    If it is always a single tab, that makes it really easy.  All you have to do is find/replace the brackets with nothing (as Wayne said)
    If it might be multiple tabs, you can find/replace tab-tab with a single tab and repeat that a few times until no more double-tabs are found.
    If it is one or multiple spaces, that might be difficult. I'll think about this one if this is what you have. I'll ignore this possiblility for now.
    If it is the brackets separating the three pieces of data, you would Find/Replace the left bracket with a tab then do the same with the right bracket.

  • How to make Select List Read only (Keep key Data)

    I'd like to make a select list read only when the screen is in maintenance mode because the select list value is part of the key.
    However, when I make the select list read only, the update fails because it appears making it disable lose's it's value.
    How can I make a select list read only and keep it's value for update.

    In HTML Header I have
    <script type="text/javascript">
    function Disable_List(pthis,hideitem)
    if ($x(hideitem).value == 'Y')
    {   $x(pthis).disabled = "disabled";
    </script>
    <script type="text/javascript">
    function Load_Start()
    Disable_Item('P5_SUBCODE','P5_XW_HAS_VALUE');
    Disable_List('P5_LTY','P5_XW_HAS_VALUE');
    </script>
    When I click apply changes, my Validation check that doesn't allow nulls in the "P5_LTY" fires saying the field can't be null. The select list is grayed out and I see the value, but the validation check thinks it's null.
    Edited by: spuchc on Jun 15, 2010 8:03 AM

  • I want ro remove all of the default Firefox bookmarks. There are way too many and none of which are usefull to me. I would like to make my old IE Favorites folder the default. How can I do this?

    I need to remove the default Firefox bookmarks.
    There are way too many and none of which are usefull to me.
    Also, I am vision impaired and reading through such a long list is very eye-fatigueing to me.
    I would like to make my old IE Favorites folder the default. How can I do this?

    Did you import an iPhoto Library from the old Hard Drive? Do you still have that old Library?
    The way to clear out a Library is to Export the photos - Apps like iPhoto2Disk or PhotoShare will help you export to a Folder tree matching your Events.
    For the annoying start-up message:
    Go to your Pictures Folder and find the iPhoto Library there. Right (or Control-) Click on the icon and select 'Show Package Contents'. A finder window will open with the Library exposed.
    Look there for a Folder called 'Import' or 'Importing'.
    Drag it to the Desktop. *Make no other changes*.
    Start iPhoto. Does that help?
    If it does then look inside that folder on your desktop. Does it contain anything you want? If not you can trash the folder.

  • How to make a list item field with DATE data type?

    I have a column with DATE data type. Using forms 6i I want to generate a poplist list item field with this column while the value of the elements in the list to will be day names like SATURDAY,SUNDAY,MONDAY. if we change the data type from date to char, it will work properly but now with DATE data type behind it, it gives the following error message
    "FRM-32082: Invalid value for given item type.
    List WEEKREST
    Item: WEEKREST
    Block: EMPRESTS
    Form: MODULE3
    FRM-30085: Unable to adjust form for output."
    Using forms 6i how to make a list item field with DATE data type which can hold day names?

    Set your date column as a hidden (non-displayed) field. Create your list item with the varchar2 day names. Create the list item as a non-base-table field that accepts the text values of day names. On that field, create a when-validate-item trigger that translates the text into a real date, which it then uses to set the value of the actual base-table item.

  • I have all my devices connected to iCloud.  I would like a reduced contact list on my iPhone without removing any from my master list on my computer.  How do I delete contact numbers from my phone without disrupting the master list on my computer?

    I have all my devices connected to iCloud.  I would like a reduced contact list on my iPhone without removing any from my master list on my computer.  How do I delete contact numbers from my iphone without disrupting the master list on my computer?

    Are you trying to reduce the visual clutter on the phone, save space on the phone, or limit the security exposure if your phone is stolen?
    If you are only wanting to reduce the visual clutter and make scrolling through the list faster, you could set up a group on the computer containing only the contacts you want to see on my phone (called, for example, "Show on my Phone") and enable only that group inside Contacts on the phone. You might even have one or more existing groups that you could enable that way (maybe "Family" and "Personal").

  • I was told of an application that will allow the use of a second screen to view my data and files, but I forgot its name. I'd like to make the connection because my LCD is broken.

    I was told of an application that will allow the use of a second screen to view my data and files, but I forgot its name. I'd like to make the connection because my LCD is broken.

    You don't need an application, just plug a compaitble monitor into the display port of your MacBook Pro, set the screen up in System Preferences>Displays

Maybe you are looking for

  • OO Programing in Java

    Hi Java People, I have a class A: class A { public int a1; public int a2; public A() { } // end A class and a class B that extends A: class B extends A { public int B1; public B() { } // end B class and somewhere in my code I have an instance aObj of

  • I am unable to forward pictures . the wording goes through but not the pictures

    When forwarding an email from someone the wording is transmitted but not the pictures. This is a new problem and I'm not sure what has happened == This happened == Every time Firefox opened

  • Transferring iTunes from Windows to Macbook via USB...

    ...When I go to copy the iTunes file to the music folder, it says 'The operation can't be completed because the item "iTunes Library Genius.itdb" is in use.' Advice greatly appreciated.

  • Is it bad to use Fan Control?

    So I was looking into running Boinc (donating CPU time to run science projects aka grid computing) on my computer and installed Fan Control so I turn up my fans to keep to comp cooler. I have hence been convinced that it isn't the best idea to run yo

  • Funds Commitment Batch-Input running in Job

    Hi Folks, I'm having some trouble with a batch-input running in job for transaction FMZ1. When I run the batch-input in a dialog process (no job) it works perfectly, however when I execute this same program in a Job the job doesn't finishes, and when