List of various line panels in a JPanel

Hi,
I'd like to code a panel which can contain various amounts of other panels which can be considered as "line elements". They consist of a JLable and JTextfield and are all of the same height.
I'd like the main panel at a specified fixed size so I chosed a BoxLayout and Y-Axis and I've put it into a JScrollpane.
Now real fun starts. When I have only two "line panels" in it, they will be streched to fit the size and when it contains more than the Scrollpane's viewport, the JScrollbars show up only if the panel's size is greater than the viewport. What happens if there are more line elements than the main panel can keep, I don't know.
How can I solve this problem having a list of various line elements which keep their size and JScrollbars which show up if necessary? If there might be a better way to do that, please tell me!!!
I wrote this demo-version (2 classes):
The main class with frame and main panel:
package gui;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
public class PanOptions extends javax.swing.JPanel{
     private static final long serialVersionUID = 5833715021796955215L;
     private PanLine panLine1;
     private PanLine panLine2;
     private PanLine panLine7;
     private PanLine panLine6;
     private PanLine panLine5;
     private PanLine panLine4;
     private PanLine panLine3;
     private JScrollPane scrollPane;
     private JPanel panel;
     * Auto-generated main method to display this
     * JPanel inside a new JFrame.
     public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.getContentPane().add(new PanOptions());
          frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
          frame.pack();
          frame.setVisible(true);
      * ctor.
     public PanOptions(){
          initGUI();
     private void initGUI() {
          panel = new JPanel();
          try {
                    this.setPreferredSize(new java.awt.Dimension(623, 140));
               BoxLayout thisLayout = new BoxLayout( panel, javax.swing.BoxLayout.Y_AXIS);
               panel.setLayout(thisLayout);
                    scrollPane = new JScrollPane();
                    this.add(scrollPane);
                    scrollPane.setViewportView( panel);
                         panLine1 = new PanLine();
                         panel.add(panLine1);
                         panLine2 = new PanLine();
                         panel.add(panLine2);
//                    /* if the following part is commented the other two panels will be stretched?!
                         panLine3 = new PanLine();
                         panel.add(panLine3);
                         panLine4 = new PanLine();
                         panel.add(panLine4);
                         panLine5 = new PanLine();
                         panel.add(panLine5);
                         panLine6 = new PanLine();
                         panel.add(panLine6);
                         panLine7 = new PanLine();
                         panel.add(panLine7);
                    scrollPane.setSize(613, 140);
                    scrollPane.setPreferredSize(new java.awt.Dimension(613, 140));
          } catch (Exception e) {
               e.printStackTrace();
}The line element class:
package gui;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class PanLine extends javax.swing.JPanel {
     private static final long serialVersionUID = 4932310577246348201L;
     private JLabel label;
     private JTextField tf;
      * Ctor
     public PanLine() {
          super();
          initGUI();
      * Inits GUI.
     private void initGUI() {
          try {
               GridBagLayout thisLayout = new GridBagLayout();
               thisLayout.rowWeights = new double[] {0.0,0.1};
               thisLayout.rowHeights = new int[] {7,20};
               thisLayout.columnWeights = new double[] {0.0,0.0,0.0,0.0,0.0};
               thisLayout.columnWidths = new int[] {7,370,7,206,7};
               this.setLayout(thisLayout);
               this.setPreferredSize(new java.awt.Dimension(600, 27));
                    label = new JLabel();
                    this.add(label, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                    label.setText( "blablalba");
                    tf = new JTextField();
                    this.add(tf, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                    tf.setText( "blablalba");
          } catch (Exception e) {
               e.printStackTrace();
}

Hi,
I read thru the tuto and tried several things. I still have issues with the BoxLayout. For some strange reason glueing the excess space with Box.createVerticalGlue() doesn't work (at least I couldn't get it to work). So far I fixed the layout setting a maximum size for the line elements.
To tell you the truth I don't really like this solution somehow - why does the glue not work in MY application? It seemed to be so easy in the tutorial and I can remember BoxLayout always having been nice to me?!
This is just the modified main class, the elements are the same.. I'd like to get rid of having to set a max size for the element panels.
package gui;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
public class PanOptions01 extends javax.swing.JPanel{
     private static final long serialVersionUID = 5833715021796955215L;
     private PanLine panLine1;
     private PanLine panLine2;
     private PanLine panLine7;
     private PanLine panLine6;
     private PanLine panLine5;
     private PanLine panLine4;
     private PanLine panLine3;
     private JScrollPane scrollPane;
     private JPanel panel;
     * Auto-generated main method to display this
     * JPanel inside a new JFrame.
     public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.getContentPane().add(new PanOptions01());
          frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
          frame.pack();
          frame.setVisible(true);
      * ctor.
     public PanOptions01(){
          initGUI();
     private void initGUI() {
          panel = new JPanel();
          try {
                    this.setPreferredSize(new java.awt.Dimension(623, 140));
               BoxLayout thisLayout = new BoxLayout( panel, javax.swing.BoxLayout.Y_AXIS);
               panel.setLayout(thisLayout);
                         panLine1 = new PanLine();
                         panel.add(panLine1);
// it's only possible with lines like this:
                         panLine1.setMaximumSize(new java.awt.Dimension(610, 27));
                         panLine2 = new PanLine();
                         panel.add(panLine2);
// it's only possible with lines like this:
                         panLine2.setMaximumSize(new java.awt.Dimension(610, 27));
                    /* if the following part is commented the other two panels will be stretched?!
                         panLine3 = new PanLine();
                         panel.add(panLine3);
                         panLine4 = new PanLine();
                         panel.add(panLine4);
                         panLine5 = new PanLine();
                         panel.add(panLine5);
                         panLine6 = new PanLine();
                         panel.add(panLine6);
                         panLine7 = new PanLine();
                         panel.add(panLine7);
// this has rather no effect - why???
                    panel.add( Box.createVerticalGlue());
                    scrollPane = new JScrollPane();
                    this.add(scrollPane);
                    scrollPane.setSize(613, 140);
                    scrollPane.setPreferredSize(new java.awt.Dimension(613, 140));
                    scrollPane.setViewportView( panel);
                    panel.setPreferredSize(new java.awt.Dimension(610, 150));
          } catch (Exception e) {
               e.printStackTrace();
}

Similar Messages

  • How do I get rid of various lines around text boxes when using navigation panes

    How can I get rid of these various lines that are displaying sporatically around different text boxes . . . but only when the navigation panel is displaying?  I previously had the issue and changed the text box properties to no fill.  It fixed the problem in the document with no navigation panel, but once the navigation panel is displayed the lines appear.  And yes, I fixed the text box properties before creating the bookmarks for the navigation panel.

    Every device, browser and browser version has its idiosyncrasies.
    Just using a stroke and a drop shadow should not have been enough to require Muse to convert the page fill to an image. Were/are there also other effects on the page? Are the page corners slightly rounded?
    Bevel and Inner Glow definitely require an image to be created. Most other effects/properties do not.

  • Bulleted List within a Grid Panel

    Hi,
    I'm trying to format an HTML page, using the Grid Panel component to arrange various text and images.
    In one of the text sections I need a bulledted list, but can't seem to find a way to do that, within the Grid Panel.
    I need this page to be a JSP page, as it is going to be dynamic.
    All help/advice would be appreciated.
    Regards
    Haroon

    Hi Haroon,
    Please go through the below jsp code to get a bulleted list in a grid panel
    <h:panelGrid binding="#{Page1.gridPanel1}" id="gridPanel1" style="left: 48px; top: 48px; position: absolute">
                            <ul>
                                <li>One</li>
                                <li>Two</li>
                                <li>Three</li>
                            </ul>
                        </h:panelGrid>Hope this helps
    Cheers
    Giri

  • S_ALR_87012103 - List of Vendor Line Items

    Hi,
    Can any one help me on how we can populate following fields in this report:
    - Purchasing Document Number
    - Invoice Reference
    Please note that above fields are available in FBL1N, but they are not available in Report S_ALR_87012103 (- List of Vendor Line Items).I can not depend on FBL1N as it is not executed when number of vendor / selction period is large, whereas this report runs fast.
    Regards,
    AK

    hi,
    please u r create a report in related to vendor account.
    and add field ur required ....
    e.g _y-vledger etc.
    step 2; if any required any field so u r add the fbl1n report ur requirement.....
    rohit

  • S_ALR_87012197 - List of Customer Line Items

    Hello!
    There is in 4.6C report 'S_ALR_87012197 - List of Customer Line Items' selection field called 'Search help ID'. In that field's dropdown list, there is a selection option 'Customers by bank account number' available. This same selection option is not any more available in SAP ECC 6.0 corresponding report whether they use same program RFDEPL00.
    Do anyone know from where that selection option could be enabled also in SAP ECC 6.0? Bank account number is to be taken from view M_DEBI2 to report S_ALR_87012197 in 4.6C, but that view is not active as default in 6.0.

    Here's how we resolved this.
    1. Create the view ZZM_DEBI2  in ED1 .. In old release M_DEBI2 was available.
    2. Create the elementary search help ZDEBI2.. SE11
    3. Add to the search help DEBI
    SE63 to translate to necessary languages.

  • A List of Customer Line Items according to the *CONTACT PERSON*

    Hi All,
    I'm looking for a report which shows the  List of Customer Line Items according to the CONTACT PERSON data, that I can find in the customer master data.
    Thanks for your help

    Not sure if you can add this field to the selection criteria. Please look at OSS notes 188663, 310886. I remember there were some restrictions as only fields from certain tables are allowed to use in FBL1N, FBL3N and FBL5N transactions.
    Shail

  • List of Customer Line Items through F.21

    Hi,
    I am trying to generate a list of customer line items through F.21 and I am using ECC6. I noticed that other tick boxes (line items required, subtotal, total by currency, total per business area, etc) for output control that we used to have in 4.7 are missing. We are need these tick boxes. Is there any way that we can bring back those options in the selection screen? Please advice.
    Thank you!

    Hi,
    The tick boxes (line items required, subtotal, total by currency, total per business area, etc) are taken away in F.21 selection screen of ECC. These functions/details are provided in report output of ECC. In ECC, there are several new Icons  viz. sort by ascending/descending order, Filter, Layout create/change, etc. are provided. These Icons were not there in 4.7.
    You can create a required layout (total per business area, total by currency, etc.) through "Filter", etc. in ECC. This layout you can enter in selection screen of F.21 so the report output will be displayed for this layout.
    So you do not require those check boxes in selection screen of ECC.
    Rg,
    ADI

  • Illustrator CS6 is not listed in the Programs panel.

    Hi, my Illustrator CS6 is not listed in the Programs panel in the Extensions Manager. How do I restore it?
    A bit of history:
    I had been using ScriptBay with Illustrator CS6 before, without problems. After my someone came and resolve some of my computer's network permissions issues, I discovered that ScriptBay panel has stopped working normally.
    However, the script still works fine in Indesign CS6
    I tried deleting some preferences, but scriptBay refused to work in Illustrator. Then, I copied a colleague's Illustrator CS6 to test on my machine (without deleting my copy). And now, my extension manager does not list Illustrator ib the panels.
    Can anyone help with these 2 issues? I wanted the ScriptBay to work so badly!!
    Thanks!
    Elle

    Thanks for your sugegstion. Gonna repost this in another forum. I have found the solution to the "missing program": https://forums.adobe.com/message/4622944
    I can't do a clean install; it's not my personal computer. Hopefully I'll get a solution in the AI community!
    Thanks!

  • I want to install PSE 13, but want to uninstall PSE 12 first. It is not listed in the control panel. I have windows 7. How do I uninstall it?

    How do I uninstall PSE 12? It is not listed in the control panel. I have windows 7. I want to install PSE 13.

    Does the iPod show in My Computer? If so then go to My Computer>iPod>DCMI Folder and copy them from there to where you want them

  • Price List per Document Line

    Hi all,
    Is it possible to select Price list per Document Line, instead of Document?
    Thanks in Advance

    Hi,
    The price list can be selected as per BP and also as per items. In SAP-B1 the prices in the marketing documents are considered from the Price list defined in Business Partner Master data.
    It is not possible to assign a specific price list for particular warehouse.As a work around what you can do is define a price list named Warehouse and maintain the prices of all items.
    When you are creating a marketing document select the particular price list by going to Form settings,Documents tab.The price of the item will be changed automatically
    Regards
    Vikas
    SAP Business One Forums Team
    Edited by: Vikas Rastogi on Feb 10, 2009 4:58 PM

  • TS1398 Ipod touch won't and never did connect. Turned off security to router. Went through troubleshooting list. Circle lines seem as if trying to connect. IP adress is obtained. Never does connect in a usable way??????????????????????????????????????????

    Ipod touch won't and never did connect. Turned off security to router. Went through troubleshooting list. Circle lines seem as if trying to connect. IP adress is obtained. Never does connect in a usable way??????????????????????????????????????????????

    Does the ext directory have the php_oci8.dll? In the original steps the PHP dir is renamed. In the given php.in the extension_dir looks like it has been updated correctly. Since PHP distributes php_oci8.dll by default I reckon there would be a very good chance that the problem was somewhere else. Since this is an old thread I don't think we'll get much value from speculation.
    -- cj

  • How do I uninstall PSE 12. It is not listed in Windows control panel. I have PSE 13

    How do I uninstall PSE 12. It is not listed in the control panel ow Windows 7. I have upgraded to PSE 13, and it IS listed in the control panel.

    Hi,
    If you are not able to uninstall the software in the usual way from Programs and Features, you could try a third party uninstaller such as the application detailed below.
    Download and install the free version of Revo Uninstaller from the link below.
    http://www.revouninstaller.com/download-freeware-v​ersion.php
    Run revo and see if this detects the installation.  If it does, right click on the icon of the program you wish to remove and select Uninstall. During the process you may be asked to delete registry entries, just select all and then click delete. Do the same for any left-over files and folders. Once the uninstall has completed, restart the notebook.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • HT201302 I have Windows 7, but Hardware and Sound is not listed in my Control Panel. So, how do I transfer videos from my ipad to my computer?

    I am trying to transfer videos that I've recorded with my ipod camera to my computer. The option to auto play does not pop up when I plug in my ipod, so I looked up how to do this manually. Apple support websites told me to go to Control Panel and then Hardware and Sound, but Hardware and Sound is not listed in my control panel options. What other options do I have? I own a Dell laptop and I have Windows 7.

    Does the iPod show in My Computer? If so then go to My Computer>iPod>DCMI Folder and copy them from there to where you want them

  • Price Comparison List in various currencies

    Dear SAP Experts,
    My client wants to be able to generate the price comparison list in various currencies(that is the currency the quotation was maintained in. Note that different vendors will have quoted me in different currencies), pls advise, how can this be achieved?

    hi
    while coping the co code we will give INR so we can not get other currency

  • Why doesn't iPod touch save articles in the Reading list for off line reading?

    Why doesn't iPod touch save articles in the Reading list for off line reading?

    Because Apple did not set it up that way. Email the list to you. The Users Guide says:
    View an article in Reader: Tap the Reader button, if it appears in the address field.
    Adjust the font size: Tap .
    Share the article: Tap .
    Note: When you email an article from Reader, the full text of the article is sent, in addition to the link.

Maybe you are looking for

  • Null Value in PI 7.1

    Hi I am working on Proxy to SOAP Scenario, I receive null value at the first instance when I display the Queue, and values after the null,  and the values are coming from the different nodes, and mapping needs to be done at the different level too. E

  • [Flex 4] Application not including Spark Components

    I'm building a module-based application where a main application SWF loads several Module SWFs to serve in the app. I have noticed a strange problem in loading the Modules. If I don't have a certain component (for example: spark.components.Panel) man

  • BW-BPS quetions in "C_TBW45_70" certificaiton

    Hi- How many questions I can expect from BW-BPS (TBw45.pdf) in "C_TBW45_70" certificaion exam? I am looking for a approximate number. The syllabus (waitage) section in the webpage, includes it in one the topics in 60% section, but no specific % for B

  • Page not displayed correctly

    Hi, I have a Billion router 7404vnox, with Firefox V3 the management screen displayed correctly, but with V4 when I navigate to the advanced config the screen appears to split into 2 panes, with the left one compressed with a scroll bar. I have delet

  • Why i can't reset my iphone 4s?

    hi everyone,      why can't i reset my iphone 4s back to factory setting? thanks guys