Resizing variable size panel with JScrollPane

I have a JPanel which contains four radio buttons. Selecting each of them opens another panel which are of different sizes.
These panels open in the same parent panel below the radio button panel.
However these panels contain large no of components. i.e. the final size of the main panel varies depeding on which button is selected.
I am using a JScrollPane to view them properly.
However, I am facing problem while resizing the main panel. If I mention the preferred size of the JScrollPane, the main panel on maximizing, shows this scrollpane with the size mentioned and does not get maximized as the parent panel.
If I don't mention the scrollpane size, resizing the main panel don't show the scrollbars.
what is the correct way to implement a JScrollpane in this case?
Also can anyone tell me what is the exact deifference between setSize() and setPreferredSize()?

i think you are looking for this if i got it right.
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JToggleButton;
import javax.swing.WindowConstants;
public class TestVariablePanelSize extends javax.swing.JPanel
    private JPanel buttonPanel;
    private JRadioButton jRadioButton3;
    private JRadioButton jRadioButton4;
    private JLabel jLabel3;
    private JPanel displayPanel2;
    private JLabel jLabel2;
    private JLabel jLabel1;
    private JPanel jPanel1;
    private ButtonGroup buttonGroup1;
    private JScrollPane jScrollPane1;
    private JToggleButton jToggleButton1;
    private JComboBox jComboBox1;
    private JPanel topPanel;
    private JPanel displayPanel;
    private JPanel parentPanel;
    private JRadioButton jRadioButton2;
    private JRadioButton jRadioButton1;
    JFrame container;
    public static void main(String[] args)
        JFrame frame = new JFrame();
        frame.getContentPane().add(new TestVariablePanelSize(frame));
        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    public TestVariablePanelSize(JFrame frame)
        super();
        container = frame;
        initGUI();
    private void initGUI()
        try
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            System.out.println("screenSize" + screenSize);
            container.setMaximumSize(screenSize);
            final ErrorReportImportPanel errorReportPanel = new ErrorReportImportPanel();
            BorderLayout thisLayout = new BorderLayout();
            container.setLayout(thisLayout);
            container.setPreferredSize(new java.awt.Dimension(655, 365));
            container.setFocusable(false);
            // START >> jScrollPane1
            // START >>
            buttonGroup1 = new ButtonGroup();
            // END << buttonGroup1
            jScrollPane1 = new JScrollPane();
            container.add(jScrollPane1, BorderLayout.NORTH);
            jScrollPane1.setPreferredSize(new java.awt.Dimension(602, 285));
            // START >> parentPanel
            parentPanel = new JPanel();
            jScrollPane1.setViewportView(parentPanel);
            GridBagLayout parentPanelLayout = new GridBagLayout();
            parentPanelLayout.columnWeights = new double[]{0.1};
            parentPanelLayout.columnWidths = new int[]{7};
            parentPanelLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0};
            parentPanelLayout.rowHeights = new int[]{33, 23, 186, 26};
            parentPanel.setLayout(parentPanelLayout);
            // parentPanel.setPreferredSize(new java.awt.Dimension(652, 371));
            // START >> topPanel
            topPanel = new JPanel();
            parentPanel.add(topPanel, new GridBagConstraints(
                0,
                0,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.NORTH,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0));
            // START >> jComboBox1
            ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[]{"Item One", "Item Two"});
            jComboBox1 = new JComboBox();
            topPanel.add(jComboBox1);
            jComboBox1.setModel(jComboBox1Model);
            jComboBox1.setPreferredSize(new java.awt.Dimension(75, 20));
            // END << jComboBox1
            // END << topPanel
            // START >> buttonPanel
            buttonPanel = new JPanel();
            parentPanel.add(buttonPanel, new GridBagConstraints(
                0,
                1,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.NORTH,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0));
            // START >> jRadioButton1
            jRadioButton1 = new JRadioButton();
            buttonPanel.add(jRadioButton1);
            jRadioButton1.setText("jRadioButton1");
            jRadioButton1.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent evt)
                    displayPanel.setVisible(true);
                    // displayPanel2.setVisible(false);
                    // parentPanel.remove(displayPanel2);
            // END << jRadioButton1
            // START >> jRadioButton2
            jRadioButton2 = new JRadioButton();
            buttonPanel.add(jRadioButton2);
            jRadioButton2.setText("jRadioButton2");
            jRadioButton2.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent evt)
                    displayPanel2.setVisible(true);
                    displayPanel.setVisible(false);
                    parentPanel.remove(displayPanel2);
            // END << jRadioButton2
            // START >> jRadioButton3
            jRadioButton3 = new JRadioButton();
            buttonPanel.add(jRadioButton3);
            jRadioButton3.setText("jRadioButton3");
            // END << jRadioButton3
            // START >> jRadioButton4
            jRadioButton4 = new JRadioButton();
            buttonPanel.add(jRadioButton4);
            jRadioButton4.setText("jRadioButton4");
            // END << jRadioButton4
            // END << buttonPanel
            buttonGroup1.add(jRadioButton1);
            buttonGroup1.add(jRadioButton2);
            buttonGroup1.add(jRadioButton3);
            buttonGroup1.add(jRadioButton4);
            // START >> displayPanel
            displayPanel = new JPanel();
            parentPanel.add(displayPanel, new GridBagConstraints(
                0,
                2,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.NORTH,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0));
            displayPanel.setVisible(false);
            // START >> jLabel2
            jLabel2 = new JLabel();
            displayPanel.add(jLabel2);
            jLabel2.setText("displayPanel");
            jLabel2.setPreferredSize(new java.awt.Dimension(462, 152));
            jLabel2.setOpaque(true);
            jLabel2.setBackground(new java.awt.Color(128, 128, 255));
            jLabel2.setVisible(false);
            // END << jLabel2
            // END << displayPanel
            // START >> displayPanel2
            displayPanel2 = new JPanel();
            parentPanel.add(displayPanel2, new GridBagConstraints(
                0,
                2,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0));
            displayPanel2.setVisible(false);
            // START >> jLabel3
            jLabel3 = new JLabel();
            displayPanel2.add(jLabel3);
            jLabel3.setText("displayPanel2");
            jLabel3.setOpaque(true);
            jLabel3.setBackground(new java.awt.Color(0, 128, 192));
            jLabel3.setPreferredSize(new java.awt.Dimension(460, 171));
            // END << jLabel3
            // END << displayPanel2
            // START >> jToggleButton1
            jToggleButton1 = new JToggleButton();
            parentPanel.add(jToggleButton1, new GridBagConstraints(
                0,
                3,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.WEST,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0));
            jToggleButton1.setText("jToggleButton1");
            // END << jToggleButton1
            // START >> jPanel1
            jPanel1 = new JPanel();
            parentPanel.add(jPanel1, new GridBagConstraints(
                0,
                4,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.CENTER,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0));
            // START >> jLabel1
            jLabel1 = new JLabel();
            jPanel1.add(jLabel1);
            jLabel1.setText("Another Panel");
            jLabel1.setPreferredSize(new java.awt.Dimension(469, 87));
            jLabel1.setBackground(new java.awt.Color(0, 128, 0));
            jLabel1.setForeground(new java.awt.Color(0, 0, 0));
            jLabel1.setOpaque(true);
            // END << jLabel1
            // END << jPanel1
            // END << parentPanel
            // END << jScrollPane1
        catch (Exception e)
            e.printStackTrace();
}

Similar Messages

  • Variable size item with scrap

    we are using sheet size 600 * 1280 mm weight of above sheet = 259gms we get effective out put from the above sheet = 177 grms.Balance 82 grms is considered as scrap
    How to account receipt of material in BOM???
    Please advice
    regards
    PP

    Maintain a BOM
    Effective material - Base quantity as177 gms
    Requires
    sheet- 259 gms
    scrap- 82- gms
    create a scrap as material & Mainatin a scrap , -ve quantity in BOM
    While goods movement, Scrap get receipt via movement type 531
    Regards.
    Sundaresan
    Hi in previous reply, I wrongly posted with my friend Id.
    Edited by: Sundaresan . E. V on Sep 30, 2010 12:24 PM

  • Reqmt qty of variable size item in purchase requisition

    Hello All
    I am having a FG "A" & components "B" & "C" out of these two components "B" is variable size item with Base UOM as M, I have given two sizes of "B" as 3M & 2M in the BOM., i.e. material "B" is added two times as a component with variable size item.
    For 1SQM of A"  require 3M & 2M of "B" & 1KG of "C". When am having a reqmt of 10SQM of "A" the sys calculates the dependent reqmt correctly as 30M, 20M of "B" & 10KG of "C", but the purchase requisition of "B" is coming as of 50M.
    My problem here is that how the user would come to know how many qty of "B" is reqd of 3M &  2M length.
    Please throw some light on this behavior of the system. Looking forward to your valuable inputs & guidance.
    Regards,
    J K Tharwani

    jitendra,
    as i post in my earlier reply ,
    there is one work around which will work for you is that , use lead time offset ( with positive + or negative quantity of day ) in component detail screen for one of the position of B in the BOM so in that case you will have 2 different purchase requisition for B.
    Check it out and revert back , i am sure it will work for you.
    Only problem is the date will be delayed by one day or prepone by one day for the second position where B is assigned.
    other wise there for getting this information in PO , you need to go for Z development.
    for it you need to keep a check on specific plant , what are the purchase requisition that have material which are being used as variabble size item category in BOM and for this material you need to Pull values from Variable size field of Item, details screen.
    ROM1 and ROM2 and publish it in text of PR and PO.
    Check and revert back.
    Regards
    Ritesh

  • Start with all Accordion panels closed with variable height panels

    I inserted a Spry Accordion on this page: http://www.brucebarrdesign.com/video_new.htm
    I want the panels to open to a size depending upon the content within them so I set the height to auto. The problem is that when you go to the page, the first panel is open. I want all of the panels to be closed when you first go to the page. Per the Help docs and some posts I've seen in the forum, I tried inserting this code:
    <script type="text/javascript">
    var acc1 = new Spry.Widget.Accordion("Acc1", { useFixedPanelHeights: false, defaultPanel: -1 });
    </script>
    However, this only works with fixed height panels. If I use it with the variable height, it opens all of them, so I commented it out for now. How can I get this to work?
    Thanks

    GPDMTR25 wrote:
    I located the answer to my own question (how to get all the accordion panels to remain closed when the browser opens) but I still don't understand the answer. Can someone explain this?
    This feature is only supported when using variable height panels, so you must pass a false into the Accordion's constructor for the "useFixedPanelHeights" constructor options, and a -1 for the "defaultPanel" option:
    <script type="test/javascript">
    var acc1 = new Spry.Widget.Accordion ("Acc1", { useFixPanelHeights: false, defaultPanel: -1});
    </script>
    Angela
    Hi Angela,
    You are right, the only way it will work is by setting the fixed height to false. As for the for the default panel option, -1 is not a panel and if you had 3 panels we could have used the number 3 (panel1 = 0) or 99 or whatever as long as there is no panel with that number. If we had used the number 1 for instance, then the 2nd panel would be opened by default.
    Hope this helps.
    Ben

  • JScrollPane size problems with horizontal bar

    Hello,
    I have made a panel with some lines of text (JLabels). The panel is contained inside a JScrollPane. When it gets a horizontal scrollbar, the bar hides the bottom-most line of text and you get a vertical scrollbar too.
    How do I get the JScrollPane to add the height of the horizontal scrollbar to its own height if it still fits inside its own maximum height? It is ridiculous when you have like 3 lines of text inside it and you have to scroll it to see the bottom line.
    Thanks,

    Thanks, that solved the problem good enuff for me here. Now I also got another similar problem, at http://forum.java.sun.com/thread.jsp?forum=57&thread=206828. Got any ideas on that :) ?

  • BOM creation with variable size item

    Dear Experts,
    I want to create BOM with 'R'-Variable size item, Can U tell me exact procedure step by step to How to create BOM with R- Variable size item?
    Regards,
    Shivkumar Dachawar

    Hi,
      T-Code-CS01
    1. Enter the material for which you want to create BOM, Plan and BOM usage.
    2. Select the item category "R", enter the component. Now you will be taken to the "Variable item data" screen.
    3. Enter the datas of Size 1, 2 & 3 (as required) and the unit of the size & number. System will calculate the "Qty of var- size item" in the unit assigned to the basic data of the material master of the component.
    4. Save
    Note: You can change the unit of the variable size item as per your requirement in OS28
    Hope this helps.
    -Thaila Shree

  • Tabbed panel with adjustable/variable height based on content

    Is there anyway that you can create a tabbed panel with adjustable/variable height based on content in each tab?

    Abhishek,
    Thanks for your reply, however, it is not working with Muse. I added the Javascript to the head section and adjusted iframe and it displays as a small square in the upper left hand corner, unable to view the whole page.
    Inserted into head section --
    <script type="text/javascript">
       function resizeIframe(obj)
      obj.style.height = 0;
      obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
       </script>
    inserted as an html object --
    <iframe name="MycoSmooth" src="http://www.mycosmooth.com" frameborder="0" scrolling="no" id="iframe" onload='javascript:resizeIframe(this);' />
    Below is the result:
    The purpose is to have an independent website run the blogging capabilities, since muse doesn't directly support blogging as of yet.
    Since the site is on a different domain, I am running into cross domain issues and it won't get the height of the page. The methods that apparently work use php and I am unsure how that would work in muse, if at all.

  • Same object size (front panel) with different screen resolution

    Hi everybody,
    I realised an application, and I try to instal it on various computer. The probleme is that they haven't the same screen resolution, so the front panel is not the same on each computer. It is possible to build an application which have the same front panel with different screen resolution ?
    Kriss.

    Hi Krisss,
    switch off any "adapt to screen resolution" switches in the VI properties...
    You should also define "same front panel" and "same object size"! Do you mean the same pixel size or size in mm or size in percent of screen?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Automatic Resizing of panel with drawings added to a scrollPane

    I have a Panel with rectangles text and arcs drawn .and it is added to a scrollPane.both vertical and Horizontal scrollbars are enabled for scrollPane.My problem is that i have to draw arcs connecting these rectangles with text enclosed in it. and when i connect two rectangles a span is formed connecting the two..and as hierarchy goes deeper ie connecting spans of already linked rectangles with similar spans..There wont be enough space at top for arc to be drawn..So ive to either readjust all objects related with drawings in panel or is there any other way to increase panel size automatically as drawings need more space..Please suggest me some method for this problem

    Panels Preffered size is set as (3000,1000) and TextRectangles are drawn in panel Cordinates of textRectangle are set in setTextRectangle method and all further drawings connecting rectangle are done by mouse clicks on specific rectangles.
    and layout in setTextRectangle is TextLayout of the text enclosed in rectangles.So when i coordinates for arc drawn exceeds the panel should i call separate method for resetting panel size is that what you have suggested
       screen_Resolution = Toolkit.getDefaultToolkit().
                               getScreenResolution();
             screen_Width = Toolkit.getDefaultToolkit().
                               getScreenSize().width;
             screen_Height = Toolkit.getDefaultToolkit().
                              getScreenSize().height;
    public void setTextRectangle(Graphics g, Font font)
              Graphics2D g2 = (Graphics2D) g;
             FontMetrics metrics= g.getFontMetrics (font);
            int textHeight = metrics.getHeight();
            int left=textHeight;
            int yCordRectangle=(int)(screen_Height/5);
            for (int i = 0; i < layouts.size (); i++) {
                 int top=(int)(screen_Resolution*2);
                 for (int j = 0; j < layouts.get (i).size (); j++) {
                     top += textHeight;
        TextRectangle textRectangle=new TextRectangle(left,yCordRectangle,wrapWidth,top-150);
         addtoarray( textRectangle, rectangles);
        left += wrapWidth + textHeight;
       

  • Displaying custom drawn panels in a panel with FlowLayout vs GridLayout

    I am having trouble to display my custom panels(on which I have drawn) in another panel with FlowLayout. When I use this layout only a small part of their top-left corner appears, when using the GridLayout they are displayed as should, all. Why is this? Is there any way around it?
    The following is the code:
    package diagramillustrator;
    import java.awt.*;
    import java.util.Vector;
    import javax.swing.*;
    public class ClassDiagram extends JPanel
        //fields
        //<editor-fold>
        //general info
        public String title = "class";
        public String name;
        public Vector interfaces;
        public Vector exceptions;
        public String superclass;
        public Vector subClasses;
        public boolean superClass;
        public boolean subClass;
        public String dPackage;
        public String dExtends;
        //variables
        public FieldStructure field;
        //methods
        public MethodStructure constructor;
        public MethodStructure metho;
        //</editor-fold>
        /** Creates a new instance of ClassDiagram */
        public ClassDiagram()
            super();
            super.setSize(132,75);
        protected void paintComponent(Graphics g)
           setBackground(Color.WHITE);
           Graphics2D g2d = (Graphics2D) g;
           super.paintComponent(g2d);
           g2d.setStroke(new BasicStroke(2f));
           g2d.drawRect(1,1,132,25);
           g2d.setFont(new Font("arial", Font.BOLD, 12));
           g2d.drawString(title, 4,18);
           g2d.setColor(Color.LIGHT_GRAY);
           g2d.fillRect(1,25,132,25);
           g2d.setColor(Color.BLACK);
           g2d.drawRect(1,25,132,25);
           g2d.setColor(Color.WHITE);
           g2d.fillRect(1,51,132,25);
           g2d.setColor(Color.BLACK);
           g2d.drawRect(1,50,132,25);
        public static void main(String[] args)
            JFrame f = new JFrame("Testing ClassDiagram");
            f.setSize(500,400);
            //layout shows it correctly
            JPanel panel1 = new JPanel(new GridLayout());
            //layout shows it incorrectly
            //JPanel panel1 = new JPanel(new FlowLayout());
            panel1.setSize(200,200);
            ClassDiagram c1 = new ClassDiagram();
            ClassDiagram c2 = new ClassDiagram();
            ClassDiagram c3 = new ClassDiagram();
            panel1.add(c1);
            panel1.add(c2);
            panel1.add(c3);
            f.add(panel1);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.show();
    }Here is the main method included in the class(the main method is used for testing here) where the adding etc is done.
    public static void main(String[] args)
            JFrame f = new JFrame("Testing ClassDiagram");
            f.setSize(500,400);
            //layout shows it correctly
            JPanel panel1 = new JPanel(new GridLayout());
            //layout shows it incorrectly
            //JPanel panel1 = new JPanel(new FlowLayout());
            panel1.setSize(200,200);
            ClassDiagram c1 = new ClassDiagram();
            ClassDiagram c2 = new ClassDiagram();
            ClassDiagram c3 = new ClassDiagram();
            panel1.add(c1);
            panel1.add(c2);
            panel1.add(c3);
            f.add(panel1);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.show();
        }Please help.
    Thanks,
    AndXer

    Layout managers.
    JPanel panel1 = new JPanel(new GridLayout());GridLayout divides the availabale space into equal cells and expands each child component to fill the cell.
    JPanel panel1 = new JPanel(new FlowLayout());FlowLayout attempts to show each child component at its preferred size. The preferredSize is determined by the layout manager in the process of laying out the children. For a graphic component, ie, a component with no child components, the request for the components preferredSize will return the default size which is 10,10 for JPanel. Therefore you will need to either set the preferredSize for the gtaphic component or override the getPreferredSize method and return the desired Dimension. Another limitation of FlowLayout is that it attempts to lay its children out in&#8211;line.
    GridBagLayout also respects the preferredSize of child components and offers more versatility.
    import java.awt.*;
    import javax.swing.*;
    public class CD extends JPanel
        public String title = "class";
        public CD()
            super();
            setPreferredSize(new Dimension(132,75));
            setBackground(Color.WHITE);
        protected void paintComponent(Graphics g)
            Graphics2D g2d = (Graphics2D) g;
            super.paintComponent(g2d);
            g2d.setStroke(new BasicStroke(2f));
            g2d.drawRect(1,1,130,25);
            g2d.setFont(new Font("arial", Font.BOLD, 12));
            g2d.drawString(title, 4,18);
            g2d.setColor(Color.LIGHT_GRAY);
            g2d.fillRect(1,25,130,25);
            g2d.setColor(Color.BLACK);
            g2d.drawRect(1,25,130,25);
            g2d.setColor(Color.WHITE);
            g2d.fillRect(1,51,130,25);
            g2d.setColor(Color.BLACK);
            g2d.drawRect(1,50,130,25);
        public static void main(String[] args)
            JPanel panel1 = new JPanel(new GridBagLayout());
            // This has little affect until after realization and
            // is then subject to its parent layout manager. Use
            // the preferredSize for better results.
            //panel1.setSize(200,200);
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(5,5,5,5);
            gbc.weightx = 1.0;
            gbc.weighty = 1.0;
            // Add some components
            int n = 5;
            // and specify columns
            int cols = 3;
            for(int j = 0; j < n; j++) {
                gbc.gridwidth = ((j+1) % cols == 0) ? GridBagConstraints.REMAINDER
                                                    : 1;
                panel1.add(new CD(), gbc);
            JFrame f = new JFrame("Testing ClassDiagram");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(panel1);
            f.setSize(500,400);
            f.setLocation(200,200);
            f.setVisible(true);
    }

  • How to add Panel in JScrollPane? URGENT!

    I need to add a Panel in JScrollPane
    I have try to add JPanel into JScrollPane, but apparently, the JPanel did not show up at all in the JScrollPane (all i see is the border of JScrollPane)
    Then I switch my JPanel to Panel (awt) and it does appear on the JScrollPane, but scrollbars are not visible even i have set the size of the panel is larger than the JScrollPane. (and i also set the VERTICAL_SCROLLBARS_ALWAYS) I can scroll with my mousewhieel, but the panel can scroll out of place(ie outside of the Jscrollpane)
    Can someone teach me how to add a Panel or JPanel to a JScrollPane Please~ Thanks!!!

    here is an example that illustrate my problem:
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.filechooser.*;
    public class testing extends JFrame
         public testing()
              Container pane=getContentPane();
              pane.setLayout(null);
              setSize(600,600);
              JPanel backgroundpanel= new JPanel();
              backgroundpanel.setLayout(null);
              backgroundpanel.setSize(500,500);
              backgroundpanel.setLocation(0,0);
              Panel insidepanel = new Panel();
              insidepanel.setLayout(null);
              insidepanel.setSize(300,300);
              insidepanel.setLocation(0,0);
              JLabel something= new JLabel("something");
              JTextField someTF= new JTextField(10);
              something.setSize(100,20);
              something.setLocation (20,20);
              someTF.setSize(100,20);
              someTF.setLocation(50,60);
              insidepanel.add(something);
              insidepanel.add(someTF);
              JScrollPane scrollpane= new JScrollPane(insidepanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
              scrollpane.setSize(200,200);
              scrollpane.setLocation(10,10);
              backgroundpanel.add(scrollpane);
              pane.add(backgroundpanel);
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         public static void main(String args[]) throws FileNotFoundException, IOException
                        testing test=new testing();
    apparently, the panel i add in teh scrollpane is on the top layer instead of inside the scroll... can anyone help?

  • JTable Blank Rows When INSERT/DELETE in other panel with same ViewObject

    Hi,
    Jdev 10.1.2
    JClient
    2 panels based on same ViewObject in same AM
    One panel with Grid UI => JTable
    Other panel with Form UI
    When I insert or delete a record in the panel with Form UI and return to the panel with JTable blank rows are displayed.
    The problem remains even after commiting before returning to JTable panel.
    When I activate the execute button in the JTable panel, the display is OK but the currency is lost.
    I suppose calling the refresh method when returning to the JTable panel should solve the problem.
    Can you please suggest me a server-side/model workaround:
    refresh (which option to use ??)
    Thanks
    Frederic
    PS I tried the workaround of thread 10.1.2 JClient binding Error. but that doesn't help.

    Same problem with default wizard generated Master-Detail Form.
    When in the detail more then 10 rows exist, the scrollbar shows that not all rows are displayed.
    If I use the scrollbar to view the last rows they are blank, in order to display them I must activate the next button one time for each additional row.
    The workaround is to enter -1 in the range size of the iterator.
    But what if the range size is 10.
    Is the blank rows display a bug?
    OR
    Must the scrolling area (size of JScrollPane) be defined according to the range size of the iterator?
    If the latter is true:
    Can somebody give me some clues on which attributes of the JScrollPane must be set (PreferredSize, MinimumSize ??) and on how to calculate this area: total width & total height if the row height for the table is set to 20?
    Your help will be appreciated
    Frederic

  • Get search criteria from query panel with table

    hi guys,
    i have a query panel with table that i created from a VO.
    i use the all queryable attribute in the generated DataControl.
    i hv a requirement to update the database value with the same search criteria with the query panel.
    but i want the submitted search criteria, not only written in the query panel criteria.
    i'm using JDEV & BPM 11.1.1.6
    i've already tried to get the criteria using
    QueryModel queryModel = getQueryPanel().getModel(); 
    QueryDescriptor queryDescriptor = queryModel.getSystemQueries().get(0);             
    ConjunctionCriterion cc = queryDescriptor.getConjunctionCriterion();
    for(int i=0;i<cc.getCriterionList().size();i++){
         AttributeCriterion ac = (AttributeCriterion)cc.getCriterionList().get(i);
         System.out.println("DEBUG LABEL : " + ac.getAttribute().getLabel());
         System.out.println("DEBUG VALUE : " + ac.getValues().get(0));    
    }        but it only get the value that filled in the search criteria input text, not the criteria that already been searched and viewed in the table
    my other question is, can i override the search button function ? so i can add a custom method to save the search criteria to my temporary variable.
    thanks
    Edited by: Juw on May 29, 2013 2:05 AM

    Is this https://blogs.oracle.com/jdevotnharvest/entry/how-to_tell_the_viewcriteria_a_user_chose_in_an_afquery_component or http://www.learnoracleadf.com/2013/05/programatic-handle-to-adf-query.html what you are looking for?
    Timo

  • Fixed size panel

    How can I put a fixed size JPanel to the center of an container (f.ex. JFrame) so that if the container is resized the size of the panel doesn't change but its location will be in the center of resized container. And if the container gets smaller than panel there will become scrollbars.

    Have GridBagLayout for the frame.Use setPreferredSize on the Panel.So even if the frame resizes it will still be in the center and size won't change too since GridBagLayout respects component's preferredsizes.For scrolling you need to add the JPanel to a JScrollPane and add the JScrollPane to the Frame.
    Ranga.

  • Variable size item problem in BOM

    hi all,
    We have semi-finished material with componets as variable size items (item cat. R)
    Now in the variable size tem data, Size 1 = 1,406 MM, Size 2 = 1,220 MM. Numner is 1 ST, formaula place is blank.
    Qty Var-Sz Item is calculated by system is 3.957 M2. On what basis this value is calculated?
    In the component material we have maintained a componenet scrap quantity as 15%.
    BOM ratio of header : component = 1NOS : 1 ST
    Again when we create a production order for the header, for 1 NOS header quantity component qty becomes 2.
    For 2 NOS of header qty, component becomes 3 like this.
    Why this happens..
    Regards,
    Srijit.

    Thread closed

Maybe you are looking for

  • How iTunes works managing multiple iPhones and iTunes with same account

    My wife and I each have our own computers using the same iTunes and Amazon account.  I want to know how the download rules work... For apps For music For books I know that Kindle books appear on both.  I know that you can share music between 5 (?) di

  • How can two people on different computers edit the same video

    I am working on a large project and need more than one person editing. How can I allow 2 or more people edit the movie we are working on. I have two windows 7 working on a network in CS6

  • Configuring email to send plain text, not HTML

    When sending a mail message from my Palm Pre, the resulting message was in plaintext. Now I have a Pre 2 with WebOS 2.1, my recipients get HTML-formatted email. I can't find an option to set this back to plaintext - is this possible? Post relates to:

  • Oracle Gateway with WE8ISO8859P15 to sqlserver Unicode

    Hellow, Our database is setup in the WE8ISO8859P15 character set. We have setup-ed a gateway to a ms sqlserver. If I create a query from tables which have a varchar2(4000) column. I receive a connection error of the oracle gateway. This is because sq

  • Prob in reconcillation of challan

    All SAP Gurus, We are having following error while reconciliation of subcontracting challan. Material XXXXXXXX is not assigned fully, short by XX KG Message no.: 8I574 above prob. comes when we split GR  quantity in batches while reconciliation syste