Setting size to JPanels

Hi
A small niggly problem with JPanels but I can not seem to solve it, Can anyone please tell me how to control West Panel size ? I've tried thiswestPanel.setPreferredSize(new Dimension(200, 500)); it only controls the width of it but NOT the length. I want West JPanel to go right down to page so the South JPanel can be side of it and not below.
Thanks
Zed

Caarmel wrote:
It should work.Insufficient detail to come to that conclusion. Apart from which, anything that should work usually does.
I'm guessing too, but BorderLayout isn't designed to provide the layout that the OP evidently wants. The layout it does provide is adequately described and illustrated in the API.
Nesting two containers both having BorderLayout, with the inner container using NORTH, CENTER and SOUTH added to the outer container at CENTER with the remaining parts at EAST and WEST may fit the bill.
db

Similar Messages

  • Set size of jPanel

    Hi i've create a jForm in netbeans. To this I have added a scrollpane containing a jPanel called PrintPreview. (I have to do this rather than use the automated preview of printUtilities because of some items I need removed from the original jPanel before printing).
    I need to set the size of the PrintPreview jPanel as it's instantiated. I have the dimensions created from another class called "Gbl".
    In the constructor is the following:
    /** Creates new form PrintPreview */
    public PrintPreview() {
    PreviewPanel.setPreferredSize(new Dimension(Gbl.previewWidth,Gbl.previewHeight);
    PreviewPanel.setMaximumSize(new Dimension(Gbl.previewWidth,Gbl.previewHeight);
    PreviewPanel.setMinimumSize(new Dimension(Gbl.previewWidth,Gbl.previewHeight);
    Window.pack();
    initComponents();
    this.setLocationRelativeTo(null);
    // ADD CODE - COLLECT DRAWING FROM ARRAY
    PreviewPanel.repaint();
    I would like the jPanel set to these dimensions however I would also like the scrollPane to remain at it's standard size so I can scroll the diagram as necessary.
    Could you please tell me where I am going wrong? The three setSize lines are flagged as erroneous. The dimensions are int and have tried double.
    Any advice is good...
    Thanks

    Ok I'm going to add onto this thread because it still relates to the original problem. setting size of jPanel.
    Some details first:
    OS - Ubuntu Gutsy 7.10
    Kernel - 2.6.22-14-generic
    NB - v5.5.1
    Java version - java version "1.5.0" / gij (GNU libgcj) version 4.2.1 (Ubuntu 4.2.1-5ubuntu5)
    Research:
    I have been trawling the net for days trying to resolve this but I am struggling to find anything specific to my problem. I keep finding general methods using given NB facilities. I've also scoured a couple of my Java books but of course they're not totally relevant to NetBeans. I've practiced using the forum this afternoon to find things but with my lack of knowledge using both forums and java has left me a little bamboozled. I've been working on this problem for a couple of days now and achieved very little.
    My specific problem is this:
    I have a JFrame GUI. Inside that I have a jTabbedPane containing a jScrollPane containing a jPanel. I would like to have the jPanel display at A4 size relevant to the screen it is displayed on. e.g. I have a separate global class "Gbl" that calculates the dimensions based on current dpi and then creates the necessary measurements to feed to my preferred size function.
    I have tried implementing the preferred size method to the constructor and have also tried adding it to all four ways to enter bespoke code to NetBeans' autogenerated code. (Pre-init, Post-init, Pre-creation and Post-creation code) To no avail. Nothing changes on screen.
    The code I am trying to enter is as follows:
    // Set preferred size of user-drawing-area (jPanel1)
    jPanel1.setPreferredSize(new java.awt.Dimension(600,500));
    jPanel1.setMaximumSize(new java.awt.Dimension(600,500));
    jPanel1.setMinimumSize(new java.awt.Dimension(600,500));
    // Set preferred size of jPanel1 container (jScrollPane1)
    jScrollPane1.setPreferredSize(new java.awt.Dimension(600,500));
    jScrollPane1.setMaximumSize(new java.awt.Dimension(600,500));
    jScrollPane1.setMinimumSize(new java.awt.Dimension(600,500));
    // Set preferred size of the jScrollPane1 container (mainTabView(Tabbed pane))
    mainTabView.setPreferredSize(new java.awt.Dimension(600,500));
    mainTabView.setMaximumSize(new java.awt.Dimension(600,500));
    mainTabView.setMinimumSize(new java.awt.Dimension(600,500));
    I am using absolute values here to omit any error getting the variables from my Global class. If it works I will add them and test again.
    Ideally, I would like the jPanel to be set to an A4 size yet have the containers at a smaller more "screen-manageable" size (With scroll bars). Then if the GUI is maximized, then it only expands to the full size of the A4 sized jPanel if possible.
    Of course, this may not be possible or there may be a far better method for doing this, however I am really stumped. I've had some good advice this afternoon of whihc has opened may eyes some. Although, I have made no headway so far. I hope the above follows site-rules and gives enough information to resolve this issue. I'm losing hair rapidly!
    I'm grateful for any advice given. Thank You

  • Setting size for JPanel to fit JTable

    hi!
    Iam stuck with some grey area in JPanel or JScroolPanel with holds JTable, starting to get gray hair by trying to get rid of that
    public class MiniCalTopPane extends JPanel {
         private static final long serialVersionUID = 8490663735555155912L;
         private TableValues tv;
         private JTable table;
         private JLabel lable;
         public MiniCalTopPane() {
              //create pane with border layout
              super(new BorderLayout());
              //create components
              tv = new TableValues();
              table = new TableW(tv);
              lable = new JLabel("2006");
              lable.setSize(table.getWidth(), 25);
              System.out.println(table.getWidth());
              JScrollPane jsp = new JScrollPane(table);
              jsp.setPreferredSize(new Dimension(200,
                        (table.getHeight())));
              this.add(lable, BorderLayout.BEFORE_FIRST_LINE);
              this.add(jsp, BorderLayout.CENTER);
              setPreferredSize(jsp.getPreferredSize());
              setBackground(Color.GREEN);
              this.setOpaque(true);
    }JTable
    public class TableW extends JTable{
         private static final long serialVersionUID = 2480280947312015884L;
         private static final int ROW_HEIGHT             = 20;
        private static final int COL_WIDTH              = 20;
         public TableW(TableModel dm) {
              super(dm);
            this.changeSelection(0,0,false,false);
            this.setAutoCreateColumnsFromModel(true);
    //      initiate row height
            this.setRowHeight(ROW_HEIGHT);
            this.setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
            this.setRowSelectionAllowed(true);
            this.setColumnSelectionAllowed(true);
            //no dragible colums please!
            this.getTableHeader().setReorderingAllowed(false);
            //dont show grid in table
            this.setShowGrid(false);
            tableHeader.setBackground(Color.WHITE);
              TableColumnModel tcm = this.getColumnModel();       
            //add cutom render to
              for (int i = 0; i < this.getColumnCount(); i++) {
                   TableColumn tc = tcm.getColumn(i);
                   tc.setCellRenderer(new SmallCallRender());
         }I don't se whats is the proble, hope you can point me out :P
    and thanx in advance

    Well, the code you posted isn't executable, so we can't tell whats going on based on the code you posted.
    Here is a simple example that sizes the frame based on the tables size:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=627108
    If you want the frame to be bigger than the table then you can always add the table to the NORTH of the BorderLayout and set the color of the panel to whatever you want. Or, if you keep the table in the center then you need to set the background of the JViewport of the JScrollPane.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • How to set an empty JPanel to maximum size?

    Hello!
    I created class extends JFrame.
    I want this maximum size so I set the minimum size as screen size:
    setSize(screenWidth,screenHeight);
    Now I added an empty JPanel,
    and I want it to be the maximum size.
    But the problem is - I don't know what is the maximum of the current size without the frame borders. I mean, after set it to maximum size (I don't know how),
    I could get the width and height of the current size without the frame borders by:
    frame.getContentPane().getSize();
    In conclusion, I want to set an empty JPanel to maximum size and get JFrame size without the frame borders.
    Thanks!

    800512 wrote:
    Now I added an empty JPanel,
    and I want it to be the maximum size.Define "maximum size". You want it to fill the screen or you want it to be the maximum size inside its container (JFrame in this case)?
    You cannot make a component break out of its container, that's for sure. So assuming you want the component to grow to the maximum size inside its container, that should already happen when you add the component to the CENTER position of the JFrame's container. By default it has a BorderLayout.

  • Determine preferred size to be set for the JPanel attached to JScrollBar

    Determine what preferred size to be set for the JPanel attached to JScrollBar.
    Hello all, I am having a JPanel, where new components will be added into it during run-time. When there are too many components inside the JPanel, I need to re-set the JPanel preferred size so that the JScrollBar is scrollable.
    I was wondering what is the good method to determine the preferred size of JPanel during runtime?
    Currently, I am using
    myJPanel.setPreferredSize(new Dimension(
    numberOfNewComponent * preferred width of each component,
    numberOfNewComponent * preferred height of each component
    ));Is there any better alternative?
    Thank you very much.
    yccheok

    Usually a container such as JPanel will calculate its own preferred size from its layout manager - calling setPreferredSize is often unnecessary.
    When you add a component to your JPanel its preferred size will change automatically.
    What's wrong with the behaviour when you simply add your JPanel to a JScrollPane and let it manage its own preferred size?
    Hope this helps.

  • Essbase Error:Set is too large to be processed. Set size exceeds 2^64 tuple

    Hi,
    we are using obiee 11.1.1.6 version with essbase 9.3.3 as a data source . when I try to run a report in obiee, I am getting the below error :
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 96002] Essbase Error: Internal error: Set is too large to be processed. Set size exceeds 2^64 tuples (HY000)
    but if I run the same query in excel add in, I am just getting 20 records . wondering why I am getting this error in obiee . Does any one encountered the same issue ?
    Thanks In advance,

    Well if you want to export in I think you have to manually do it.
    The workaround it to open your aperture library by right clicking it and show contents...
    Then go into your project right click show contents...
    In here there are sub folders on dates that the pictures were added to those projects. If you open the sub folder and search for your pictures name it should be in that main folder.
    You can just copy it out as you would any normal file to any other location.
    Voila you have manually exported out your file.
    There is a very similar post that has been close but again you can't export the original file that you are working on - FYI http://discussions.apple.com/thread.jspa?threadID=2075419

  • How i can set size of editor at runtime?

    dear all,
    How i can set size of editor at runtime?
    The size of editor is good when I run form on windowX but so small on web . why? have any body call tell me how i can do?
    thank for advance

    Hi there,
    You can use the builtin EDIT_TEXTITEM.
    You can pass x-pos, y-pos, width and height as parameters to that.
    Hope this helps

  • Circular and oval cropping at set size and resolution?

    I know how to use the M tool to create circles and ovals and i know you can set that to certain dimensions, but that doesn't do everything I need.
    How do you crop circles and ovals out of a photo, at a set size (for example, a 1 inch circle ) at a set resolution for printing?  What I need to do is crop circular and oval images out of a photo, say at 250 dpi, then paste them onto a blank white page for printing.
    So if I've got let's say a photo that's 14x10 inches at 300dpi, I want to be able to go in, crop out an oval or circle, with as much or as little of the photo that I can or want to, setting that automatically to a certain dimension and dpi, then paste it into a blank white page I've already created at that same d
    When finished I'd have maybe 20 or 30 images on a page that I can flatten all the layers and print.
    I can't find a way to set size and resolution with anything other than the regular square crop tool.

    You can make an action and use it as one step automation to achieve that on an initial selection.
    Step by step instructions:
    With the Elliptical Marquee Tool, make the desired selection on a image.
    Open the Actions panel (Window > Actions (Alt+F9), from its menu at the top right or corresponding buttons at the bottom, choose New Action, and in the dialog that appears press the Record button.
    From the Image menu, choose Crop.
    From the Selection menu, choose Inverse (Ctrl+Shift+I)
    Press the d key on your keyboard to reset the foreground/background color swatches.
    Press Ctrl + Delete keys on your keyboard to fill with white.
    From the Image menu, choose Image Size (Ctrl+Alt+I), make sure the Resample Image is checked, and in the Document Size section enter the desired dimensions and resolution and press OK.
    In the Actions Panel press the Stop Recording button.
    Now you can copy or drag the image to another image.
    For the next image make the oval selection, go to the Actions panel, select the actions you created above, and press the play button. You can also create a keyboard shortcut in the action's property accessible by double clicking the action.
    The creation of this action assumes that in the final image you will be composing oval images on white background without overlapping their rectangular bounding boxes. If you plan to overlap them then the action must be modified to make the image a transparent layer and delete outside the oval instead of filling with white.

  • Record set size in Gantt Chart

    Hi all,
    I am developing an application that has a Gantt Chart.
    The tree drawn is a 2 level tree. I have two VOs.
    The second VO (Child) has more than 20 rows. I want to show only 10 child at once.
    Record set size attribute is the one that is used to restrict the size of the number of nodes displayed. Just like in HGRID.
    But when the graph is rendered the values that I give are being ignored and the entire graph is rendered.
    Any pointers or suggestions on this will be really helpful.
    Regards,
    Santhosh.

    Hi Santosh,
    As Anand suggested to add the "rownum <= 10" condition to limit the record set.
    But this condition should be set in View Link SQL(Query where clause).
    I hope this will work.
    Thanks
    Renu

  • How programmatically set size of report element in Java

    In topic
    [How programmaticaly set size of some field?|How programmaticaly set size of some field?]
    someone changing programmatically report element, but I think this part of code
    is in .NET framework
    For example I mean something like following snippet
    BoxObject box = (BoxObject) reportClientDocument
    .getReportDefController().findObjectByName("headerBox");
    BoxObject newBoxObject=new BoxObject(box);
    Border border=new Border();
    border.setBorderColor(new Color(255,255,255));
    newBoxObject.setBorder(border);
    newBoxObject.setFillColor(new Color(255,255,255));
    reportClientDocument
    .getReportDefController().getReportObjectController().modify(box, newBoxObject);
    Why I think this is in .NET framework because java object "ReportClientDocument" don't have "getReportDefController()" method (I donu2019t know .NET).
    What I want to do, I want to take "Details" (part of report) and change size.
    If there is no way to take "Details" how can I take other report element e.g. Text Object

    Ernest,
    What enviroment are you working in? Because my ReportClientDocument object does have the getReportDefController method. How are you declaring your object?
    Try something like:
    private static com.crystaldecisions.sdk.occa.report.application.ReportClientDocument myRCD;
    BoxObject box = (BoxObject) myRCD.getReportDefController().findObjectByName("headerBox");
    Cheers
    Darren

  • Make it open at set size?

    Is it possible to make the QT player open pre-existing files at a set size?
    Thanks.

    Hi, Rick
    It's possible.
    You can either use SimpleMovieX or QuickTime Pro.
    (Note that I'm the developer of SimpleMovieX).
    If you accept to create a separate file, you resize the movie with View > Resize Movie, then save a reference movie with File > Save RefMovie.
    The new file takes only a few kilobytes and links to the original. It opens at the size that you have set.
    If you want to keep the same file as original, it has to be a QuickTime mov file.
    You do View > Resize Movie, then File > Save.
    If you cannot or don't want to overwrite the original size, then it's not possible.
    Regards, BJ

  • Set size and location of  a component

    Hello,
    Does anyone familiar with this org.netbeans.lib.awtexttra.AbsoluteConstraints(). I want to set the size and location of the component, and I know this org netbeans can provide this function.
    getContentPane().add(chkTausta, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, -1, -1));
    chkRakkennus.setSelected(true);
    chkRakkennus.setText("Rakennukset");
    then it comes an error that org.netbeans.lib.awtextra.AbsoluteConstraints()cannot be resolved. Does anyone know what�s the reason. Do I have to download other version of Java. I have Jre1.6.0?
    Does anybody knows is there another way to set size of component. For example, if I use borderlayout, and put a button to the west, then how can I set the location and size of the button?
    Thanks a lot for you help.
    Clare

    org.netbeans.lib.awtextra.AbsoluteConstraints isn't part of the JDK. I suggest you don't use that at all. Let a LayoutManager do the resizing.
    Have a look at the [Layout tutorial|http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html] especially gridBagLayout

  • Setting size of Label!!!

    I have problem in setting size of label. Actually I have atttached some labels in a pannel. I want to set different size for each label. I there any way i can explicitly set the size of labels.
    Thanx in advance.

    The layout manager you use wont necessarily let you do that... Call first setLayout(null), and only then setSize and setLocation if you want to layout the components yourself.

  • ORA-19510: failed to set size with ORA-27059: could not reduce file size

    Hi,
    I have RMAN backup implemented and getting below error.
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03009: failure of backup command on c1 channel at 01/12/2014 04:28:37
    ORA-19510: failed to set size of 12839996 blocks for file "/home/oracle/DBBACKUP/Oracle10g1/Full_Backup/DB_Backup_201401128366598241" (blocksize=16384)
    ORA-27059: could not reduce file size
    Linux Error: 28: no space left on device
    Additional information: 2
    I have checked with following scenarios:
    1. taking backup by setting the MAXSETSIZE parameter value greater than the maximum size of tablespace.
    2. taking compressed incremental backup with maxsetsize as unlimited.
    3. taking compressed incremental backup with maxpiecesize value as 20G/40G/80G/120G and maxsetsize as unlimited.
    Following is the RMAN backup script:
    RMAN> run
    2>  {
    3>  allocate channel c1 device type disk maxpiecesize 120G
    4>  format '/home/oracle/DBBACKUP/Oracle10g1/Full_Backup/DB_Backup_%Y%M%D%t%p';
    5>  backup incremental level 0 as compressed backupset database plus archivelog delete input;
    6>  crosscheck backup of database;
    7>  crosscheck backup of controlfile;
    8>  crosscheck archivelog all;
    9>  delete noprompt expired backup of database;
    10>  delete noprompt expired backup of controlfile;
    11>  delete noprompt obsolete recovery window of 15 days;
    12>  release channel c1;
    13>  }
    14> exit;
    Oracle database version is 10.2.0.1.
    The database is on Linux system and we are taking the RMAN backup on mounted Windows NTFS disk.
    The remaining space on NTFS system 1.7TB and the total database size 850GB. Used size by database is 500GB.
    Regards,
    Yogesh.

    Hi,
    First get the backup piece size its trying to allocate for file "/home/oracle/DBBACKUP/Oracle10g1/Full_Backup/DB_Backup_201401128366598241"
    = 12839996*16384
    = 210370494464/1024/1024/1024
    =195.9GB
    Its trying to allocate ~196GB for the file.
    1. Make sure the RMAN backup piece won’t exceed the O/S permitted filesize limit.
    2. But we can restrict the RMAN backup piece using the MAXPIECESIZE option.
    You restricted it to 120GB but actual requirement to allocate backup piece file is ~196GB.
    I think you need to change the MAXPIECESIZE and give it a try.
    Please update if it succeeded or failed.
    Thanks & Regards,
    Gayu

  • How to set glasspane in Jpanel?

    I want to block all mouse/key input in JPanel, so how to set glasspane in jpanel?

    A glass pane is for the entire frame, not just a JPanel.
    Read the Swing tutorial on [How to Use Root Panes|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html] which has an example on using Glass Panes.

Maybe you are looking for

  • SharePoint 2010 with OAM 11g

    We are currently trying to integrate SharePoint 2010 server with OAM 11g with 10g webgate. In our environment SharePoint site is configured with Claims based authentication with LDAP provider for membership. We have performed all the configurations b

  • How do I remove default genres in iTunes 11?

    I don't mean any genres I've added myself, but default genres already in the program, like "Pop."   In the past you could edit the localizable.strings file, but the genres no long seem to be there.  There is a genresLoc.plist file but that also does

  • Diskpart

    Hello, I'm using Windows 7 Ultimate SP1 [32-bit], and I have a 4TB USB WD USB external drive (My Book). All I want to do is use dispart to create one partition. This is the command line I use: DISKPART LIST DISK SELECT DISK 2 CLEAN CREATE PARTITIION

  • Users with Company Code

    Hi All, Can anybody please tell me the best possible way to find out the company code (Organisational Assignment) for Users without getting into each role and checking the Company code through the Organisational Assignment. Fo Eg: Suppose i have 10,0

  • After deactivating CS4 on an old computer, invalid serial number on new installation

    After deactivating CS4 on an old computer, I can not get it re installed on my new computer, it says my serial number is invalid, well it worked to uninstall.... why is it not working? does it take a set amount of time to clear your server?