Obtaining true size of a JFrame prior to making it visible

Is there a way to accomplish the following without making the frame visible first?
frame.setVisible(true);
Rectangle frameSize = frame.getBounds();
frame.setVisible(false);
The problem is that if I don't make the frame visible, then I get a height and width of 0 in frameSize.
Thanks in advance.

its very simple. you can specify the frame size by setSize() method or
directly you can call pack() method after adding all components. so after calling
pack() method you can get the frames width and height by getWidth() and getHeight() methods. these methods apply to all components and u can call
this method before calling setVisible(true).
i think this will solve ur problem.

Similar Messages

  • How Do You Set the Maximum Size of a JFrame?

    Can someone show me a quick example? The JFrame can be empty, I just want to know how to set it's maximum size. I tried using setMaximumSize() and it doesn't work for some reason but setMinimumSize() works fine.
    I tried it using a BoxLayout and even using null as a layout manager and can't get it to work. I heard that the other layout managers don't allow you to set the maximum size of a JFrame so that is why I tried it with the layouts that I did.
    I tried the following code (imported the necessary classes), but it does not work...
    public class MyFrame extends JFrame
        public MyFrame()
            super("TestFrame");
            setLayout( new BoxLayout(getContentPane(), BoxLayout.X_AXIS)  );       
            setMaximumSize( new Dimension(400,200));
            setSize(300,150);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setVisible( true );                
    }// end class

    Reposted from
    {color:#0000ff}http://forum.java.sun.com/thread.jspa?threadID=5236259{color}
    @OP:
    When you repost a topic, please always provide a link to the previous post so people can check what suggestions were already offered (and didn't solve the problem).
    Better still, give a short summary of the advice you have already tried.
    I suggested setBackground(...) so you can see whether your MyFrame is actually occupying the entire real estate of the window. Looks as if trying it out (which I would have done for you if I'd been at home, where my JDK is) would have been too much effort for you.
    I'm pretty much a novice in Swing, but I can tell you this: setLayout controls the layout of components added to the JFrame, not the layout of the frame with respect to its parent container.
    Luck, Darryl

  • ORA-00349: failure obtaining block size for '+Z'  in Oracle XE

    Hello,
    I am attempting to move the online redo log files to a new flash recovery area location created on network drive "Z" ( Oracle Database 10g Express Edition Release 10.2.0.1.0).
    When I run @?/sqlplus/admin/movelogs; in SQL*Plus as a local sysdba, I get the following errors:
    ERROR at line 1:
    ORA-00349: failure obtaining block size for '+Z'
    ORA-06512: at line 14
    Please let me know how to go about resolving this issue.
    Thank you.
    See below for detail:
    Connected.
    SQL> @?/sqlplus/admin/movelogs;
    SQL> Rem
    SQL> Rem $Header: movelogs.sql 19-jan-2006.00:23:11 banand Exp $
    SQL> Rem
    SQL> Rem movelogs.sql
    SQL> Rem
    SQL> Rem Copyright (c) 2006, Oracle. All rights reserved.
    SQL> Rem
    SQL> Rem NAME
    SQL> Rem movelogs.sql - move online logs to new Flash Recovery Area
    SQL> Rem
    SQL> Rem DESCRIPTION
    SQL> Rem This script can be used to move online logs from old online
    log
    SQL> Rem location to Flash Recovery Area. It assumes that the database
    SQL> Rem instance is started with new Flash Recovery Area location.
    SQL> Rem
    SQL> Rem NOTES
    SQL> Rem For use to rename online logs after moving Flash Recovery
    Area.
    SQL> Rem The script can be executed using following command
    SQL> Rem sqlplus '/ as sysdba' @movelogs.sql
    SQL> Rem
    SQL> Rem MODIFIED (MM/DD/YY)
    SQL> Rem banand 01/19/06 - Created
    SQL> Rem
    SQL>
    SQL> SET ECHO ON
    SQL> SET FEEDBACK 1
    SQL> SET NUMWIDTH 10
    SQL> SET LINESIZE 80
    SQL> SET TRIMSPOOL ON
    SQL> SET TAB OFF
    SQL> SET PAGESIZE 100
    SQL> declare
    2 cursor rlc is
    3 select group# grp, thread# thr, bytes/1024 bytes_k
    4 from v$log
    5 order by 1;
    6 stmt varchar2(2048);
    7 swtstmt varchar2(1024) := 'alter system switch logfile';
    8 ckpstmt varchar2(1024) := 'alter system checkpoint global';
    9 begin
    10 for rlcRec in rlc loop
    11 stmt := 'alter database add logfile thread ' ||
    12 rlcRec.thr || ' size ' ||
    13 rlcRec.bytes_k || 'K';
    14 execute immediate stmt;
    15 begin
    16 stmt := 'alter database drop logfile group ' || rlcRec.grp;
    17 execute immediate stmt;
    18 exception
    19 when others then
    20 execute immediate swtstmt;
    21 execute immediate ckpstmt;
    22 execute immediate stmt;
    23 end;
    24 execute immediate swtstmt;
    25 end loop;
    26 end;
    27 /
    declare
    ERROR at line 1:
    ORA-00349: failure obtaining block size for '+Z'
    ORA-06512: at line 14
    Can someone point me in the right direction as to what I may be doing wrong here - Thank you!

    888442 wrote:
    I am trying to drop and recreate ONLINE redo logs on my STANDB DATABASE (11.1.0.7)., but i am getting the below error.
    On primary, we have done the changes., ie we added new logfile with bigger size and 3 members. When trying to do the same on Standby we are getting this error.
    Our database is in Active DG Read only mode and the oracle version is 11.1.0.7.
    I have deffered the log apply and cancelled the managed recovery, and dg is in manual mode.
    SQL> alter database Add LOGFILE GROUP 4 ('+DT_DG1','+DT_DG2','+DT_DG3') SIZE 1024M;
    alter database Add LOGFILE GROUP 4 ('+DT_DG1','+DT_DG2','+DT_DG3') SIZE 1024M
    ERROR at line 1:
    ORA-00349: failure obtaining block size for '+DT_DG1'First why you are dropping & recreating online redo log files on standby.
    On standby only standby redo log files will be used. Not sure what you are trying to do.
    here is example how to create online redo log files, Check that diskgroup is mounted and have sufficient space to create.
    sys@ORCL> select member from v$logfile;
    MEMBER
    C:\ORACLE\ORADATA\ORCL\REDO03.LOG
    C:\ORACLE\ORADATA\ORCL\REDO02.LOG
    C:\ORACLE\ORADATA\ORCL\REDO01.LOG
    sys@ORCL> alter database add logfile group 4 (
      2     'C:\ORACLE\ORADATA\ORCL\redo_g01a.log',
      3     'C:\ORACLE\ORADATA\ORCL\redo_g01b.log',
      4     'C:\ORACLE\ORADATA\ORCL\redo_g01c.log') size 10m;
    Database altered.
    sys@ORCL> select member from v$logfile;
    MEMBER
    C:\ORACLE\ORADATA\ORCL\REDO03.LOG
    C:\ORACLE\ORADATA\ORCL\REDO02.LOG
    C:\ORACLE\ORADATA\ORCL\REDO01.LOG
    C:\ORACLE\ORADATA\ORCL\REDO_G01A.LOG
    C:\ORACLE\ORADATA\ORCL\REDO_G01B.LOG
    C:\ORACLE\ORADATA\ORCL\REDO_G01C.LOG
    6 rows selected.
    sys@ORCL>
    Your profile:-
    888442      
         Newbie
    Handle:      888442
    Status Level:      Newbie
    Registered:      Sep 29, 2011
    Total Posts:      12
    Total Questions:      8 (7 unresolved)
    Close the threads if answered, Keep the forum clean.

  • How do you change the size of a JFrame?

    I have some code using a jframe for an application creating buttons, but i want to also have some graphics in there, and I was wondering if there was a way to change the size of the jframe.

    Use JFrame.setSize().
    Check the JavaDocs for the method signatures.
    Dave

  • ORA-00349: failure obtaining block size

    I am trying to drop and recreate ONLINE redo logs on my STANDB DATABASE (11.1.0.7)., but i am getting the below error.
    On primary, we have done the changes., ie we added new logfile with bigger size and 3 members. When trying to do the same on Standby we are getting this error.
    Our database is in Active DG Read only mode and the oracle version is 11.1.0.7.
    I have deffered the log apply and cancelled the managed recovery, and dg is in manual mode.
    SQL> alter database Add LOGFILE GROUP 1 ('+DT_DG1','+DT_DG2','+DT_DG3') SIZE 1024M;
    alter database Add LOGFILE GROUP 1 ('+DT_DG1','+DT_DG2','+DT_DG3') SIZE 1024M
    ERROR at line 1:
    ORA-00349: failure obtaining block size for '+DT_DG1'

    888442 wrote:
    I am trying to drop and recreate ONLINE redo logs on my STANDB DATABASE (11.1.0.7)., but i am getting the below error.
    On primary, we have done the changes., ie we added new logfile with bigger size and 3 members. When trying to do the same on Standby we are getting this error.
    Our database is in Active DG Read only mode and the oracle version is 11.1.0.7.
    I have deffered the log apply and cancelled the managed recovery, and dg is in manual mode.
    SQL> alter database Add LOGFILE GROUP 4 ('+DT_DG1','+DT_DG2','+DT_DG3') SIZE 1024M;
    alter database Add LOGFILE GROUP 4 ('+DT_DG1','+DT_DG2','+DT_DG3') SIZE 1024M
    ERROR at line 1:
    ORA-00349: failure obtaining block size for '+DT_DG1'First why you are dropping & recreating online redo log files on standby.
    On standby only standby redo log files will be used. Not sure what you are trying to do.
    here is example how to create online redo log files, Check that diskgroup is mounted and have sufficient space to create.
    sys@ORCL> select member from v$logfile;
    MEMBER
    C:\ORACLE\ORADATA\ORCL\REDO03.LOG
    C:\ORACLE\ORADATA\ORCL\REDO02.LOG
    C:\ORACLE\ORADATA\ORCL\REDO01.LOG
    sys@ORCL> alter database add logfile group 4 (
      2     'C:\ORACLE\ORADATA\ORCL\redo_g01a.log',
      3     'C:\ORACLE\ORADATA\ORCL\redo_g01b.log',
      4     'C:\ORACLE\ORADATA\ORCL\redo_g01c.log') size 10m;
    Database altered.
    sys@ORCL> select member from v$logfile;
    MEMBER
    C:\ORACLE\ORADATA\ORCL\REDO03.LOG
    C:\ORACLE\ORADATA\ORCL\REDO02.LOG
    C:\ORACLE\ORADATA\ORCL\REDO01.LOG
    C:\ORACLE\ORADATA\ORCL\REDO_G01A.LOG
    C:\ORACLE\ORADATA\ORCL\REDO_G01B.LOG
    C:\ORACLE\ORADATA\ORCL\REDO_G01C.LOG
    6 rows selected.
    sys@ORCL>
    Your profile:-
    888442      
         Newbie
    Handle:      888442
    Status Level:      Newbie
    Registered:      Sep 29, 2011
    Total Posts:      12
    Total Questions:      8 (7 unresolved)
    Close the threads if answered, Keep the forum clean.

  • How to set the cell size in a JFrame

    Hello. Is there any way of setting the cell size in a JFrame. The reason why I want to set the cell size is that I want to be sure of their location that when I am placing components on the JFrame. So is there any way of setting the cell size beforehand. Also for the following code.
    JFrame frame = new JFrame("Window");
    frame.setSize(100,100);is the size 100 by 100 is he size of the cell?

    smithbrian wrote:
    When I am placing a component on the grid I want to be sure the component is exactly where I place it. In order to do that I would need to know what is the size of the gird and how to change the size of the gird in the JFrame.What grid?? You're assuming that we know much more about your program than we actually do. We actually know zip. Please read this help site which will help you to avoid similar errors in posting questions here. It has helped me in the past: [smart questions|http://www.catb.org/~esr/faqs/smart-questions.html]

  • Setting the size of a tablespace prior to its creation

    Hi guys,
    Oracle version: 10.2.0.x
    OS: Windows 32bit
    I was wondering if there are any 'conditions' in setting the intial size of a tablespace prior to its creation. This is because, one of our customers wants to export and import from one schema into another but set an initial size for a tablespace during its creation and prior to importing data into it, but we have a database wizard tool that creates the accounts/schemas by using the following underlying sql:-
    CRETE TABLESPACE <tbl_name> datafile <path><datafile_name>.dbf SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE 32000M DEFAULT STORAGE (INITIAL 256 NEXT 256K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0) ONLINE;
    Under normal circumstances, what he would do is to use our wizard tool and create an account and then import data from an export dump.
    But he wants to create a tablespace using a SQL something like:-
    CRETE TABLESPACE <tbl_name> datafile <path><datafile_name>.dbf SIZE 2000M AUTOEXTEND ON NEXT 500M MAXSIZE 32000M DEFAULT STORAGE (INITIAL 256 NEXT 256K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0) ONLINE;
    He thinks this should be ok because his export dump would be on size 2GB and would want to import all of that 'at once' i.e. without actually using autoextend feature for the first 2GB.
    Does this make any sense? Do you guys see any difference 'performance-wise' between the 2 create tablespace statements?
    I think the second sql (with size 2000M initially) seems to be a more logical approach but I am not really sure of the implications going down the line performance-wise.
    Any help/input much appreciated!
    Thanks guys

    1) Provide the facility in your tool to change the default size of datafiles and keep autoextend off.You won't believe it...we had this option in a previous version but now it isn't there anymore!
    But why turning off AUTOEXTEND? I mean, our customers are not meant to modify anything in the database other than via using our software, hence we would want our customers to just use the software as it is but have their DBAs monitor the growth of any datafiles etc...
    2) Let your tool do what it is doing and then manually increasing the size of the datafiles and making autoextend off once you have created the tablespace and before doing import. This can be done by your tool or loggin to the database.We could do this, but we don't want our customers to manually finger the database as they are/might not be Oracle-efficient and wouldn't want production systems to crash for the same reason.
    Hence we could just give them the SQL to be replaced with the 'default' one and then create a tablespace via the tool which would create a tablespace with an initial size of 2GB+ and with greater autoextend facility (such as autoextend on 500M) rather than 100M so that there are fewer autoextends.
    Also, in your point 2, are you saying to turn off autoextend only for the import and set it back on by alter tablespace....?
    Thank you.

  • I need to obtain the size of file before the send to server

    Hello,
    I need to obtain the size in bytes the a internal table before the send to server, I use the DESCRIBE sentence but is not allowed me to obtain this value, that sentence I need to use.
    Thanks in advance,
    DL

    If you are on release 620, have a look at class CL_ABAP_MEMORY_UTILITES method GET_MEMORY_SIZE_OF_OBJECT. It will tell you how much memory is allocated and how much is actually used. Here is some sample code:
    TABLES: sflight.
    DATA: isflight TYPE TABLE OF sflight.
    SELECT-OPTIONS: carrid FOR sflight-carrid.
    SELECT * FROM sflight INTO TABLE isflight
            WHERE carrid IN carrid.
    DATA: size1 TYPE abap_msize,
          size2 TYPE abap_msize,
          size3 TYPE abap_msize,
          size4 TYPE abap_msize,
          flag1 TYPE char128,
          size5 TYPE abap_msize,
          size6 TYPE abap_msize,
          flag2 TYPE char128,
          flag3 TYPE char128.
    TRY.
      CALL METHOD cl_abap_memory_utilities=>get_memory_size_of_object
        EXPORTING
          object                     = isflight
        IMPORTING
          bound_size_alloc           = size1
          bound_size_used            = size2
          referenced_size_alloc      = size3
          referenced_size_used       = size4
          is_part_of_non_trivial_szk = flag1
          szk_size_alloc             = size5
          szk_size_used              = size6
          low_mem                    = flag2
          is_in_shared_memory        = flag3.
    ENDTRY.
    WRITE: / 'Size of Bound and Allocated Memory:', size1.
    WRITE: / 'Size of Bound and Used Memory:', size2.
    WRITE: / 'Size of Referenced and Allocated Memory:', size3.
    WRITE: / 'Size of Referenced and Used Memory:', size4.
    WRITE: / 'Strongly Connected Component of Object:', flag1.
    WRITE: / 'Size of Allocated Memory of SCC:', size5.
    WRITE: / 'Size of Used Memory of SCC:', size6.
    WRITE: / 'Flag, whether only bound_size_* are filled due to mem.short.:', flag2.
    WRITE: / 'Flag, whether ONJECT is in the shared memory:', flag3.
    If you aren't on 620 or don't need to be that precise, you might try the following:
    DESCRIBE TABLE isflight LINES size1.
    WRITE: / 'Number of Lines:', size1.
    DATA: wa_sflight LIKE LINE OF isflight.
    DESCRIBE FIELD wa_sflight LENGTH size2 IN BYTE MODE.
    WRITE: / 'Size of one Line:', size2.
    size3 = size1 * size2.
    WRITE: / 'Total Size:', size3.
    Please note that the addition IN BYTE MODE only works in 610 and higher. It isn't neccesary before that release. However it is important to get accurate resuls in an Unicode System.

  • When I copy and paste from illustrator to PS regardless of option choosen the original shape size is lost, instead of true size shape tries to fill entire width. Fix?

    When I copy and paste from illustrator to PS regardless of option chosen the original shape size is lost, instead of true size shape tries to fill entire width. Same happens when using the new library assets.
    Fix?
    Thanks

    Can't always make sense of its effect, but I suspect what your seeing comes under the influence of Photoshop > Preferences > General > Options > Resize Image During Place

  • I am having to restart my iphone 4 prior to making a call otherwise my phone will not call the desired number, any solutions

    I am having to restart my iphone 4 on a regular basis prior to making a call otherwise my phone will not call the desired number, this is an intermittant fault any solutions.

    Hi toddea,
    If you are having issues backing up your iPhone to iTunes on your Windows machine, you may find the troubleshooting steps outlined in the following article helpful:
    iOS: If you can't back up or restore from a backup in iTunes
    http://support.apple.com/kb/ts2529
    Regards,
    - Brenden

  • Swing layout/size problem with JFrame and JApplet.

    I have a class that extends a JFrame, the classes layout is BorderLayout. I then have a class that extend JApplet, this classes layout is GridBagLayout (this class has a JTabbedPane - which contains JPanels). The problem I'm having is no matter how big I make the size of the applet or frame (using setSize), the applet/frame stays the same size - no matter how large I make it.
    Can anyone please help?
    Thanks,
    dosteov

    Here is the basic code:
    Thanks in advance,
    dosteov
    public class EADAdm extends JApplet
    EADAdmFrame theFrame = new EADAdmFrame(this);
         public void init()
              // Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller
    //          symantec.itools.lang.Context.setApplet(this);
              // This line prevents the "Swing: checked access to system event queue" message seen in some browsers.
              getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
              // This code is automatically generated by Visual Cafe when you add
              // components to the visual environment. It instantiates and initializes
              // the components. To modify the code, only use code syntax that matches
              // what Visual Cafe can generate, or Visual Cafe may be unable to back
              // parse your Java file into its visual environment.
              //{{INIT_CONTROLS
              getContentPane().setLayout(new GridBagLayout());
              setEnabled(false);
              getContentPane().setBackground(java.awt.Color.lightGray);
              setSize(800,800);
              getContentPane().add(AdmTab, new com.symantec.itools.awt.GridBagConstraintsD(0,1,2,1,0.5,0.5,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.HORIZONTAL,new Insets(3,12,4,14),120,120));
              AdmTab.setFont(new Font("Dialog", Font.PLAIN, 12));
              titleLbl.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
              titleLbl.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
              titleLbl.setText("EAD Administration");
              getContentPane().add(titleLbl, new com.symantec.itools.awt.GridBagConstraintsD(0,0,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(12,36,0,0),307,15));
              titleLbl.setForeground(java.awt.Color.blue);
              titleLbl.setFont(new Font("Dialog", Font.BOLD, 15));
              exitBtn.setText("Exit EAD Administration");
              exitBtn.setActionCommand("Exit EAD Administration");
              getContentPane().add(exitBtn, new com.symantec.itools.awt.GridBagConstraintsD(0,2,2,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(6,371,10,14),66,8));
              exitBtn.setFont(new Font("Dialog", Font.PLAIN, 12));
         //theFrame.setVisible(false);
         login();
         AdmTab.addTab("Administration", new LogoPanel() );
         userPanel = createUserPanel();
         AdmTab.addTab("Edit Users", userPanel );
         fpoPanel = createFPOPanel();
         AdmTab.addTab("Edit FPO", fpoPanel );
         regulationPanel = createRegulationPanel();
         AdmTab.addTab("Edit Regulations", regulationPanel );
         rolloverPanel = createRolloverPanel();
         AdmTab.addTab("Rollover", rolloverPanel );           
              //{{REGISTER_LISTENERS
         SymMouse aSymMouse = new SymMouse();
              this.addMouseListener(aSymMouse);
              SymAction lSymAction = new SymAction();
              exitBtn.addActionListener(lSymAction);
              SymKey aSymKey = new SymKey();
              this.addKeyListener(aSymKey);
         theFrame.getContentPane().add(this);
    public class EADAdmFrame extends JFrame
    EADAdm theApplet;
    public EADAdmFrame(EADAdm theMainApplet)
              //{{INIT_CONTROLS
         //     theApplet = theMainApplet;
         //     this.getContentPane().add(theApplet);
              getContentPane().setLayout(new BorderLayout(0,0));
              getContentPane().setBackground(java.awt.Color.lightGray);
              setSize(1000,1000);
              setVisible(false);
         theApplet = theMainApplet;
              //{{REGISTER_LISTENERS
              SymWindow aSymWindow = new SymWindow();
              this.addWindowListener(aSymWindow);
              SymComponent aSymComponent = new SymComponent();
              this.addComponentListener(aSymComponent);

  • Possible to Restrict the Max Size of a JFrame?

    I guess that the JFrame is my top level container, within which JTabbedPane is used. I wish to be able to not make the window maximizable. I remember how that could be done in JInternalFrame. When I looked up JInternalFrame, it looks like the boolean value for maximizable is specific to JInternalFrame and not inherited. Is there another way I can do that? When I messed around with setMaximumSize(), it doesn't stop the user from maximizing.
    Also, if I want another container containing various components to obtain user input, which will pop up as a response to a button from the tab, is one container just as good as another, or is there a specific approach which is more friendly to this type of program?
    Anyways, this is the bare bones of my code with all the bells and whistles and extra components cut out, in the event that it matters. ;o
    public class TabTest extends JFrame
         public TabTest()
              JTabbedPane mainPane = new JTabbedPane();
              JPanel layer1PanelE = new JPanel(); 
              JPanel viewNclearPanel = new JPanel();     
              layer1PanelE.add( viewNclearPanel );
              JPanel entryPanel = new JPanel();
              layer1PanelE.add( entryPanel );
              mainPane.addTab( "Tickets", null, layer1PanelE, "Edit new or existing tickets" );
              getContentPane().add( mainPane );
              setSize(850, 600);
              setVisible( true );
         public static void main ( String args[] )
              TabTest tabtest = new TabTest();
              tabtest.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }Ty very much
    -Aerin

    <3 <---- Love

  • How to set a minimum size of a JFrame

    hi freinds,
    i have written a swing application which starts like this ,
    public class workerclass extends JFrame implements ActionListener {
    blah blah blah ..
    now can you please tell me how to set a minimum size for this application once it starts so that user cant minimize it more than that minimum size.....
    when i tried
    setDefaultLookAndFeelDecorated(true);
    it did my job by setting it to a particular size which wasnt minimizable, but this default look and feel looked ugly.
    so i used system look and feel
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    but with this how do i set the minimum size..
    please do help
    and one thing more , like
    in my main Method when i say
    new workerclass().setSize(500,500); or say(100,100) or say(300,300)
    new workerclass().setVisible(true);
    the size (***,***) , doesnt reflect when my application starts, it always starts with some damn fixed size , what can be the issue .
    waiting.........
    Thanks

    how do i set my Jrame to a minimum size so that
    minimizing beyond that can be restrictedThis is what the code is all about
    don't know your code but ..
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class workerclass extends JFrame implements
    ActionListener,ComponentListener {
    public void initcomponenet()
    setJMenuBar();
    pack();
    addComponentListener(this);
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new myclass.setSize(500,500);
    new myclass().setVisible(true);
    public void componentShown(ComponentEvent e)
         public void componentResized(ComponentEvent e)
              if(getWidth()<200)//restrict width to minimum 200
                   setSize(200,getHeight());
    if(getHeight()<100)//restrict Height to minimum
    um 100
                   setSize(getWidth(),100);
         public void componentMoved(ComponentEvent e)
         public void componentHidden(ComponentEvent e)
    Thanks kanad , your code is working ... you desere lot more than a duke dollar but for now i can only give that :-( , please accept it :-)

  • Setting the image size within a JFrame!

    This is the code i have implemented
    import javax.swing.*;
    import java.awt.*;
    class SampleJFrame extends JFrame
         JLabel l1;
         ImageIcon image;
         SampleJFrame()
              image=new ImageIcon("G:/java files1/images/aa.jpg");
              l1=new JLabel("DEDICATION",image,JLabel.RIGHT);
              l1.setSize(100,100);
              //this.setLayout(new FlowLayout(FlowLayout.RIGHT));
              this.add(l1);
    public class JFrame2
         public static void main(String args[])
              SampleJFrame samplejframe=new SampleJFrame();
              samplejframe.setTitle("FRAMES WITH JLABELS WITH IMAGEICON");
              samplejframe.setSize(400,400);
              samplejframe.setVisible(true);
    }When i run this the image occupies the entire JFrame.I want to resize it to a width of around 100,80 pixels.How can i do it?
    I know when i draw a image without linking to a label i can use drawImage of Graphics class to set the size of the image.But in this case i am linking the image to the JLabel and it's occupying the entire screen and the text with the JLabel is thrown somewhere out.

    Read it.Got a lot of info from that.But the trouble with mine is that i am linking the image to the JLabel and thats why i am unable to set its size because the image will be added to the JPanel when i add the JLabel to it?If i was directly printing the image i would have rather used Graphics.drawImage( ) where i can manually specify the width.

  • Cannot set the initial size of nested JFrame in NetBeans 5.5.

    For some background; I'm trying to design a small configurable, multi-market clock for Traders of foreign currency. Several international market times will be displayed and each will change color as that market opens and closes. The user will be able to select specific foreign markets and configure several options such as color and size.
    I was trying to use a JFrame for the initial window and an undecorated JFrame to hold the clocks and their labels. In the GUI builder for the initial JFrame, I dragged a JFrame and dropped it outside the original to add an (other Component). My problem is that I can't set the prefereedSize or the minimumSize properties for the nested JFrame. When I run the program, a button sets the second JFrame visible but at (0,0) size which when undecorated is invisible, and when decorated shows only the Min/Max/Close buttons. Am I just going about this all wrong or is this a bug
    I am running Java Version 1.5.0 (build 1.5.0_08-b03)
    Rick

    I have tried to use several different components but I have not been able to get them to appear as a component, undocked from the main window.
    Another idea that I tried was to have the whole program run from the same frame and then just set the window as undecorated and hide the menu bar. Unfortunately decorated state cannot be changed after it is displayable or packed. Besides that, how do you then make it moveable when there is no title bar? So many questions? Any other suggestions?

Maybe you are looking for

  • Can't transfer music to new computer, please help

    My old computer crashed so I can't connect it to my new one to transfer my songs. I plugged my ipod into the new comp before downloading itunes and I save my playlists onto it in My Music. Then I downloaded itunes and tried to transfer my music into

  • Close popup with branch

    I have created a page with a "New party" button that opens a popup. It clears that cache for the popup and works fine. The new party can be entered and "create"d. The page branches to itself and the create button is not displayed. The new party data

  • Purchase orders and sales documents

    hi what r the transaction codes for purchase orders and sales documents.

  • EPM and EVDRE sorting changed in BPC 10

    We feel that the expand function on base level (BAS) in both EPM and EVDRE have been changed from 7.5 to BPC 10. It is the sorting of members that we feel is wrong. It is not expanding on the order of the dimension but on what hierarchy level order t

  • Undo after flattening image and closing file - Help...

    My friend was working really hard on multiple files - he's been using PS for years - made a mistake by actually saving a psd file that he flattened and then closed the file. Is there anyway to get that back?  His back up and timemachine are not worki