JFrame resizing problem......

Hi All,
can anyone guide me how to stop resizing or dragging the JFrame.
my frame should not be movable or resizable by the user.
Urgent!!
Regards
sd

Have you tried frameObj.setResizable(false)?
Phani

Similar Messages

  • Undecorated jframe resize problem

    i created a custom jframe look by setting a jframe to undecorated and designing my own maximize/minimize/close buttons and other things to improve its appearence
    the problem is that when set to undercorated all the default resizing/move methods are gone
    i tried implementing my own resize methods, they seem to work but it flashes like crazy while resizing
    anyone have any idea how to stop all the flashing or a better way to implement this?
    the following is a small example of the problem i am having, i only implemented the north resize part so the code can be easier to read.
    thnx in advance
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.imageio.*;
    import java.io.*;
    import java.awt.image.BufferedImage;
    public class TestFrame extends JFrame implements MouseMotionListener, MouseListener
         Point sp;
         int     compStartHeight;
         int minHeight = 100;
         JPanel frameContent = new JPanel();
         public TestFrame()
              super("testing frame");
              setSize(600, 600);
              setContentPane(frameContent);
              frameContent.setBackground(Color.black);
              frameContent.setLayout(new BoxLayout(frameContent, BoxLayout.Y_AXIS));     
              setUndecorated(true);
              addMouseMotionListener(this);
              addMouseListener(this);
              JButton testButton = new JButton("TEST");
              JButton testButton2 = new JButton ("TEST2");
              frameContent.add(testButton);
              frameContent.add(Box.createVerticalGlue());
              frameContent.add(testButton2);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
         public void mouseMoved(MouseEvent e)
              Point p = e.getPoint();
              if (p.y > e.getComponent().getSize().height - 5)
                   setCursor( Cursor.getPredefinedCursor( Cursor.N_RESIZE_CURSOR ));
              else
                   setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR));
         public void mouseDragged(MouseEvent e)
              Point p = e.getPoint();
              int compWidth = getSize().width;
              if (getCursor().getType() == Cursor.N_RESIZE_CURSOR)
                   int nextHeight = compStartHeight+p.y-sp.y;
                   if (nextHeight > minHeight)
                        setSize(compWidth,nextHeight);
                        validate();
              else
                   int x = getX()+p.x-sp.x;     
                   int y = getY()+p.y-sp.y;     
                   setLocation(x,y);
         public void mousePressed(MouseEvent e)
              sp = e.getPoint();
              compStartHeight = getSize().height;
         public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
              if (sp == null)
                   setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR));
        public void mouseClicked(MouseEvent e)
        public void mouseReleased(MouseEvent e)
              sp = null;
         public static void main(String[] args)
         new TestFrame();
    }

    I doubt there is a faster / easier way to resize.
    Have you tried adding
    public boolean isDoubleBuffered()
      return true;
    }To over-ride Component.isDoubleBuffered. This should sort out your flickering problem.
    Bamkin

  • How to resize the components in a JFrame when the JFrame Resizes?

    Hi all,
    i have some problems with my app. I have set the JFrame resizable and that works fine for the JFrame but not for the components in the JFrame.
    So my question is how can i set the components in a JFrame to resize automatically when the JFrame resizes?
    Here are the important things from my code,...if you need more, just let me know, its my first post in a forum .
    Its a JFrame with a JTabbedPane and on the Tabs are Panels with buttons and Tables.
    Thank you in advance!
    public class MainMonitor extends JFrame {
    public MainMonitor() {
              super();
              initialize();
              setVisible(true);
         private void initialize() {
              this.setSize(1145, 785);
              this.setIconImage(Toolkit.getDefaultToolkit().getImage("Images/c.gif"));
              this.setContentPane(getJContentPane());
              this.setTitle("Company Manager");
              this.setResizable(true);
              this.setLocationRelativeTo(null);
         private JPanel getJContentPane() {
              if (jContentPane == null) {
                   jContentPane = new JPanel();
                   jContentPane.setLayout(null);
                   jContentPane.setOpaque(true);
                   jContentPane.add(getJTabbedPane(), null);
                   jContentPane.add(getJPanel11(), null);
              return jContentPane;
         private JTabbedPane getJTabbedPane() {
              if (jTabbedPane == null) {
                   jTabbedPane = new JTabbedPane();
                   jTabbedPane.setLocation(new Point(6, 69));
                   jTabbedPane.setSize(new Dimension(1120, 684));
                   jTabbedPane.addTab("P", null, getJPanel(), null);
                   jTabbedPane.addTab("K", null, getJPanel1(), null);
                   jTabbedPane.addTab("B", null, getJPanel2(), null);
              return jTabbedPane;
         

    Giasaste wrote:
    Thanks a lot, i didnt knew that the Layout Manager is a must.It's not a must, but it is the way to allow your app to be resized nicely and makes it much easier to maintain and enhance your program. Imagine creating a complex gui then later decide that you want another radiobutton and to remove a jlabel / jtextfield pair. with layout managers a chore becomes easy.

  • Resizing Image when JFrame resized?

    I have a JFrame with a JPanel added to the contentPane (BorderLayout.CENTER). In the JPanel is a JLabel (BorderLayout.CENTER) with an ImageIcon set to it. The image is a subimage of a larger image whose width is scaled to fit the current JLabel width (which is dictated by the JPanel width and finally dictated by the JFrame width).
    When the user resizes the JFrame, the image of the ImageIcon should be replaced with a new image which has been scaled to fit the new width and that reflects the new portion of the larger source image that is visible.
    The JFrame already has a ComponentListener added for retaining the current JFrame size and screen position, but calling my resizeDisplay() method from componentResized() does not seem to have the updated JLabel size. I have added a ComponentListener to the JLabel and called my resizeDisplay() method from componentResized() but it does not seem to have the updated JLabel size either.
    How can my application properly react to JFrame resizes so that the method is retrieving the new size values?
    Thanks,
    Robert Templeton

    Its always easier to solve a problem when sample code (not a complete program) is posted with the question.
    Maybe I don't understand the question, but when I run the following code the output reflects the size of the label after it has been resized. I'm using JDK1.3 on Window 98.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class TestLabel extends JFrame
         public TestLabel()
              JPanel panel = new JPanel();
              setContentPane( panel );
              panel.setPreferredSize( new Dimension( 200, 200 ) );
              panel.setLayout(new BorderLayout() );
              final JLabel myLabel = new JLabel( new ImageIcon("dukeWaveRed.gif"), JLabel.CENTER );
              panel.add( myLabel );
              myLabel.addComponentListener( new ComponentAdapter()
                   public void componentResized(ComponentEvent e)
                        System.out.println( myLabel.getSize() );
         public static void main(String[] args)
              TestLabel frame = new TestLabel();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    }

  • [SOLVED] GNOME 3.8 annoying window resize problem

    Hello all fellow early-adopters :-)
    A very annoying quirk I've noticed, moving from GNOME 3.6 to 3.8, is that it no longer remembers, nor retains, the size/positions I set for many of my application windows. For example, my mail client (Evolution) is sized to fill most of my screen (centrally), with Empathy and Skype as long narrow windows on both sides - giving me a nice, broad "communications" overview on that particular desktop (with dev tools etc open on others).
    On 3.6, this layout was retained during my session, as well as next time I started these apps up.
    In GNOME 3.8, not only does it insist that these windows are always started as small little bunched-up windows that I need to resize, but every time a window displays a notification/warning (message in internal yellow bar inside the window - such as loss of internet connection, mail retrieval failure etc) it resizes the windows spontaneously to a stupid, small size that overlays the other windows. This is driving me crazy!
    Where can I learn a bit more about how window sizing / positioning works in GNOME 3.8, or is it finally time to switch to awesome wm? I want to love GNOME 3.8, I really do. It's so slick, but so... unpolished.
    I want to dig in an assist with problems like these, but I need some pointers to some background material first to understand the problem. Is it the window manager? Is it the app?
    ** UPDATE: Doing a full system upgrade, as of May 18, 2013, has resolved this annoying problem. My windows now stay where they belong, and start with the same size they were closed with. GNOME is now pleasant to use again :-)
    Last edited by dawid.loubser (2013-05-21 13:37:25)

    dawid.loubser wrote:Thanks for the suggestion drtebi - I'll give it a try.
    I really like GNOME 3.x though (and would like to understand the windowing behaviour), but if the annoying quirks are insurmountable, I will happily switch.
    Man I love GNOME 3.x. I admire the courage they had to change, basically, everything, and I find myself more productive with my GNOME 3 Arch box than with my good ol' Slackware KDE 4 box. I just hate those bugs - for example I filed a task in their bugtracker for this window resize problem I have with gedit. If it's a love/hate relationship, I think it's marriage ^_^
    With the 3.8 upgrade, deadbeef was having a similar problem with window size/position. I just recompiled it against the latest GTK+3 package upgrade (that came after the 'big upgrade' here on Arch) and it was fixed. But not with gedit
    bwat47 wrote:
    Man I really hope this gets fixed soon, because aside from this one incredibly annoying issue I am loving gnome 3.8.
    I get the feeling gnome badly needs more beta testers, sizable regressions like this in "stable" releases happen way too often sad.
    I get the exact same feeling. Well bugs exist everywhere, there's no denying. But I think it would be wiser to 'alternate' the nature of each major stable release - one focusing on new features and one focusing on fixing bugs. For example if the only new features in GNOME 3.10 were the AppsFolder full implementation and the introduction of gnome-calendar, and the rest of the development cicle being devoted to fix bugs, I'd be more than happy.
    Like Fedora and Ubuntu, the fixed 6-month release cycle colaborates with the bugs. They don't do like Debian or Slackware which are released 'when they are ready'.
    EDIT: fout (yet) another bug. At least with facebook chat (haven't tested with other telepathy plugins) the buddy tray icon appear duplicate. Anybody with the same issue?
    Last edited by lmello (2013-05-02 14:06:06)

  • Implementing JFrame Resizing Rules?

    Recently I've needed to enforce rules on a JFrame's dimensions (for example: preserving an aspect ratio).
    The obvious solution is to call setSize() from ComponentListener's componentResize() method. This is functional, but looking at the Java source, it's pretty inelegant. It actually starts a setSize() -> componentResized() -> setSize() loop that only terminates when setSize() is called with dimensions matching the current dimensions (see Component.reshape()). Also, its visually ugly because when maximized you can see the window snap back to the "fixed" size.
    It would seem that a more elegant way to add this functionality would be to have a method like "public Dimension checkDimensions(Dimension)" available for overriding.
    Does something like this already exist that I've missed?
    I've tried following the source, but I can't find the place where JFrame resizing is handled.

    The optimal solution would be to use a Look&Feel which doesn't have to use the OS window decorations, so the resize events are only generated in Java (not optimal in the fact that you don't get to have the OS frame decorations of course). Then you should be able to add your own RootPaneUI which simple doesn't allow resizing beyond a maximum size or auto resizing respecting an aspect ratio.
    See JFrame#isDefaultLookAndFeelDecorated and (for example) MetalRootPaneUI#MouseInputHandler. Perhaps there are thrid party look and feel where you can more easily replace a similar handler.

  • Preview Application Resizing Problem

    Preview Application Resizing Problem
    Microsoft platforms have two significant advantages. The first is the concept of an operating system that can function with hardware that ranges from cellular phones to desktop computers. The second is that Microsoft has excellent software development tools
    for creating and testing computer programs.
    Software compatibility across hardware platforms requires not only meeting CPU and memory requirements. Application programs must be able to automatically adjust Window and control sizes to meet the needs of available window sizes, video display unit sizes
    and screen resolutions, switching between vertical and horizontal viewing, vertical and horizontal scrolling, changes in font sizes , and variations in the available screen space due to usage of vertical and horizontal toolbars.
     Software developers must be careful that resizing doesn’t squeeze controls too close together or make them so small that they cannot be finger or stylus selected when used with touch screens.
    Some of the required automatic resizing options are provided by the Microsoft software compilers and the Windows operating system.  Softgroup Component’s “.NET  Forms Resize” is an example of one of the third party applications that provide advanced
    resizing functionality.
    Many of the resizing functions are programmer options and, if not properly enabled, an application may not have the required resizing functionality. At the current state of the art, application programs are highly variable in their capability to do the “intelligent
    resizing” that is required to handle different display environments.
    A case in point is the Microsoft Preview Application for Windows 10. When entering lengthy comments, the send button becomes positioned off the end of the program window. It is possible to scroll to the button, but the display automatically resets when scroll
    is released. The result is that the text cannot be sent. You can try a "blind" TAB to the SEND button. This appeared to work after several tries, but the comment was apparently not received,
    RERThird

    Hi,
    What do you see when you open the same PDF file in Acrobat Reader? Are the words still squeezed than?
    Dimaxum

  • JFrame resize dynamically in response to content pane size changes

    Hi -
    I have a JFrame that uses CardLayout. The CardLayout panel content is of varied dimensions. it means the JComponents added to CardPanel will change size dynamically.
    Is it possible to have the JFrame resize dynamically in response to the content of the CardLayout panel changing?

    camickr wrote:
    No, the preferred size of a panel using a CardLayout is the preferred size of the largest component added to it.
    As a user I think it would be terrible to have the frame resize every time a turn a page to go to the next card. I have never seen this any any application.
    If you really need this functionality, then manage the panels yourself. Remove the existing Component before adding the next component and then do a frame.pack().My Application will be a JFrame.
    inside this JFrame i want to have three JPanels. according to some events and logic my GUI should switch to a given JPanel from those three panels. as i said the Jpanels sizes will change size on runtime depending on a automatic swing JPanel generation and i will have to add the new generated JPanel to parent JFrame with its new size
    any Ideas how to achive this ?

  • Illustrator Resizing Problems

    I am having reduction resizing problems in Illustrator CS6.  E.G. Straws & lemon wedge rinds become significantly proportionately wider when reduced.   Also, numerical text does not skew with everything else.  I have a CC membership w/PS & Ai installed.  There are no other Adobe items on my 8 month old imac, Lion 10.7.4 except Flash player & the Adobe Applications Manager.  Additionally, I have no 3rd party plug-ins & deleting the prefs file does not fix the problem.  Any help on this matter would be greatly appreciated. 

    sgem,
    And untick Align to Pixel Grid if ticked (you can do it in the Transform panel, or search for it in the Helpfile).
    Hi Steve. Still summer?

  • During the JFrame resize, unable to call mylogic.How to know JFrame rezing?

    {font:Arial}{size:10pt}Hi
    In my project i came across an issue. In that I had a JFrame (with FlowLayout) added with 24 JButtons (Its appearence will be similar as JToolbar). On this JFrame i called pack(). When i try to resize the JFrame, its componentResize() listener will not be called every time, instead it is calling only when its resizing complete.
    I am looking for a solution, that will rearrange JButtons (as specified Column/Row wise) during the JFrame resize. Can any body help me why componentResize() is not calling, during the resize. Tell me all alternate solutions. Pls help me.
    Waiting for your reply
    {size}{font}

    Can any body help me why componentResize() is not calling, during the resizeBecause its not very efficient to layout the frame every time you move the mouse 1 pixel. So by default this behaviour is turned off. I think you can turn in on by adding the following at the start of your program:
    Toolkit.getDefaultToolkit().setDynamicLayout(true);

  • DV resize problem with QuickTime's iPod 320 x 240 export

    Just a heads up for those with new 5th generation iPods who plan on converting their DV movies for display on the iPod. It seems that the iPod 320 x 240 export does not resize DV correctly. Here is a link concerning this problem:
    Waymen, "Possible resize problem with iPod 320 x 240 Export?" #1, 03:02am Oct 13, 2005 CDT

    This article show a workaround to have DV export correctly in QuickTime Pro
    http://docs.info.apple.com/article.html?artnum=302955

  • Problem with JFrame resizing at runtime

    Hi All,
    I have a problem with resizing the JFrame at runtime. Even if i resize the JPanel. It is not affection on all the components over the frame. How can i solve that I am using AbsoluteLayout(jre1.6) and here i am going to provide you code snippet. My requirement is to resizt the form. If form is small in size then all the component should also be according tothe size of the form.
    public void initComponents(int size) {
    if(size >= 50) {
    x_co_or = 300;
    y_co_or = 300;
    } else if(size < 50) {
    x_co_or = 200;
    y_co_or = 200;
    jPanel1 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    jButton1.setText("jButton1");
    jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 40, 110, 40));
    getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, x_co_or, y_co_or));
    pack();
    Can anybody suggest any idea/solution.
    Any idea/solution are most welcome.
    Regards,
    Pradeep Dubey

    How can i solve that I am using AbsoluteLayout(jre1.6)
    and here i am going to provide you code snippet.no need for the snippet, you're using absolute positioning, which means you're responsible for location and size on every single change.
    start coding now, take about a week, or you could use a layout manager, take maybe, 5 minutes

  • JViewport Resize problem -- Urgent!

    I am trying to make a program that allows the user to dynamically resize a scrollable JPanel. I have added resize buttons that work well. The JScrollPane works well, but when the JViewport's View is set to the bottom right corner of the JPanel, and the user attempts to resize the JPanel, the JViewport repaints its view to the top left corner, hence undoing any resizing. Resizing should not change the View, even if the component is no longer visible in the view.
    Here is a code example (please pardon the length and lack of comments):
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    public class JViewportBug extends JPanel implements Scrollable, ComponentListener
         public JViewportBug()
              this.setLayout( null );
         public Dimension getPreferredScrollableViewportSize()
              return getPreferredSize();
         public boolean getScrollableTracksViewportHeight()
              return false;
         public boolean getScrollableTracksViewportWidth()
              return false;
         public int getScrollableBlockIncrement( Rectangle visibleRect, int orientation, int direction )
              if( orientation == SwingConstants.VERTICAL )
                   return (int)( visibleRect.getHeight() * 9 / 10 );
              return (int)( visibleRect.getWidth() * 9 / 10 );
         public int getScrollableUnitIncrement( Rectangle visibleRect, int orientation, int direction )
              return 5;
         public void componentHidden(ComponentEvent e)
         public void componentMoved(ComponentEvent e)
         public void componentResized(ComponentEvent e)
              Dimension size = ( (Component)e.getSource() ).getSize();
              this.setBounds( 0, 0, 20 + size.width, 20 + size.height );
              this.setPreferredSize( new Dimension( 20 + size.width, 20 + size.height ) );
         public void componentShown(ComponentEvent e)
         public static void main( String[] args )
              JViewportBug bug = new JViewportBug();
              JFrame frame = new JFrame( "JViewport Bug" );
              frame.setExtendedState( JFrame.MAXIMIZED_BOTH );
              JScrollPane jsp = new JScrollPane( bug );
              JPanel viewable = new JPanel();
              bug.add( viewable );
              viewable.addComponentListener( bug );
              viewable.setBounds( 10, 10, 200, 200 );
              JDesktopPane jdp = new JDesktopPane();
              jdp.setLayout( null );
              for( int i = 0; i < 8; i++ )
                   ResizeButton rb = new ResizeButton( viewable, i, true );
                   bug.add( rb );
                   viewable.addComponentListener( rb );
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              viewable.setBackground( Color.white );
              frame.getContentPane().add( jdp, BorderLayout.CENTER );
              JInternalFrame jif = new JInternalFrame( "", true, true, true, true );
              jif.getContentPane().add( jsp );
              jdp.add( jif );
              jif.setSize( 500, 500 );
              bug.setPreferredSize( new Dimension( viewable.getWidth() + 20, viewable.getHeight() + 20 ) );
              jif.setVisible( true );
              frame.setVisible( true );
    class ResizeButton extends JComponent implements MouseMotionListener, MouseListener, ComponentListener
         public static final int NW_RESIZE_BUTTON = 0;
         public static final int N_RESIZE_BUTTON = 1;
         public static final int NE_RESIZE_BUTTON = 2;
         public static final int E_RESIZE_BUTTON = 3;
         public static final int SE_RESIZE_BUTTON = 4;
         public static final int S_RESIZE_BUTTON = 5;
         public static final int SW_RESIZE_BUTTON = 6;
         public static final int W_RESIZE_BUTTON = 7;
         JComponent resize;
         int buttonType;
         boolean enabled;
         public ResizeButton( JComponent aComponent, int type, boolean isEnabled )
              resize = aComponent;
              buttonType = type;
              setBounds();
              enabled = isEnabled;
              this.addMouseMotionListener( this );
              this.addMouseListener( this );
         public int getType()
              return buttonType;
         public void mouseEntered( MouseEvent e )
              if( enabled )
                   switch( ( (ResizeButton)e.getSource() ).getType() )
                        case 0:
                             getParent().setCursor( new Cursor( Cursor.NW_RESIZE_CURSOR ) );
                             break;
                        case 1:
                             getParent().setCursor( new Cursor( Cursor.N_RESIZE_CURSOR ) );
                             break;
                        case 2:
                             getParent().setCursor( new Cursor( Cursor.NE_RESIZE_CURSOR ) );
                             break;
                        case 3:
                             getParent().setCursor( new Cursor( Cursor.E_RESIZE_CURSOR ) );
                             break;
                        case 4:
                             getParent().setCursor( new Cursor( Cursor.SE_RESIZE_CURSOR ) );
                             break;
                        case 5:
                             getParent().setCursor( new Cursor( Cursor.S_RESIZE_CURSOR ) );
                             break;
                        case 6:
                             getParent().setCursor( new Cursor( Cursor.SW_RESIZE_CURSOR ) );
                             break;
                        case 7:
                             getParent().setCursor( new Cursor( Cursor.W_RESIZE_CURSOR ) );
         public void mouseExited( MouseEvent e )
              if( enabled )
                   getParent().setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
         public void mouseClicked( MouseEvent e )
         public void mousePressed( MouseEvent e )
         public void mouseReleased( MouseEvent e )
         public void mouseMoved( MouseEvent e )
         public void mouseDragged( MouseEvent e )
              if( enabled && e.getSource() instanceof ResizeButton )
                   int clickedX = e.getX();
                   int clickedY = e.getY();
                   int width, height;
                   switch( ( (ResizeButton)e.getSource() ).getType() )
                        case NW_RESIZE_BUTTON:
                             width = resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? resize.getX() - this.getX() - clickedX + resize.getWidth() : 1;
                             height = ( resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? resize.getY() - this.getY() - clickedY + resize.getHeight() : 1 );
                             resize.setBounds( resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? this.getX() + clickedX : resize.getX() + resize.getWidth() - 1,
                                                           resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? this.getY() + clickedY : resize.getY() + resize.getHeight() - 1,
                                                           width,
                                                           height );
                             break;
                        case N_RESIZE_BUTTON:
                             height = resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? resize.getY() - this.getY() - clickedY + resize.getHeight() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? this.getY() + clickedY : resize.getY() + resize.getHeight() - 1,
                                                           resize.getWidth(),
                                                           height );
                             break;
                        case NE_RESIZE_BUTTON:
                             width = this.getX() + clickedX - resize.getX() > 1 ? this.getX() + clickedX - resize.getX() : 1;
                             height = resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? resize.getY() - this.getY() - clickedY + resize.getHeight() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? this.getY() + clickedY : resize.getY() + resize.getHeight() - 1,
                                                           width,
                                                           height );
                             break;
                        case E_RESIZE_BUTTON:
                             width = this.getX() + clickedX - resize.getX() > 1 ? this.getX() + clickedX - resize.getX() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY(),
                                                           width,
                                                           resize.getHeight() );
                             break;
                        case SE_RESIZE_BUTTON:
                             width = this.getX() + clickedX - resize.getX() > 1 ? this.getX() + clickedX - resize.getX() : 1;
                             height = this.getY() + clickedY - resize.getY() > 1 ? this.getY() + clickedY - resize.getY() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY(),
                                                           width,
                                                           height );
                             break;
                        case S_RESIZE_BUTTON:
                             height = this.getY() + clickedY - resize.getY() > 1 ? this.getY() + clickedY - resize.getY() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY(),
                                                           resize.getWidth(),
                                                           height );
                             break;
                        case SW_RESIZE_BUTTON:
                             width = resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? resize.getX() - this.getX() - clickedX + resize.getWidth() : 1;
                             height = this.getY() + clickedY - resize.getY() > 1 ? this.getY() + clickedY - resize.getY() : 1;
                             resize.setBounds( resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? this.getX() + clickedX : resize.getX() + resize.getWidth() - 1,
                                                           resize.getY(),
                                                           width,
                                                           height );
                             break;
                        case W_RESIZE_BUTTON:
                             width = resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? resize.getX() - this.getX() - clickedX + resize.getWidth() : 1;
                             resize.setBounds( resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? this.getX() + clickedX : resize.getX() + resize.getWidth() - 1,
                                                           resize.getY(),
                                                           width,
                                                           resize.getHeight() );
         public void setBounds()
              switch( buttonType )
                   case NW_RESIZE_BUTTON:
                        this.setBounds( resize.getX() - 5,
                                                 resize.getY() - 5,
                                                 5,
                                                 5 );
                        break;
                   case N_RESIZE_BUTTON:
                        this.setBounds( (int)( ( resize.getWidth() + 2 * resize.getX() ) / 2 ) - 2,
                                                 resize.getY() - 5,
                                                 5,
                                                 5 );
                        break;
                   case NE_RESIZE_BUTTON:
                        this.setBounds( resize.getWidth() + resize.getX(),
                                                 resize.getY() - 5,
                                                 5,
                                                 5 );
                        break;
                   case E_RESIZE_BUTTON:
                        this.setBounds( resize.getWidth() + resize.getX(),
                                                 (int)( ( resize.getHeight() + 2 * resize.getY() ) / 2 ) - 2,
                                                 5,
                                                 5 );
                        break;
                   case SE_RESIZE_BUTTON:
                        this.setBounds( resize.getWidth() + resize.getX(),
                                                 resize.getHeight() + resize.getY(),
                                                 5,
                                                 5 );
                        break;
                   case S_RESIZE_BUTTON:
                        this.setBounds( (int)( ( resize.getWidth() + 2 * resize.getX() ) / 2 ) - 2,
                                                 resize.getHeight() + resize.getY(),
                                                 5,
                                                 5 );
                        break;
                   case SW_RESIZE_BUTTON:
                        this.setBounds( resize.getX() - 5,
                                                 resize.getHeight() + resize.getY(),
                                                 5,
                                                 5 );
                        break;
                   case W_RESIZE_BUTTON:
                        this.setBounds( resize.getX() - 5,
                                                 (int)( ( resize.getHeight() + 2 * resize.getY() ) / 2 ) - 2,
                                                 5,
                                                 5 );
         public void componentHidden(ComponentEvent e)
         public void componentMoved(ComponentEvent e)
         public void componentResized(ComponentEvent e)
              this.setBounds();
         public void componentShown(ComponentEvent e)
         public void setEnabled( boolean enable )
              enabled = enable;
         public boolean isEnabled()
              return enabled;
         public void paint( Graphics g )
              ( (Graphics2D)g ).fillRect( 0, 0, 5, 5 );
    }

    Hi bbritta,
    Thanks for the time. I guess the setLocation MIGHT be off, tho ideally, it should place the tv somewhere near the right bottom corner of the screen.
    The basic requirement I have is in the code written. This is what I want. When I start my application, I want the small tv screen only to appear, with the two colored panels (that shall obviously contain some other code). When my mouse hovers on this small screen, the buttons should appear in a panel just below the small screen. So I have used a JLayered pane that displays two separate gifs, one for the small screen, and one for the buttons panel. On the small screen gif, I have added two panels to layer 1, and on the button panel gif, I have added 3 buttons.
    What is happening is that if I set the frame size to the size of the small screen at startup (before show()), then on mouse hover, the frame size increases, but the layered pane size stays the same, and hence i cannot see the button panel. But if I start out with the button panel showing (frame size initially set to the larger value), then on mouse exit, the button panel disappears, and reappears properly on mouse enter. But I don't want to set the original size to the larger value, since only the small screen must be seen first.
    Did I make my self clear? The whole problem is that on mouse hover, u cannot see the button panel, till u change the setSize() code in initializeFrame() to use c_o_FULL_TV_SIZE instead of c_o_TV_SIZE. That u cannot see the buttons IS my problem!
    Thanks,
    Shefali.

  • Resizing problem

    Hello!
    I have a JFrame that contains some components I would rather didn't shrink below a minimum size, which I have specified using setMinimumSize. Everything works fine if I have te following line in my code:         JFrame.setDefaultLookAndFeelDecorated(true);If I remove it, though, in order to use the native look and feel, I have found the minimum size gets ignored completely. Currently, I am using a ComponentListener that watches for resizes and corrects them, however the results aren't very pretty.
    So my question is this: is there any better workaround to this problem, such as watching for (and ignoring) mouse clicks on the border of the Jframe?
    Many thanks in advance!

    It's very stupid if you answer a question and find
    then that it has been answered hours ago.I meant: It's stupid (annoying) for me if
    I answer a question and find then that it has
    been answered hours ago.
    I have not referred the "stupid" to you.
    Don't want anyone here to feel offended.Even if you are stupid.

  • JFrame resizing

    Hi,
    I have a JFrame, it displays on the right upper corner the icons minimize, maximize and exit.
    Minimize and Exit icons are working fine.
    I have the problem with the maximize button.
    The application I am writing allows to resize the JFrame. Thats fine!
    If I run the application, it has an initial size w=800, h=600
    If I click the maximize button, the JFrame fits to the window maximal size.
    But if I click the maximize button again, I want to have the initial size. This does not work.
    It keeps the maximal size.
    How can I switch
    - between maximal size and "initial" size
    or
    - between maximal size and last set size (so the size before Jframe was maximized)
    if I click the maximize button.
    Thanks
    A.

    Hi,
    I found the issue and fixed it.
    The issue is the following code.
    If I run the application, I call this function, it works fine.
    What it does is, it just horizontal center the window.
      public static void centerWindow(Window window) {
          Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
          int x = (int)((screen.width - window.getSize().width) / 2);
          int y = 0;
          window.setLocation(x, y);
      }If I run this function later on again after resizing the window, it causes the issue.
    So if I resize the window, I don't call this function anymore.
    Thanks
    A.

Maybe you are looking for

  • Not able to clear customer through EBS FF.5

    Hi, I am trying to clear a customer invoice through the MT940 file upload by ff.5. But it is not able to pick up the invoice and ending in error stating "the difference is too large for clearing" Below is my EBS config below is the external transacti

  • Tablespace threshold check

    Hi all, my env.. Oracle 8i solaris I am trying to check tablespace threshold chek ..below query ...this query is not working in oracle 8i ...but it is working fine in oracle 10g machines ... what is the reason I was unable to findout... Please let me

  • Parse a string to remove character

    Hi, Can you please help. I have a string like "1a" or "12c". Is there a way I can parse this to remove the character values, leaving "1" and "12" Many Thanks

  • How to graph the counter frequency

    Hello, does anyone know how to make a graph from a frequency signal that comes from a counter? It seems that I first need to convert the frequency signal (scalar) into a waveform type. I do not know how do this. Any suggestions for me? As a basis I u

  • Storing data with executable JAR

    if I have an executable JAR that needs to read and write from a text file so that users can customize the program, can I put the text file or any kind of database inside the JAR or does it have to go outside. Also, what is the best way to store such