JPanels of differnet sizes in a single frame...

Hi,
I want to create a JFrame with 2 JPanels in it...both of differnet sizes. The JFrame is a borderlayout with panel1 on the west and panel2 in the center. panel 1 is small one....just has some controls and panel2 has a image. when the ui is run, the i don't want the vaccant area in the frame (below the panel1) to be displayed.
hope someone can help..
Rgds
Jalikop

perfect....only the small box is lower at (0,0)...
Well, (0, 0) is actually the top left.
I used box layout...but while displaying as frame...it becomes one whole big rectangle n doesn't look like the way I need it...
I still don't understand what you expect to see there. The stuff behind your frame? Sydney Opera House? Herds of wildebeest sweeping majestically across the Serengeti?
Do you mean that the contents of the left-hand panel are being stretched vertically to fill the space? If so, instead of,
mainPanel.add(smallPanel, BorderLayout.WEST);try,
JPanel west = new JPanel();
west.setLayout(new BorderLayout());
west.add(smallPanel, BorderLayout.NORTH); // or SOUTH if you want it at the bottom
mainPanel.add(west, BorderLayout.WEST);

Similar Messages

  • How do I position to panels in a single frame?

    Hi,
    Can someone tell me how i can position two panels in a single frame using the BorderLayout class.
    I have included my code below. When it is run it shows two JPanels positioned at the top and the bottom, a text area to the right, a panel in the center and a panel on the left. I want to get the panel on the left - the yellow panel - to be positioned in the lower third of the center panel. I have tried to use the BorderLayout.SOUTH statement - but this positions the panel across the very bottom which causes the bottom JPanel and part of the text area to disappear.
    Can anyone help with this please???
    Many thanks
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Panels extends JFrame implements ActionListener
         private TopPanel topPanel;
         private BottomPanel bottomPanel;
         private JButton open;
         private JButton close;
         private JButton connect;
         boolean openClicked = false;
         boolean closeClicked = false;
         public Panels()
              super("Panels");
              setSize(1000,600);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              Container contentArea = getContentPane();
              topPanel = new TopPanel();
              bottomPanel = new BottomPanel();
              JTextArea textArea = new JTextArea("Text Area",20,20);
              JScrollPane textScroller = new JScrollPane(textArea);
              open = new JButton("Open");
              open.addActionListener(this);
              close = new JButton("Close");
              close.addActionListener(this);
              connect = new JButton("Connect");
              connect.addActionListener(this);
              JPanel topBar = new JPanel();
              topBar.setBackground(Color.red);
              topBar.add(open);
              topBar.add(close);
              JPanel lowerBar = new JPanel();
              lowerBar.setBackground(Color.red);
              lowerBar.add(connect);
              bottomPanel.setPreferredSize(new Dimension(100,100));
              contentArea.add(topPanel);
         contentArea.add(bottomPanel,BorderLayout.WEST);
              contentArea.add(textScroller,BorderLayout.EAST);
              contentArea.add(lowerBar,BorderLayout.SOUTH);
              contentArea.add(topBar,BorderLayout.NORTH);
              setContentPane(contentArea);
    public void actionPerformed(ActionEvent e)
         if(e.getSource() == open)
         openClicked = true;
         topPanel.repaint();
         if(e.getSource() == close)
         {closeClicked = true;
         bottomPanel.repaint();
    class TopPanel extends JPanel
         public TopPanel()
         public void paintComponent(Graphics painter)
              super.paintComponent(painter);
              painter.setColor(Color.white);
              painter.fillRect(0,0,getSize().width,getSize().height);
              if (openClicked == true)
              drawTopMessage(painter);
         public void drawTopMessage(Graphics painter)
              painter.setColor(Color.black);
              painter.drawString("This is the top panel", 20,20);
    class BottomPanel extends JPanel
         public BottomPanel()
         public void paintComponent(Graphics painter)
              super.paintComponent(painter);
              painter.setColor(Color.yellow);
              painter.fillRect(0,0,getSize().width,getSize().height);
              if (closeClicked == true)
              drawBottomMessage(painter);
         public void drawBottomMessage(Graphics painter)
              painter.setColor(Color.black);
              painter.drawString("This is the bottom panel", 20,20);
    public static void main(String[] args)
         Panels example = new Panels();

    One solution would be to create a new panel, bothPanels and adding the two panels that you need to this panel.
    Once you have done that, you can add bothPanels to contentArea.add( bothPanels, BorderLayout.CENTER)
    hth

  • Single Frame Displays on External Monitor

    I have been searching online for the past three hours, trying to find a solution to this. I have found threads describing similar problems, however, I have done everything suggested in those threads, and nothing seems to work. I am at my wit's end.
    The problem: When I attempt to play my sequence in my timeline, while connected to an external monitor, then audio plays, but only a single frame shows on the monitor. It updates to the most current frame whenever playback stops, but it only shows a static image. Meanwhile, the canvas window in Final Cut Pro displays nothing.
    Things I Have Tried:
    I have selected "All Frames" under View > External Video.
    I have Refreshed A/V Devices.
    I have made certain that the Canvas display size is small. Currently, it is at 50%, and I have also tried setting it to Fit To Window.
    I have gone to Easy Setup, and selected NTSC, DV-NTSC.
    I have checked "Mirror On Desktop" under Audio/Video Settings > A/V Devices > Playback Devices.
    I have also tried unchecking "Mirror on Desktop."
    I have set Video Playback to Apple Firewire NTSC (720 x 480).
    I have set the Sequence Preset to DV NTSC 48 Khz.
    I have set the Device Control Preset to Firewire NTSC.
    I have exited Final Cut Pro, made sure the deck was on first, then turned on Final Cut Pro.
    I have restarted the computer.
    Further Notes: I've noticed that the problem might have something to do with how sequences are displayed. If I double-click on one of my video files in the Final Cut Browser, and open it in the Viewer window, it plays fine, even displays fine in the external monitor (my deck). Furthermore, if I open different Final Cut Projects that worked fine previously, they now have the same issue. So I would assume it is not a problem with the sequence in this current project I am working on.
    Any help you could give would be appreciated more than I can express.

    Have you set the sequence you're trying to play to DV-NTSC? It sounds to me like you're trying to play a sequence that is not a stock DV sequence through a DV device.
    Try creating a new DV-NTSC sequence, copying all the clips from your current sequence, and pasting them into the new sequence.

  • 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.

  • Videos become single frame when exporting iPhoto album

    I've gotten the hang of how to organize pix and vids in an "album" and get them renamed. Now I just want to give those renamed reordered photos on discs to other people that will be on Mac and PCs. This apparently means using the "export" feature, as burning an album directly from iPhoto won't produce a disc usable by a PC.
    "Exporting" the album succeeded in making a new folder elsewhere on my computer containing all of the images and it preserved their names. However, I noticed all of the Quicktime and AVI files had very small file sizes. When I double click on a .mov file, for example, it opens in Quicktime but it is now only a single frame. Same is true for the avi files.
    Any suggestions on another export setting tweak I need to do to get this right?

    You shouldn't have to change it to original though. And if it isn't exporting the actual movie, it should show up as a pic, not have the video icon. I lost important footage from hurricane Ike because I was in a hurry, and trusted the app. Then I go to look at the videos in iMovie, and they aren't even recognized. Current should be whatever it is. Currently that was a video, not an image. Sad.

  • Getting the size of an internal frame?

    Hi allm
    I want to be able to get the size of an internal frame. I have set the size of the main JFrame to that of Windows by calling Toolkit.getScreenSize(); But i can't seem to find an equivalent for internal frames.
    Basically I have two components in the internal frame that I want to have equal width. I was going to find out the size of the internal frame and then half it and applay a horizontal strut to each component.
    If there is a better way of doing it i'm open to suggestions but any help at all is much appreciated
    Thanks
    Dylan
    BorderLayout border = new BorderLayout();       
             content.setLayout(border);
             Box left = Box.createVerticalBox();
             left.add(Box.createHorizontalStrut(400));
             JPanel Create = new JPanel();
                 Create.setBorder(new TitledBorder (new EtchedBorder(), "Create Database"));
                 left.add(Create);
                 Box right = Box.createVerticalBox();
                 right.add(Box.createHorizontalStrut(400));
                 JPanel Help = new JPanel();
                 Help.setBorder(new TitledBorder (new EtchedBorder(), "Help"));
                 right.add(Help);
                 content.add(left, BorderLayout.CENTER);
                 content.add(right, BorderLayout.CENTER);

    The situation is that I have a class that has about 80
    instance fields of basic data types. But it was
    getting overly complicated. As a number of these
    fields related to year and day data I tried to
    re-write with GregorianCalendar instead.
    There are in the region of 45,000 instance of my clas
    being held in an array, however when I tried to use my
    modified class (with the Calendar fields replacing the
    basic data types) I kept running into OutOfMemoryError
    after about 25,000 instances were created. So I
    figured that the GregorianCalendar class must be
    eating up my memory. Was intrigued, but couldn't find
    out how to calculate the size of my new class.
    Hmmm, serialize it you say? Ok, I'll try that.ok don't do that ;)
    ummm i was giving advice assuming (incorrectly i turns out) that you were trying to see how much space the serialized object would take up when written to disk or over a network etc.
    this does not appear to be your problem.
    so here are my new more informed suggestions.
    1) if you were going to write out the "data" parts of your object so
    it could be re-created what would they be. i'm thinking you could
    just boil it all down maybe to a long as in Date.getTime(); then
    you could have a long[] array with 45,000 slots. this should take up far less memory than having myObject[] with 45,000 slots. then you
    could have one actual object that you insert the data into to play
    around with. this may not be the idealists solution but if you have a
    lot of objects you may not want to carry around all the excess
    stuff.
    2) as an aside you say you tried to re-write the GregorianCalendar...
    have your tried extending it or extending Calendar. the idea of
    extending other non-final classes is you can provide your own
    implementation of some things or add totally new methods without having
    to re-write an existing class.
    just some ideas...

  • Mid 2010 Macbook Pro - Change MTU size kills internet (Jumbo Frames)

    Hi everyone, i'm hoping someone here can enlighten or help me solve my problem I'm having.
    I am trying to change my MTU size to enable Jumbo frames on my 13 inch Mid 2010 Macbook Pro. I recently bought a ReadyNAS Ultra and would like to speed up transfers to the unit.
    My setup is as follows:
    I have my ReadyNAS Ultra 2 and 2010 Macbook Pro (Core 2 Duo) wired via cat6 ethernet to my 5th Generation Apple Airport Extreme. The Airport Extreme is connected via cat5e to my AT&T Uverse Gateway which is set up to allow my Airport to assign DHCP and NAT (gateway is in bridge mode with wireless off).
    Anyways, I have enabled Jumbo frames on my ReadyNAS, when I enable them on my MBP.. it applies fine. It disconnects / reconnects the ethernet like it should, but then my connection drops. I can't see any devices on my LAN and I cannot access any internet websites, but according to the network pane I am still assigned a valid dhcp address. When I manually try to increase my MTU size, the same thing happens (from 9000 to 1600 I tried every size).....
    Could it be my MBP just can't suppose the increase of MTU size? It leaves them at 1500 when I set it to automatic... if it doesn't support the increased MTU size, why would it let me custom change the MTU and even give an option to select "Jumbo Frames (9000)"?
    I appreciate any help in advance!!

    asdftroy wrote:
    If you did read my post then you would have saw that the option is there, but that is not entirely what my inquiry is about. The option isn't working as intended, and I was wondering if anyone had the same issues as me. Thanks anyways.
    Anyone else?
    The way you responded to someone trying to help you probably means others will be hesitant to try.

  • Converting a single frame swf to a gif

    I have a couple of really cool animated 'shockwave flash
    movie windows projector' images that i would love to convert into
    animated gif's so that I can edit them to work in a theme I'm
    designing for my sony ericsson w580i. I was finally able to convert
    the exe files into swf's... but that didn't really do me any
    good... same issue. Also upon further scrutiny I discovered that
    both animated file types have only 1 frame! What should I do?!
    Please help!!

    I've experienced the same thing sometime long in the past,
    and I probably did a frame by frame Print Screen to get around it.
    If it's single frame swf, then that's probably all you're going to
    get is one frame as an output.
    You may be able to incorporate a jpeg encoder of some sort to
    take snapshots as the piece animates in some form of loop fashion,
    but I'm not savvy in that dept.

  • How to use single frame in a page

    Hello, i would like to now how to make a frame in a page
    without having two or more, i was used to work with GoLive and
    there i could use the grid an put a single frame and make links to
    other pages that would open in that frame, it worked wel for me,
    but since I switched from golive to dreamweaver CS3 i am not able
    to do so. Is there some one how could tel me how to do so, since i
    use a lot of single frames in my pages,
    greetings

    why are you wanting to use single frames?
    They allow having the initial frame address stay in the
    address bar, and not
    show the linked page's address. The problems they cause
    usually override any
    value.
    Or- if we aren't using the same words the same way, please
    give an example
    site of what you want to do.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • HT200044 how to export a single frame in 10.0.6 - I cannot find option?

    With 10.0.5 There was an option on "share" to pick a single frame from the timeline and export the image as a JPEG or other formats.  I do not find this option on the new version.

    It works now, you need to go back to share and a new option is available that was created by the step you mentioned, listed as share frame one -- when selected, this allows for exporting the frame to the desktop!
    Thanks.
    Jon

  • How do I change packet size for a single load

    All,
        I need to change the packet size for a single load I'm doing.  How do I set that?
        Thanks.
    Dave

    Hi..........
    For this u hav to go to the infopackage scheduler........
    If u r in Process chain >> Right click on the infopackage >> Maintain variant..........then it will come to the IP scheduler..................In the Top Scheduler Tab >> Click on it and select DataS. Default data transfer .......Now there may be a delta IP and Full upload IP for the same datasource.......check ur IP .....it is full or delta..........if full change the packet size for full upload..............otherwise for delta upload........
    If the IP is not a part of any Process chain..........then go to RSA1 >> Find the IP..........and double click on it........then the IP scheduler screen will open..........
    You can make global settings for all datasources...... in the transaction SBIW in the area General Settings >> Maintain control Parameter for Data transfer......... The parameters that you maintain here are valid as global standard values, and thus apply to all DataSources.
    Hope this helps.....
    Regards,
    Debjani........
    Edited by: Debjani  Mukherjee on Nov 13, 2008 2:19 PM

  • What's the simplest way to export a single frame from an animated gif as gif?

    i have an animated gif and wish to save a single frame as a non-animated gif.
    in the past i've been achieving this by deleting all the frames i don't wish to export and deleting them before exerting, this seems very clumsy though so i figure there's a more sensible solution in there somewhere, but where?

    Thanks, Bill! Actually version 9 looks a little clearer than that, as it has two bold clear white paddles to mark the edge of the work area.
    I was a little frustrated at first, because whatever I did, it still took a year and exported the entire video.
    Then:
    I caught sight of this teeny tiny box waiting for a tick from me, which said:
    Share Work area Bar Only
    We have lift-off 
    Thanks again. So much quicker than all that deleting ahnd hoping you don't accidentally say "yes" when prompted to save changes!

  • Mouse over HTML link causes single frame to display at top of page Netscape only

    Having a wierd problem. When you run the mouse over HTML
    links on the page a single frame of the flash movie apears at the
    top center of the page. It only happens in netscape in firefox
    mode. IE, Opera, and Firefox do not have the problem.
    Problem site
    Thanks in Advance,
    Vorsch

    The problem goes away if i modify my .css file by removing
    the
    border: 1px solid #999999;
    line from the "a:hover" style.
    I ran my css file thru the validator at w3c and its fine. The
    Page also validates as xhtml transitional.
    and just a note the same file version is on my public server
    and my testing server.
    Has anyone ever seen this before?? I have several sites with
    a:hover effects and flass media and have never run across this
    before.

  • Concatenate two single frame swf's into one singleframe swf?

    Hi
    Is it possible to combine multiple swf's into one "single frame" swf?
    I have an flex application, that has a scroller with a swfloader inside, and the swfloader should load the "single frame" swf and it is possible to navigate up and down, via the scroller.
    Any help is appreciated.
    /Allan

    I've experienced the same thing sometime long in the past,
    and I probably did a frame by frame Print Screen to get around it.
    If it's single frame swf, then that's probably all you're going to
    get is one frame as an output.
    You may be able to incorporate a jpeg encoder of some sort to
    take snapshots as the piece animates in some form of loop fashion,
    but I'm not savvy in that dept.

  • Premiere Pro CC 'single frame' export squashes aspect ratio

    Hi,
    When I used the single frame export button to export a single frame from my timeline, the 16:9 ratio gets squashed in.
    The image has a play button graphic on it and that should be round but it comes out oval. 
    When I import the image into Photoshop, it looks normal 16:9 but when I save it as a jpeg and open it up, it's still squashed.
    I would be so grateful if someone could help me sort this out. 
    Cardamada

    Thanks Jim for your quick reply.  I am still wondeirng if there is a better way.  The footage I am editing is 1920 x 1080 DSLR footage.  Anytime I export a frame from Fnal Cut Pro it does it fine.  I moved over to Adobe recently and I'm suprised that it's not working.  I wondered whether there was a way to change my export settings so that it exports with square pixels from Premiere Pro.  Meanwhile I will try to follow your  instructions re square pixles and photoshop.

Maybe you are looking for

  • OBI REPORTS DefaultNumericformat is currently $0.00.as It should be integer

    We have OBIEE environment setup with version 10.1.3.4.1 and currently For all of our OBIEE reports, for columns where the numeric format is not specified, a default format is used and Currently that default format appears to be currency to 2 decimal

  • Home sharing works on primary wifi but not via Access Point

    I have two wifi routers set up at either ends of the house.  The primary router (Netgear DGN2000) is connected to an Access Point (Edimax EW-7416APN) via a D-link Powerline ethernet connection.  Both are configured with identical SSID names/passwords

  • Koyote Soft HD Converter V1.6 Problems?

    The free Koyote Soft HD Converter is a popular choice for converting AVCHD to MPEG2 HD for use in Premiere Elements. My experiences with that software have been with the 1.4 version of it. One of the first persons who brought this software to my atte

  • Spotty iTunes Shared Library Connection

    I continue to have problems sharing my iTunes library between my PC and laptop (both Dells with Windows Vista). My entire collection is on my PC, but I prefer using my laptop as a mobile music library. However, at random times my PC library disappear

  • Help With Tags

    I have a TagLib which is working perfectly with JSPs,The Tag is <c:chart id="chart1" datasource="#{name.Graph}" type="xyline" is3d="false" background="green" height="50" width="150" legend="false" border="true"> </c:chart>. What i am trying to do is