Setting Frame Size...

I have an JInternalFrame, inside a JDesktopPane, inside a JFrame. When I run my application, the JFrame is extremely tiny, and I have to resize it to see the internal frames. I have tried to use the setSize of the JFrame, but it does not work. Here is my code:
JFrame frame = new JFrame("Real Estate");
mainFrame = new JDesktopPane();
Dimension mainSize = frame.getMaximumSize();
frame.setSize(mainSize);
mainFrame.setSize(mainSize);
frame.getContentPane().add(mainFrame);
frame.setContentPane(mainFrame);
frame.setJMenuBar(createMenu());
Color colors = Color.lightGray;
mainFrame.setBackground(colors);
Other fe = new Other();
frame.addWindowListener(new WindowAdapter() {
   public void windowClosing(WindowEvent e) {
         System.exit(0);
JInternalFrame jif = fe.createFinanceFrame();
jif.setVisible(true);
jif.setClosable(true);
jif.setMaximizable(true);
jif.setIconifiable(true);
jif.setResizable(true);
mainFrame.add(jif, 1);
mainFrame.setVisible(true);
frame.pack();
frame.setVisible(true);
} Thank you for your help.

Without the source code it's difficult to visualize what the problem is from your description.
I have just one comment to make: when you select a menu item, that item's listener is invoked immediately before any repainting of the screen taking place. If your listener code takes a while to finish you'll have your pull-down menu image left behind on screen until the listener finishes executing; in this case of long-running listener you'd better to execute the listener's code in a separate thread so it won't hog the event-dispatch thread (for repainting and so on).
Cheers
Tue

Similar Messages

  • Is it possible to set frame size for a new project ?

    Hi all,
    i would like to create a video in which there will be 2 videos playing the same content from a different angle.
    Each video is 512 x 384 .
    So i would like to set the frame size of the project as 1024 x 768 in order both videos to exist.
    I searched around for tutorials regarding this but i didn't find anything similar.It seems as if i cannot set the frame size of the project from the start.
    So,is there a way to do this?
    Thank you for your time reading this.
    Regards,
    nikits72.

    Hi and thank you for your answers.
    @->shoternz
    It will be displayed in my monitor and probably on you tube.Btw your remark on size was very accurate.Didn't think of that.
    Although i could use a little bigger height to use it to display a logo or something....
    I am very premiere newbie as you can understand.
    Regards,
    nikits72

  • Doubt in setting Frame Size

    Hi,
    I'm having problem in setting the frame size even though i used the setSize method.I'm not able to figure out whts wrong ...here's a part of my code :
    JFrame frame = new JFrame("MyFirstFrame");
         frame.setSize(600,600);
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel jp = new JPanel();
         frame.getContentPane().add(jp);
         frame.pack();
         frame.setVisible(true);
    I'm new to java...i dont know where i have gone wrong.....the frame display in the minimum size !
    pls help !
    Thanks...

    i mean ------------
    public classs {
    //some
    JFrame frame = new JFrame("MyFirstFrame");
    frame.setSize(600,600);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel jp = new JPanel();
    frame.getContentPane().add(jp);
    frame.pack();
    frame.setVisible(true);
    now check until working ,you may use the setLocation(location,location).......
    setLocation(int,int).............................

  • Setting frame size to 640 by 360

    Hello
    I am trying to edit video that is 640 by 360 in size but Premiere seems to only want to have it in 720 by 480. This results in a thick black box around my video that is very annoying. Is there any way to fix this? I do not want to upscale the video because it looks horrible.
    I am useing Adobe Premiere Pro CS4.

    The attributes with Export will also depend on the main choices that you make. If you choose a DVD Export setting, you are correct. However, there are many other Export Presets. My determining factor is "how do I intend on delivering the output file?" Once I have answered that question, I will pick an appropriate Export Preset and then adjust that to what I need. Some, like the DVD that I mentioned, are pretty well locked in.
    How do you plan on delivering the output file? That will give us a starting point, to help you chose.
    Good luck,
    Hunt

  • In FCExpress, setting frame size

    Just got the upgrade to FCExpress. Can I customize the size of the movie that I want to work with. I create animations from animation programs at different sizes. For example, I use 900x600 sometimes.
    SH

    Might want to post this in the FC Express discussion forum

  • Set frame size according to screen resolution

    hi frns,
    i have developed a GUI by using BorderLayout and GUI contains around 7 components.I am primarily working on 1024*768 resolution..THe main problem is when i using 800*600..My interface will run out of shape..How to avoid this. ......reply urgently.
    thanku.

    Cross-post. Reply can be found here:
    http://forum.java.sun.com/thread.jspa?threadID=695824

  • How do I set the frame size

    I am Making a program for purchasing games, with the basic layout alsot done, except on problem. When the purchase button is pressed, a dialog shows up but nothing is seen until i resize it. How would i set the frame size so that i do not need to resize it each time? below is the code for the files. Many thanks in advance.
    CreditDialog
    import java.awt.*;
    import java.awt.event.*;
    class CreditDialog extends Dialog implements ActionListener { // Begin Class
         private Label creditLabel = new Label("Message space here",Label.RIGHT);
         private String creditMessage;
         private TextField remove = new TextField(20);
         private Button okButton = new Button("OK");
         public CreditDialog(Frame frameIn, String message) { // Begin Public
              super(frameIn); // call the constructor of dialog
              creditLabel.setText(message);
              add("North",creditLabel);
              add("Center",remove);
              add("South",okButton);
              okButton.addActionListener(this);
              setLocation(150,150); // set the location of the dialog box
              setVisible(true); // make the dialog box visible
         } // End Public
         public void actionPerformed(ActionEvent e) { // Begin actionPerformed
    //          dispose(); // close dialog box
         } // End actionPerformed
    } // End Class
    MobileGame
    import java.awt.*;
    import java.awt.event.*;
    class MobileGame extends Panel implements ActionListener { // Begin Class
         The Buttons, Labels, TextFields, TextArea 
         and Panels will be created first.         
         private int noOfGames;
    //     private GameList list;
         private Panel topPanel = new Panel();
         private Panel middlePanel = new Panel();
         private Panel bottomPanel = new Panel();
         private Label saleLabel = new Label ("Java Games For Sale",Label.RIGHT);
         private TextArea saleArea = new TextArea(7, 25);
         private Button addButton = new Button("Add to Basket");
         private TextField add = new TextField(3);
         private Label currentLabel = new Label ("Java Games For Sale",Label.RIGHT);
         private TextArea currentArea = new TextArea(3, 25);
         private Button removeButton = new Button("Remove from Basket");
         private TextField remove = new TextField(3);
         private Button purchaseButton = new Button("Purchase");
         private ObjectList gameList = new ObjectList(20);
         Frame parentFrame; //needed to associate with dialog
         All the above will be added to the interface 
         so that they are visible to the user.        
         public MobileGame (Frame frameIn) { // Begin Constructor
              parentFrame = frameIn;
              topPanel.add(saleLabel);
              topPanel.add(saleArea);
              topPanel.add(addButton);
              topPanel.add(add);
              middlePanel.add(currentLabel);
              middlePanel.add(currentArea);
              bottomPanel.add(removeButton);
              bottomPanel.add(remove);
              bottomPanel.add(purchaseButton);
              this.add("North", topPanel);
              this.add("Center", middlePanel);
              this.add("South", bottomPanel);
              addButton.addActionListener(this);
              removeButton.addActionListener(this);
              purchaseButton.addActionListener(this);
              The following line of code below is 
              needed inorder for the games to be  
              loaded into the SaleArea            
         } // End Constructor
         All the operations which will be performed are  
         going to be written below. This includes the    
         Add, Remove and Purchase.                       
         public void actionPerformed (ActionEvent e) { // Begin actionPerformed
         If the Add to Basket Button is pressed, a       
         suitable message will appear to say if the game 
         was successfully added or not. If not, an       
         ErrorDialog box will appear stateing the error. 
              if(e.getSource() == addButton) { // Begin Add to Basket
    //          GameFileHandler.readRecords(list);
                   try { // Begin Try
                        String gameEntered = add.getText();
                        if (gameEntered.length() == 0 ) {
                             new ErrorDialog (parentFrame,"Feild Blank");
                        } else if (Integer.parseInt(gameEntered)< 0
                                  || Integer.parseInt(gameEntered)>noOfGames) { // Begin Else If
                             new ErrorDialog (parentFrame,"Invalid Game Number");
                        } else { // Begin Else If
                             //ADD GAME
                        } // End Else
                   } catch (NumberFormatException num) { // Begin Catch
                        new ErrorDialog(parentFrame,"Please enter an Integer only");
                   } // End Catch
              } // End Add to Basket
         If the Remove From Basket Button is pressed, a  
         a suitable message will appear to say if the    
         removal was successful or not. If not, an       
         ErrorDialog box will appear stateing the error. 
         if(e.getSource() == removeButton) { // Begin Remove from Basket
              try { // Begin Try
                        String gameEntered = remove.getText();
                        if (gameEntered.length() == 0 ) {
                             new ErrorDialog (parentFrame,"Feild Blank");
                        } else if (Integer.parseInt(gameEntered)< 1
                                  || Integer.parseInt(gameEntered)>noOfGames) { // Begin Else If
                             new ErrorDialog (parentFrame,"Invalid Game Number");
                        } else { // Begin Else If
                             //ADD GAME CODE
                        } // End Else
                   } catch (NumberFormatException num) { // Begin Catch
                        new ErrorDialog(parentFrame,"Please enter an Integer only");
                   } // End Catch
              } // End Remove from Basket
         If the purchase button is pressed, the          
         following is executed. NOTE: nothing is done    
         when the ok button is pressed, the window       
         just closes.                                    
              if(e.getSource() == purchaseButton) { // Begin Purchase
                   String gameEntered = currentArea.getText();
                   if (gameEntered.length() == 0 ) {
                        new ErrorDialog (parentFrame,"Nothing to Purchase");
                   } else { // Begin Else If
                        new CreditDialog(parentFrame,"Cost � 00.00. Please enter Credit Card Number");
                   } // End Else               
              } // End Purchase
         } // End actionPerformed
    } // End Class
    RunMobileGame
    import java.awt.*;
    public class RunMobileGame { // Begin Class
         public static void main (String[] args) { // Begin Main
              EasyFrame frame = new EasyFrame();
              frame.setTitle("Game Purchase for 3G Mobile Phone");
              MobileGame purchase = new MobileGame(frame); //need frame for dialog
              frame.setSize(500,300); // sets frame size
              frame.setBackground(Color.lightGray); // sets frame colour
              frame.add(purchase); // adds frame
              frame.setVisible(true); // makes the frame visible
         } // End Main
    } // End Class
    EasyFrame
    import java.awt.*;
    import java.awt.event.*;
    public class EasyFrame extends Frame implements WindowListener {
    public EasyFrame()
    addWindowListener(this);
    public EasyFrame(String msg)
    super(msg);
    addWindowListener(this);
    public void windowClosing(WindowEvent e)
    dispose();
    public void windowDeactivated(WindowEvent e)
    public void windowActivated(WindowEvent e)
    public void windowDeiconified(WindowEvent e)
    public void windowIconified(WindowEvent e)
    public void windowClosed(WindowEvent e)
    System.exit(0);
    public void windowOpened(WindowEvent e)
    } // end EasyFrame class
    ObjectList
    class ObjectList
    private Object[] object ;
    private int total ;
    public ObjectList(int sizeIn)
    object = new Object[sizeIn];
    total = 0;
    public boolean add(Object objectIn)
    if(!isFull())
    object[total] = objectIn;
    total++;
    return true;
    else
    return false;
    public boolean isEmpty()
    if(total==0)
    return true;
    else
    return false;
    public boolean isFull()
    if(total==object.length)
    return true;
    else
    return false;
    public Object getObject(int i)
    return object[i-1];
    public int getTotal()
    return total;
    public boolean remove(int numberIn)
    // check that a valid index has been supplied
    if(numberIn >= 1 && numberIn <= total)
    {   // overwrite object by shifting following objects along
    for(int i = numberIn-1; i <= total-2; i++)
    object[i] = object[i+1];
    total--; // Decrement total number of objects
    return true;
    else // remove was unsuccessful
    return false;
    ErrorDialog
    import java.awt.*;
    import java.awt.event.*;
    class ErrorDialog extends Dialog implements ActionListener {
    private Label errorLabel = new Label("Message space here",Label.CENTER);
    private String errorMessage;
    private Button okButton = new Button("OK");
    public ErrorDialog(Frame frameIn, String message) {
    /* call the constructor of Dialog with the associated
    frame as a parameter */
    super(frameIn);
    // add the components to the Dialog
              errorLabel.setText(message);
              add("North",errorLabel);
    add("South",okButton);
    // add the ActionListener
    okButton.addActionListener(this);
    /* set the location of the dialogue window, relative to the top
    left-hand corner of the frame */
    setLocation(100,100);
    // use the pack method to automatically size the dialogue window
    pack();
    // make the dialogue visible
    setVisible(true);
    /* the actionPerformed method determines what happens
    when the okButton is pressed */
    public void actionPerformed(ActionEvent e) {
    dispose(); // no other possible action!
    } // end class
    I Know there are alot of files. Any help will be much appreciated. Once again, Many thanks in advance

    setSize (600, 200);orpack ();Kind regards,
      Levi
    PS:
        int i;
    parses to
    int i;
    , but
    [code]    int i;[code[i]]
    parses to
        int i;

  • FCP- DVDSP sequence settings. frame size

    Question of sequence settings. when making a DVD, will the sequence setting, Frame size make a difference?
    We are just starting to edit a documentary, which uses alot of still photos and graphics. The rest of the video is shot on DV. I have tried laying still photos on the DV sequence, but it looks like still photos look really compressed and blurry. Not so good quality wise. If I set it to CCIR 601-NTSC, the photos look super good. We are NOT outputting any digi-beta uncompressed, but only to DVD.
    I am editing sequence in NTSC DV, but thinking of just before getting outputting with compressor, I am thinking of changing to uncompressed sequence CCIR 601-NTSC, and then compress it to MPEG2. (doing this later so that i can do alot of edits RealTime and worry about picture quality later) of course the picture size does get smaller... I don't really know the effect of this on a teleframed television.
    Will that make a difference? Seems that if I go through DVcompression AND MPEG2 compression, both, is more compression than MPEG2 compression itself. Is there a site that talks about it?
    Thanks in advance.
    Lost

    I only have "a bit" of experience working with stills in a DV sequence. But one thought concerns how you are integrating the stills and the video. I assume you are going to pretty much intermix the stills and the video and audio (interviews or whatever) that may go with video and stills.
    The DVD format, of course, supports stills as a slide show directly, but this will not accomplish the intermix very effectively.
    As far as size-quality, you may want to import the stills are larger than DV image size and then pan across them, etc.
    At the end of the day, to achieve a seamless edit job, you are probably going to need to have all the stills sitting on a regular DV timeline for export / encoding to MPEG2.
    I honestly do not put much stock in the differences between viewer and canvas. I always use an external NTSC monitor to judge the final appearance. I started with a cheap TV and recently upgrade to a nice JVC production monitor. This is the real measure of the final video, in my experience.

  • Ulaw frame size?? please help

    Hello all,
    I'm transmitting a sound file with "ULAW/rtp, 8000.0 Hz, 8-bit, Mono, FrameSize=8 bits" like audio format. I get this string after call
    supported = tracks.getSupportedFormats();
    What does "FrameSize=8 bits" means??
    Please help.
    Hern�n.
    Message was edited by:
    Hernan-Rojas

    Export your FCP sequence using "current settings" and "make self contained"
    Open up Compressor and select from the presets H.264 for 300Kbps.
    Duplicate the preset so you can edit the settings.
    In the duplicate preset -
    Enable Frame Controls - 
    Resize: Better
    Output fields: Progressive
    Deinterlace: Better
    Adaptive Details: selected
    Rate Conversion: Fast (your are not chaning the frame rate)
    Duration: 100% of source
    In the Geometry Tab
    set frame size to: 854x480
    pixel aspect; 1.0
    Audio pass through.
    then add the exported file from FCP and apply the new preset.
    You can change the Resize and Deinterlace to "Better" but usually with a much longer render time.
    have fun.
    x

  • How do I set custom frame size in Premiere Pro 5.5 sequence.

    I need to set a custom frame size in Premiere Pro 5.5.
    I can't edit a preset so how do I create my own?

    If you realy feel 'lazy' or have no idea what settings to choose you can drag the clip the into the New Item icon. This will create a matching sequence.

  • How do you set the frame size?

    Trying to set a frame size for 1920px X 1080px but can't see where to set this in a new project?

    Frame dimensions are a property of the sequence, not the project. A project can contain multiple sequences with different properties.
    File>New>Sequence opens a dialog where you can choose a preset or configure custom settings. Several of the preset groups have 1920x1080 options.
    Asssuming you have footage of those dimensions that you'll be using in the sequence, then you can simply create a sequence from an asset. Either drag it to the New Item button in the Project panel's lower right corner, or right-click it and select New Sequence from Clip.

  • How to set the size of the frame in the decoration controls

    Hi,
    I am drawing some frames or boxes using the patterns in the "Decorations" control in labview.
    Is there other way to set the size of the frames or boxes rather than to drag them? also how can I change the color of the borders?
    Thanks,
    Joyce
    Solved!
    Go to Solution.

    Select the item.  Go to the Resize Objects button on the toolbar.  Pick the last one which shows a resize within a dialog bubble.  Now a dialog pops up which lets you define the height and width.
    To color something, Shift right click to bring up the toolbox.  Pick the paint brush.  Click on the thing you want to change such as the border.  It might now be the wrong color, so right click which brings up the color picker.  Now select the color you actually want.  If you want something to be transparent, pick the T at the upper right corner of the color dialog box.

  • How to set the size of a JTabbedane to the size of the frame

    I have a tabbed pane in a frame, I would like to know how to set the size of the tabbed pane, so that it occupies the whole of the frame which has been set to screen size.
    Thanks

    Is it not possible to use it with a GridBagLayout?Your question was "How do I get a tabbed pane to take all the space of the frame"?
    You where given the answer. Did you try it? Did it work? Then why are you questioning the suggestion?
    Its one line of code if you use a BorderLayout which by the way was specifically designed for this purpose.
    Yes you can do it with a GridBagLayout with about 5 lines of code.
    So the question is why would you want to write 5 lines of code when you can use one?
    If your question was "How do I waste my time forcing the GridBagLayout to size a component to take up all the space of the frame", then you would have received a different answer. (Although most people would have told you to use a BorderLayout anyway, since its easier).

  • How to set a frame size

    Hi
    I am tring to create a window with some menus on it. I have set a size to the window as (400,400). The trouble is when the application is run a small sized window is displayed on the top left corner as opposed to a 400*400 window. Although I can drag the widow to expand it, I was wondering if there was a way to set window's size.
    Any help is greatly appreciated.
    Thanks in advance
    * GUI.java
    package pick;
    import java.awt.Frame;
    import java.awt.Menu;
    import java.awt.MenuBar;
    import java.awt.MenuItem;
    import java.awt.Panel;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowListener;
    import Drawing2d.*;
    * @author venkat
    public class GUI{
        public Frame frame = new Frame();
        boolean partButtons = false;
        Pick1 pick1;
         Sketch sketch;
    //   JOptionPane AB = new JOptionPane("sgadfg ",javax.swing.JOptionPane.PLAIN_MESSAGE);
    //   java.awt.Dialog AboutD =new java.awt.Dialog(frame);
        public GUI(){
            //Menubar
            MenuBar mb = new MenuBar();
            //Menus
            Menu File = new Menu("File");
    //      File.setLabel("File");
            mb.add(File);
            Menu Edit = new Menu();
            Edit.setLabel("Edit");
            mb.add(Edit);
            Menu View = new Menu();
            View.setLabel("View");
            mb.add(View);
                Menu Orient = new Menu();
                Orient.setLabel("Orient");
                View.add(Orient);
            Menu Insert = new Menu();
            Insert.setLabel("Insert");
            mb.add(Insert);
            Menu Help = new Menu();
            Help.setLabel("Help");
            mb.add(Help);       
            frame.setSize(400,400);
            frame.pack();
            frame.setVisible(true);
            frame.addWindowListener(new MyWindowListener());
    class MyWindowListener implements WindowListener {
    //Do nothing methods required by interface
    public void windowActivated(WindowEvent e) {}
    public void windowDeactivated(WindowEvent e) {}
    public void windowIconified(WindowEvent e) {}
    public void windowDeiconified(WindowEvent e) {}
    public void windowOpened(WindowEvent e) {}
    public void windowClosed(WindowEvent e) {}
    //override windowClosing method to exit program
    public void windowClosing(WindowEvent e) {
        System.exit(0); //normal exit
    }

            frame.setSize(400,400);
            //frame.pack();//<----------------
            frame.setVisible(true);

  • How to set the frame size?

    Hi,
    Can some one show me how to set the frame size in this program? History: I have created a window and added a button but its to small. So I want to increase the size of the frame to at least 600X400 pixel.
    private static void showGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            Main newContentPane = new Main();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        }It would be nice if you could show me how to do it.
    Thank you very much for reading this.

    Challenger wrote:
    Simply adding
    frame.setSize(new Dimension(600,400));to the end of your code should work perfectly.Or, if you want to do it correctly, .setPreferredSize() on your frame before you .pack() it. The default layout manager for JFrame is BorderLayout, which uses the preferredSize of each component to calculate sizes during the .pack() call.

Maybe you are looking for

  • AirPlay Vs. iMac

    Ok, so it would appear that AirPlay will only work on Macs that are running Mountain Lion and were built in mid 2011.  I can't get AirPlay to work on my iMac, but I'm not sure of its born date.  How can I tell when my computer was made?

  • Unable to select the picture shown anymore on BBM and other programs

    Hi everyone! Device info Your carrier:  Rogers Model info and OS version:  8900, v4.6.1.250 Apps and free space File free before and after a battery remove/replace: 82679615bytes Did a battery pull fix your issue: Nope Apps installed and their versio

  • ALV doesn't expand/collapse subtotals

    Hi everyone, I have an old ALV program in wich i made some changes. For example, added form USER_COMMAND so that when you double-click on a row, it makes a CALL TRANSACTION to the referenced document. But a problem emerged, and it didn't happended be

  • Bootable Backup First Timer

    I want to make a bootable backup of my computer on a external drive. How do I do it with the disk utilities that come with my imac? I've read about Super Duper but I thought I read somewhere that I can do this with my disk utilities. I already have d

  • No hope for 3G on Rogers?

    Hey all, I have the euro version of the E72 (E72-1).  When I bought it, I didn't realise there was a difference between euro and NA 3G frequencies, and it appears that I can't connect to the Rogers 3G or 3.5G network.  Edge for web browsing is just n