Resizing buttons

Hi all,
I have a text area with a scroll bar.
I want to put two buttons to the right of it. Each button being half the height of the text box so that it makes a nice looking area. Here is my code so far but i can't seem to get the boxes to change size at all. Any help or pointers to the right area in the JDK would be much appreciated.
Cheers
DRB2k2
     Box MainBox        = Box.createVerticalBox();     // Box to hold all the database items
     MainBox.setBorder(new TitledBorder (new EtchedBorder(), "Enter known data"));
     Box TextAndButtons = Box.createHorizontalBox();     // Box to hold text area and buttons
     Box Buttons        = Box.createVerticalBox();     // Box to hold Buttons
     JTextArea InputData = new JTextArea("Enter your known data here");
     InputData.setFont(new Font("Courier", Font.PLAIN, 16));
     InputData.setLineWrap(false);
     InputData.setWrapStyleWord(false);
     JScrollPane InputDataScroll = new JScrollPane(InputData);
     InputDataScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
     InputDataScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
     InputDataScroll.setPreferredSize(new Dimension(250,100));
     TextAndButtons.add(InputDataScroll);
     MakeDataBase = new JButton("Create Database");
     MakeDataBase.setToolTipText("Press here to format your data");
     MakeDataBase.setActionCommand("Submit");
     MakeDataBase.addActionListener(this);
     ClearFields  = new JButton("Clear Data");
     ClearFields.setToolTipText("Press here to clear the data boxes");
     ClearFields.setActionCommand("Clear");
     ClearFields.addActionListener(this);
     ClearFields.setPreferredSize(new Dimension(250,100));
     Buttons.add(MakeDataBase);
     Buttons.add(ClearFields);
     TextAndButtons.add(Buttons);
     Box LoadBox = Box.createHorizontalBox();
     UpLoadData  = new JTextArea("...or enter a file location here");
     UpLoadData.setFont(new Font("Courier", Font.PLAIN, 10));
     UpLoadData.setLineWrap(false);
     UpLoadData.setWrapStyleWord(false);
     LoadDataBase = new JButton("Load");
     LoadDataBase.setToolTipText("Press here once you have entered a file location");
     LoadDataBase.setActionCommand("Load");
     LoadDataBase.addActionListener(this);
     LoadBox.add(UpLoadData);
     LoadBox.add(LoadDataBase);
     MainBox.add(TextAndButtons);
     MainBox.add(LoadBox);In case you can't see why i'm using boxes below is a picture of how I wanted it to look. (GRidbag didn't seem to work either!!)
|__________________________________
| JTextArea InputData|JButton MakeDB|
|                    |--------------|
|                    |JButton Clear |
|------------------------------------
|------------------------------------
|JTextArea InputData |JButton Load  |
|------------------------------------
|
|
|----------------------------------------------------------------------thanks

I'm too smart or too dumb to use GridBag - it's way too complicated. Some combination of Grid and BorderLayout generally makes these things work.
For yours, I'd start with two Panels, one in the Center and one in the South of a BorderLayout. Then use another BorderLayout for the Center panel. Drop the text into that one in the Center, and put the two buttons on a Panel in the East, in a 1x2 grid.
Got the idea?

Similar Messages

  • Close, minimize, resize buttons in top left dissapeared

    Any help MUCH appreciated!!... I cannot seem to figure out how i've lost my close, minimize and resize buttons in top left. IT's only in Illustrator. I have a MacBook Pro..
    Any thoughts???
    Thanks,
    Elena

    Chances are the buttons are merely behind the Control Panel or your'e simply in Full Screen Mode.
    If your document is behind the Control panel, tap the Tab key to hide all panel, then move the document down so it's not behind the control panel.
    If you are in Full Screen Mode, tap the F key on the keyboard until you see the buttons again.

  • When using mail, my resize button and my down arrow on the side schroll bar appear in the same position making use of both impossible.

    A line is missing at the bottom of the screen just above the dock window on my macintosh. Using Mac OS X, version 10.6.7

    I indicated that I have this problem too, or at least a related one, but I wanted to add some details. In my case, using gmail, the resize button actually isn't even visible. But when I try to put the mouse on the line-scroll arrow at bottom right, the cursor changes to the resize cursor, and I can resize from there (with the mouse a good bit above where the resize button should be). So I think it's the same problem reported by this user. As indicated, it's impossible to use the line-scroll button in this mode. I don't seem to have the problem on other web pages, or at least not that I've noticed. I just obtained Firefox 4, so I think I've got an up-to-date copy, and I'm running on Windows XP, SP2. And other than this, I *really* like FF4--that tab organization feature is absolutely stunning in its usefulness. Oh, and, in case it matters, I'm also running the gmail under the "pinned tab" option.

  • Tool was resized, buttons huge and wide???

    My firefox toolbar and navigation buttons appear 10X larger and wider than normal. As do all internet pages I visit! I tried the zoom in/out option, but that only resizes the pages I visit to smaller font they still appear wider than normal. I tried the right clicking the toolbar and customizing, but once again the buttons still stay much too wide, I'm going crazy, everything looks out of whack all stretched out wide!

    Are you using Windows 7 64-bit?
    I ask because maybe Lnvolcd.exe is 32-bit (note the date of July 22, 2009) and will not run properly on a 64-bit OS?

  • Help - Unwanted resizing buttons!

    Hello All:
    I want to have tiled buttons in a JScrollPane where the buttons are always the same size. My problem now is that when the main window is resized smaller, the buttons scale themselves down in order to fit in the JPanel. Since the buttons always resize themselves to fit in the pane the scroll bars never appear.
    How can I get the following code to display fixed sized buttons (with ImageIcons), so that I can scroll through 2 columns and many rows of the same size button?
    package net.nighthawk.iid.viewer;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    public class ImageThumbnailPanel extends JPanel
      private JPanel panel;
      private GridLayout buttonLayout = new GridLayout();
      private int rows = 4;
      private static final int COLS = 1;
      public ImageThumbnailPanel()
        setLayout(new BorderLayout());
        panel = new JPanel();
        buttonLayout.setColumns(COLS);
        buttonLayout.setRows(rows);
        panel.setLayout(buttonLayout);
        ImageIcon anIcon = new ImageIcon("any.jpg");  
        // Here's where the problem is, adding more buttons causes them to resize to fit the pane
        for(int i = 0; i < rows*COLS; i++)
          addButton("hi", anIcon);
        Dimension buttonPanelDimension = new Dimension(300,300);
        // Setting the size of the panel does not fix the problem
        panel.setPreferredSize(buttonPanelDimension);
        panel.setSize(buttonPanelDimension);
        panel.setMaximumSize(buttonPanelDimension);
        panel.setMinimumSize(buttonPanelDimension);
        add(panel, BorderLayout.CENTER);
        //Create the scroll pane and add the table to it
        JScrollPane scrollPane = new JScrollPane();
        //Add the scroll pane to this panel.
        panel.add(scrollPane);
       private void addButton(final String label, ImageIcon icon) // does final work?
          JButton button = new JButton(label, icon);
          button.addActionListener(new
            ActionListener()
              public void actionPerformed(ActionEvent event)
                System.out.println("Button label:>" + label);
          panel.add(button);
      public static void main(String[] args)
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);
        //Create and set up the window.
        JFrame frame = new JFrame("ImageThumbnailPanel");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Create and set up the content pane.
        ImageThumbnailPanel newContentPane = new ImageThumbnailPanel();
        newContentPane.setOpaque(true);
        frame.setContentPane(newContentPane);
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    class ImageThumbnailPanel extends JPanel
      private JPanel panel;
      private GridLayout buttonLayout = new GridLayout();
      private int rows = 9;
      private static final int COLS = 1;
      public ImageThumbnailPanel()
        setLayout(new BorderLayout());
        panel = new JPanel();
        buttonLayout.setColumns(COLS);
        buttonLayout.setRows(rows);
        panel.setLayout(buttonLayout);
        ImageIcon anIcon = new ImageIcon("any.jpg");
        for(int i = 0; i < rows*COLS; i++)
          addButton("hi", anIcon);
        Dimension buttonPanelDimension = new Dimension(300,300);
        panel.setSize(buttonPanelDimension);
        JScrollPane scrollPane = new JScrollPane(panel);
        scrollPane.setPreferredSize(buttonPanelDimension);
        add(scrollPane);
       private void addButton(final String label, ImageIcon icon)
          JButton button = new JButton(label, icon);
          button.addActionListener(new
            ActionListener()
              public void actionPerformed(ActionEvent event)
                System.out.println("Button label:>" + label);
          panel.add(button);
      public static void main(String[] args)
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame frame = new JFrame("ImageThumbnailPanel");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        ImageThumbnailPanel newContentPane = new ImageThumbnailPanel();
        newContentPane.setOpaque(true);
        frame.setContentPane(newContentPane);
        frame.pack();
        frame.setVisible(true);
    }

  • Resizing button Decorator design pattern

    I am having the problem in doing the resizing of a button using the Decorator Design Pattern. Plz anyone who is having idea about this please send me the source code for me. I am having very less time to submit.plese replay me as early as possible

    Ever heard of Google?

  • Resize button in adf

    hi how can i resize the width of my button i like it to be small am in jdeveloper 11g release 2

    hi there is no change my xml is
    ?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document title="sms4500.jspx" id="d1">
    <af:form id="f1">
    <af:panelSplitter orientation="vertical" splitterPosition="336" id="ps1">
    <f:facet name="first">
    <af:panelHeader text=" Document References " id="ph1"
    inlineStyle="text-align:left; vertical-align:middle;">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    <af:panelStretchLayout id="psl1" topHeight="103px" bottomHeight="27px">
    <f:facet name="bottom"/>
    <f:facet name="center"/>
    <f:facet name="start"/>
    <f:facet name="end"/>
    <f:facet name="top">
    <af:panelStretchLayout id="psl2" bottomHeight="15px" topHeight="36px">
    <f:facet name="bottom"/>
    <f:facet name="center"/>
    <f:facet name="start"/>
    <f:facet name="end"/>
    <f:facet name="top">
    *<af:commandButton text="view" id="cb1" inlineStyle="width:20%;"/>* </f:facet>
    </af:panelStretchLayout>
    </f:facet>
    </af:panelStretchLayout>
    </af:panelHeader>
    </f:facet>
    <f:facet name="second">
    <!-- id="af_one_column_header_stretched_with_splitter" -->
    <af:decorativeBox theme="dark" id="db1">
    <f:facet name="center">
    <af:decorativeBox theme="medium" id="db2">
    <f:facet name="center"/>
    </af:decorativeBox>
    </f:facet>
    </af:decorativeBox>
    i what to resize the button not the font size of text in the button,currently the button is so big fiting the whole panel,i what i small
    Edited by: Tshifhiwa on 2012/04/10 12:47 PM

  • Alert with non-standard fontSize doesn't resize buttons

    //Okay, if you set these style changes in place:
    _global.styles.Alert.setStyle("backgroundColor", 0x9BCAE1);
    _global.styles.Alert.setStyle("fontWeight", "bold");
    _global.styles.Alert.setStyle("fontSize", 18);
    _global.styles.Alert.setStyle("color", 0x000000);
    //and then try to create an Alert
    var message:String = "Are you sure you want to clear the
    data from your schedule?";
    var title:String = "Confirm Deletion";
    var options:Number = (Alert.YES | Alert.CANCEL);
    Alert.show(message, title, options, this, clearHandler);
    // The Yes and Cancel buttons are too small for the contained
    text.
    // Is there a way to either make them bigger, or to not have
    the button fonts
    // be affected by the font-size change?
    // Also, anyone know how to change the background color of
    the title bar?

    // try this after style setup
    Alert.buttonHeight = 50;
    Alert.buttonWidth = 100;

  • How to create a custom icon - resizable button

    Hello there,
    i need help about how to change a JButton's icon and make it fit the size of the button.
    Some sample code is very appreciated.
    Thanks

    To change the icon: yourButton.setIcon(yourIcon); // from AbstractButton class The icon itself is fixed in size. If you want to stretch or tile the image to fill the component, you could get the dimesions of the button to fill and then generate the Image data (using a BufferedImage ?) and use that as the icon. Or, you could probably override the paint method of the JButton by creating your own class that extends JButton. I'm sure that there are other ways of doing this.

  • My text resize button on the toolbar is stuck

    Hi, I am using CS4 version and for some reason despite being fine for months my text re-sizing icon (the number with the two little up and down arrows next to it which re-sizes the text point by point), is stuck. So i have to manually type the number in or use the drop down.
    Anyone know why this might have gotten stuck, I wondered if maybe i had pressed something on my keyboard which had cause this to stick.
    Gillian

    Replace your preferences. Adobe InDesign CS4 * Setting preferences

  • Resize and change button-tex​t in example-OI

    Hello,
    i´m currently looking at the example Labview operator-interface which is delivered with TestStand and installed at:
    C:\Programme\National Instruments\TestStand 3.5\OperatorInterfaces\NI\Simple\LabVIEW\TestExec.​llb
    It works without problems, but how can i resize and modify the text on the buttons?
    I attached a copy pf the buttons. Two of them are resizable, the rest not. Why?
    And how cani change the text displayed on the buttons?
    Thanks for your help
    Attachments:
    copy.vi ‏9 KB

    Hello,
    You're buttons are ActiveX controls. I don't know why they are not resizable, it appears that somehow the activeX container resize properties are disabled. i've seen this sometimes with items on the block diagram, but they become resizable again after restarting LabVIEW.
    You could make a copy of the resizable "buttons" and replace the not resizable "buttons" with the copies to go around the problem.
    Kind regards,
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Resize the column grab button

    Does anybody know if it's possible to move the column resize button (grab bar) from the bottom to the top of the finder window? This would streamline navigation in the Finder when dragging to resize view.
    Best illustrated than put in words.

    Yes, I'm wondering too!

  • Safari window not resizing

    I am running Safari 5.1.9 on OS X 10.6.8.  For the last few days, Safari windows always open at exactly the same size, and there is nothing I can do to resize them.
    The resize button in the bottom right corner doesn't respond.  The green maximise button on the top left doesn't do anything.
    I have tried:
    * restarting
    * forcing Safari to open links in a new window
    * emptying Safari's cache
    * resetting Safari
    * trashing Safari's preferences
    * turning off all plugins
    * trashing com.apple.windowserver.plist
    * starting Safari in 32-bit mode
    * beating my head slowly against the screen
    This seems to be a problem only with one user.  When I switch to another user, Safari behaves itself very well.
    My system software is up to date.
    Any ideas?

    Try deleting the cache this way. Might make a difference.
    In the effected account, open a Finder window. From the menu bar top of your screen click Go > Go to Folder
    Type of copy paste the following:
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari and try resizing the window.

  • How do i resize photo attachment in icloud mail

    How do I resize photo attachment in icloud mail. The resize button does not appear as it did  before.

    Using iCloud mail online via a browser does not offer the option to resize the photo.  It's only available when emailing from iPhoto so iPhoto can do the resizing as it adds the image to the email.  Safari or whatever browser you're using doesn't have that capability.
    OT

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

Maybe you are looking for

  • Can send but can't receive email through ATT POP account

    My ISP is ATT. Email is through a POP account. I've verified all the settings through the ATT support page and been on the phone with an ATT Mac (dubious) tech. I'm able to send but not receive email. I get no errors when I check mail. It just appear

  • CHANGE THE GROUP FOR VENDOR

    Hello Sir, I have already create business partner for OTHERS group and also I mention Account Payable as Creditors for OTHERS. Now I have to change these control account into Creditor for Fixed Asset account. For Example In Creditors for Others accou

  • Web applet report parameters

    Hi, I have created a report and exposed it in a web applet under account. Account id is beeing passed as parameter to the web applet as input to the report using P1,P2 etc. I want to add one more paramtere to the web applet to pass one more filter cr

  • Error when installing sapccmsr agent on standalone database server

    Hi All, I am setting up standalone ccms agent (sapccmsr) on a database server on a windows platform. I am following SAP note: 371023 - OS07 ST06 - Monitoring operating system data and also refering to ADM107 documentation. I have created csmconf file

  • I cannot download a statement from my bank.

    When I try to download the statement from my bank, I get this error message: /Users/XXXX/Downloads/pdfStatementBody-1.jsp could not be opened, because an unknown error occurred. Try saving to disk first and then opening the file. I can't save it to d