Stop From Resizing a Frame

Which method to use, to stop some one from resizing a frame??
No maximizing or resizing of the frane.

setResizable(boolean resizable)
http://java.sun.com/j2se/1.3/docs/api/

Similar Messages

  • How to stop a cluster constant typedef from resizing when the typedef is changed?

    Using LabVIEW 7.1...
    I've been using cluster typedefs to make make constants on the block diagram.  I usually resize them so they are nearly the size of a few characters.  When the typedef is updated the constant expands to full size.  Usually I can just resize it again but if the constant is inside a structure things get rather messy.  To stop the structures from resizing I've been leaving the constants outside of them.  Is there any way to stop the resizing?  I've ensured that autosize is set to None for both the typedef and the constant on the block diagram.

    I found the NI example that makes tst point.
    In the "Palette API" (that was developed by an NI Developer and recently posted to the LV Zone) shows how sub-VI's can be used to fix the "auto-explode" diagram issue.
    See image below.
    BTW: It also lets you document the data through the documention of the sub-VI.
    Ben
    Message Edited by Ben on 06-13-2007 03:12 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    NI_Example.PNG ‏33 KB

  • Stop flash site from resizing to viewers browser

    Hi peoples
    I just wanted to know how to stop my flash site from resizing to the size of whoevers looking at its browser? I just want it to remain as it's set size.
    Any help would be great

    In the HTML section of the Publish Settings window, set your Dimensions: option to "Match Movie" and the Scale option to "Default (Show all)". This will keep the .swf at its original size regardless of the size of the html document that contains it.

  • Stop JTextField resizing?

    I have a textfield which i have as not editable, and it is populated by a file browser (loads the file path into the text field) however if the file path is longer than the text field is wide, then the field simply resizes itself and becomes wider than the frame it is in.
    How do i stop it from resizing?

    agehoops wrote:
    Well, in the process of making the SSCCE it works, but not on my main project, only the SSCCE and the only thing different between the two is the L&F being used. Could that affect it?What happened when you changed the L&F being used in the main app.?

  • How do I loop back from the first frame to the last frame?

    Hi there,
    I'm currently working on the framework for a product viewer.
    I have:
    a movie clip called 'viewer_mc' which contains the images take from different angles of the product. The actionscript generates a script on the last frame of this that returns it to frame 1.
    a button instance called 'autoplay_btn' which plays through the movie clip from whatever the current frame is, and stops on frame 1.
    a left and right button which serve to move the movie clip frame, to give the appearance that the product is rotating.
    I have succeeded in getting it to:
    have the movie clip play through once, return to frame 1 and stop.
    have the buttons return functions when held down, that move the frame in the movie clip using nextFrame and prevFrame commands. The right button successfully loops round to frame 1 and continues functioning to give the appearance of continual rotation.
    The last problem I am experiencing is getting the left button to act in the corresponding manner, going from the first frame to the last and continuing to function.
    Here is my actionscript so far:
    import flash.events.MouseEvent;
    var lastFrame:Number = viewer_mc.totalFrames;
    var thisFrame:Number = viewer_mc.currentFrame;
    var backFrame:Number = viewer_mc.currentFrame-1;
    1. This is the part that gets it to play through once before returning to the first frame. I think perhaps the problem I am experiencing is because of the 'viewer_mc.addFrameScript(lastFrame-1, toStart)' part i.e. although I'm holding the left button, its returning to this script and therefor getting bounced back immediately to the first frame. However, there is no flicker on the screen which you might expect if this were the case
    Note - as this is a generic product viewer which I can use as a template I am using lastFrame etc. as opposed to typing the value in
    function toStart (){
              viewer_mc.gotoAndStop(1);
    viewer_mc.addFrameScript(lastFrame-1, toStart);
    2. This is the functionality for the autoplay_btn that will play through a rotation / return the viewer to the initial (frontal) view of the product (frame 1).
    autoplay_btn.addEventListener(MouseEvent.MOUSE_DOWN, autoplay);
    function autoplay (ev:MouseEvent):void{
              var startFrame:Number = viewer_mc.currentFrame;
              viewer_mc.gotoAndPlay(startFrame);
    3. This is the functionality of the right button, which when held, moves the movie clip to the next frame via the 'rotateRight' function based on the 'nextFrame' command. It loops back round to the first frame due to the 'viewer_mc.addFrameScript(lastFrame-1, toStart)' script generated on the last frame of the movie clip, as is desired.
    right_btn.addEventListener(MouseEvent.MOUSE_DOWN, rightDown);
    function rightDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stoprightDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateRight); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stoprightDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateRight);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stoprightDown); //remove the listener for mouse up
    function rotateRight(e:Event):void {
        viewer_mc.nextFrame();
    4. This is the functionality of the left button, which when held, moves the movie clip to the prev frame via the 'rotateRight' function based on the 'prevFrame' command. And this is where the problem lies, as although it works for getting the movieclip back to frame 1, it does not loop round to the last frame and continue functioning, as is wanted.
    left_btn.addEventListener(MouseEvent.MOUSE_DOWN, leftDown);
    function leftDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stopleftDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateLeft); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stopleftDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateLeft);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stopleftDown); //remove the listener for mouse up
    I'd imagine it is probably my logic for this part that is really letting me down - I can do a similar function in actionscript 2, but am trying to learn actionscript 3 just to move with the times as it were, and struggling a bit. Still this is only a few days in!
    function rotateLeft(e:Event):void{
              if(thisFrame==1){
                        gotoAndStop(viewer_mc.totalFrames-1);
              } else{
              viewer_mc.prevFrame();
    Any help you can give me would be gratefully received. For an example of the effect I am trying to achieve with the autoplay button etc. I recommend:
    http://www.fender.com/basses/precision-bass/american-standard-precision-bass

    Thanks for getting back to me.
    Here's the code without my comments / explanations:
    import flash.events.MouseEvent;
    import flash.events.Event;
    var lastFrame:Number = viewer_mc.totalFrames;
    var thisFrame:Number = viewer_mc.currentFrame;
    var backFrame:Number = viewer_mc.currentFrame-1;
    function toStart (){
              viewer_mc.gotoAndStop(1);
    viewer_mc.addFrameScript(lastFrame-1, toStart);
    //last image of viewer_mc = first image of viewer_mc
    autoplay_btn.addEventListener(MouseEvent.MOUSE_DOWN, autoplay);
    function autoplay (ev:MouseEvent):void{
              var startFrame:Number = viewer_mc.currentFrame;
              viewer_mc.gotoAndPlay(startFrame);
    right_btn.addEventListener(MouseEvent.MOUSE_DOWN, rightDown);
    function rightDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stoprightDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateRight); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stoprightDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateRight);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stoprightDown); //remove the listener for mouse up
    function rotateRight(e:Event):void {
        viewer_mc.nextFrame();
    left_btn.addEventListener(MouseEvent.MOUSE_DOWN, leftDown);
    function leftDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stopleftDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateLeft);//while the mouse is down, run the tick function once every frame as per the project frame rate
    function stopleftDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateLeft);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stopleftDown); //remove the listener for mouse up
    function rotateLeft(e:Event):void{
              viewer_mc.prevFrame();
    The definition of the rotateLeft function is where the problem lies I think - I've taken out my poor attempts at doing the logic from the previous post. If I were to write it out long-hand the statement I want to write is: 'If you get to frame 1 and function rotateLeft is called go to the end of the movie clip'.
    The reason I have to use the viewer_mc.totalFrames-1 definition in the addFrameScript call is the addFrameScript function is 0 based i.e. if you want to call frame 1 of the movieclip you have to return a value of 0 in the addFrameScript (or such is my understanding of it anyway). As such, the last image in the movie clip will need to be the view obtained at 360 degree rotation, which is of course the same view as at 0 degree rotation. As a consequence, the last frame in the movie clip is superfluous for the user, but necessary for the overall effect to be achieved. And, in addition, to keep up the effect of a 360 degree view when the rotateLeft function is called it needs to skip that last frame to go to the lastFrame-1 (or totalframes-1), or in other words, the view of the image prior to completing the full 360 rotation.
    the variables thisFrame and lastFrame are defined at the very top of the script. Like you said they might need to be defined or called on again elsewhere.

  • Movie after playing doesn't stop at the last frame.

    Movie after playing doesn't stop at the last frame but goes back to frame one. Movie stops normaly when played on iMac but makes trouble when placed in the iBooks Author. That's not eve problem of looping (repeat none). Help, this makes me mad.

    laura4life
    You have fragments (leftovers) beyond the end of the Timeline content that you intended.
    I am going from an Elements Windows workspace, so please translate into Mac accordingly.
    Expand your Timeline content to the maximum with the Zoom Out Zoom In slider above the Timeline.
    Press the End key of the computer keyboard. That should take the Timeline Indicator to the fragments which must be deleted.
    Explore all the tracks in that area.
    Repeat the End key press until the Timeline Indicator stops at the end of the intended Timeline and not some 3 hours afterward.
    What you find at "end of track" could be fragments or files that you moved out of the way of the active project and forgot were there.
    The fragments typically present as thin vertical black lines scattered about the tracks.
    Please let us know the outcome.
    Thank you.
    ATR

  • Help setPreferredSize and resizing a frame

    Hey,
    I have an internal JFrame that contains a JPanel which contains an image. The JPanel is the only compnent of the internal JFrame and must take up the whole of the space in the frame. The image must take up the whole of the Jpanel.
    At the moment the image is drawn in the paint component part of the JPanel:
         // draw the racing track
         g.drawImage(track, 0, 0, imageWidth, imageHeight, this);
    I set the preferred size of the JPanel so that the JFrame fits exactly around the image. This is to avoid clipping that would occur if i set the frame to the size of the image. This is implemented in the constructor of the JPanel :
    // track is the image i am trying to draw
         imageWidth = track.getWidth(this);
         imageHeight = track.getHeight(this);
         setPreferredSize(new Dimension(imageWidth, imageHeight));
    In the JInternalFrame I extend I call the pack() method; I believe this is what sets the frame to the right size so that no clipping occurs.
    This works fine; the image currently appears with no clipping. However now I want to resize the internal frame. When this happens I want the image to be resized so that it can appear larger or smaller but it must maintain its original proportions.
    I have the following event listener in place in the class that creates all of the internal frames :
    tFrame.addComponentListener(new ComponentAdapter() {
    public void componentResized(ComponentEvent evt) {
    tFrameComponentResized(evt);
    private void tFrameComponentResized(ComponentEvent evt) {
         trackWidth = tFrame.getWidth();
         trackHeight = tFrame.getHeight();
    I am not sure how to continue from here. Any help would be greatly appreciated!!
    Thanks Guys (and gals!)
    Alex.

    I have no idea if this is what you were looking for :import javax.swing.*;
    import java.awt.*;
    import java.awt.geom.AffineTransform;
    import java.net.URL;
    import java.net.MalformedURLException;
    public class ResizableImage extends JPanel {
         private Image theImage;
         public ResizableImage(Image anImage) {
              if (anImage.getWidth(null) == 0) throw new IllegalArgumentException("Image's width is null");
              if (anImage.getHeight(null) == 0) throw new IllegalArgumentException("Image's height is nul");
              theImage = anImage;
         public Dimension getPreferredSize() {
              return new Dimension(theImage.getWidth(null), theImage.getHeight(null));
         protected void paintComponent(Graphics g) {
              super.paintComponents(g);
              Graphics2D g2D = (Graphics2D)g;
              Dimension available = getSize();
              if (available.width * available.height == 0) return;
              Dimension image = new Dimension(theImage.getWidth(null), theImage.getHeight(null));
              if (image.width * image.height == 0) return;
              if (image.equals(available)) {
                   g2D.drawImage(theImage, 0, 0, null);
                   return;
              double scale;
              if (available.height * image.width < available.width * image.height) {
                   scale = (double)available.height / (double)image.height;
              } else {
                   scale = (double)available.width / (double)image.width;
              g2D.drawImage(theImage, AffineTransform.getScaleInstance(scale, scale), null);
         public static void main(String[] args) {
              try {
                   final JFrame frame = new JFrame("Resizable image");
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   URL imageUrl = new URL("http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/images/Bird.gif");
                   frame.setContentPane(new ResizableImage(new ImageIcon(imageUrl).getImage()));
                   SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                             frame.pack();
                             frame.show();
              } catch (MalformedURLException e) {
                   e.printStackTrace();
    }

  • How to privent the users from resizing/maximizing/minimizing the mdi window

    In http://forms.pjc.bean.over-blog.com/60-index.html i read about 'A JavaBean to handle the Forms applet's frames' .
    In formsframe.java It is written that the author is Francois Degrelle so i want to ask Francois: My goal is to privent the users from resizing/maximizing/minimizing the mdi window. I have jre 1.6.0_10 which jar file do I need formsframes5.jar or formsframes.jar (those files are in formsframes.zip)
    thanks

    lidochca wrote:
    Hello, please help me to solve the problem !!Key Loggers, Spyware. The solution is not to write such reprehensible crap.

  • How can I perform a "jump" or a "goto" from a sequence frame to a previous one?

    At a point of my program, I need to jump from a sequence frame to a previous one. How can I do it?
    Thank you.

    Hi
    That is not possible! You cannot jump from one frame to another frame. A workaround is to replace a sequence structure with a case structure insight a while loop. When you wire the iteration terminal of the loop to the selector terminal of the case structure you have a "sequence structure" with the advantage to stop it in each frame. Returning to your question: Work with a state machine approach! For that you need a case structure insight a while loop with a shift register! So you can always say what the next frame must be.See under the VI templates for an example! => National Instruments\Labview\templates\state machine.vit
    Regards,
    Luca

  • Can I resize video frame?

    I have the Canon Vixia HF R400, which is lovely. But the video frame is very wide and thin. Is there a way to resize the frame so that it's more square-ish, and less long, thin cinematic rectangle?

    Hi Heatherelena,
    The shape of the recorded video is a by-product of the aspect ratio (the size of the width and the size of the height) of the movie.  This ratio cannot be changed from 16:9.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • My itunes tv starts and stops like a freeze frame.  How do I fix it

    My itunes TV show starts and stops like a freeze frame.  how do I fix it?

    This forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the general iTunes forums.
    When you repost, be sure to post details - your computer model, operating system, and iTunes version - so that people have information on which to base suggestions.
    Regards.

  • Text disappearing from CS4 text frame.

    I work in a studio environment with multiple computers/users sharing files from the same server. Occassionally when I (or another user) opens an InDesign CS4 file there will be text missing from one or more text frames. The frame is still there, but it is empty. If I close the file without saving and then re-open it, the text may re-appear in that frame, but text may be missing from a different frame, or no text will be missing at all – seemingly a completely random occurrance. We have tried to resolve whether this happens with missing/conflicting fonts, but there seems to be no correlation. The problem is not repeatable, but happens at least once a month. We cannot narrow down any ther common denominators within the files.
    We run Mac Pros and iMacs, OS X 10.5.8 or later, InDesign Creative Suite 4, Suitcase Fusion 2 and we are running a Windows Server (sorry, no other details on that).
    Any help or suggestions would be appreciated.

    Thanks for the advice, folks.
    I have hidden text enabled and there is nothing in the frame. These are standalone frames – not linked to any other frames, so it wouldn’t seem to be a re-flow issue. My gut is telling me that it’s font-related, as we have MANY font conflicts between computers, however the issue sometimes occurs without the “Missing Fonts” alert appearing upon opening.
    Suitcase Fusion 2… Unfortunately that may be the culprit. Yet another reason to not like that product, unfortunately. I will research that line of reasoning and report back.

  • Is there a way to stop table resizing? 

    Is there a way to prevent Dreamweaver from resizing tables
    automatically, even after you've told it that you want the table to
    be only, say, 800 pixels wide? Currently, if you make a mistake and
    you paste a long URL in a table, it resizes the table, rather than
    just cutting it off or otherwise prompting you about what it
    intends to do. Likewise, if you insert a graphic that's too big for
    the table, rather than just cropping the graphic and letting you
    know you need to make adjustments, it screws up the table
    permanently. Likewise, anytime you insert anything in a column, it
    resizes all the other columns, even if what you inserted fits
    perfectly and does not require resizing. Lately, the only thing I
    use Dreamweaver for is editing HTML. I find that, because of its
    automated "features" that screw everything up and make it
    impossible to fix, it's actually faster in the long run, to write
    the code by hand and avoid the Design mode like the plague. It's
    like throwing a firecracker into your HTML. Here's to hoping
    someone can tell me how to make Dreamweaver tables behave.

    Nope. The closest you can get is border-spacing, but it's
    poorly supported.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "crash" <[email protected]> wrote in message
    news:[email protected]...
    > can't you set that with margins? I'm kinda wincing when
    I say that,
    > but.....unless you're using borders, in which padding
    would work, margins
    > *might* do the trick.
    >
    > sounds like a hack, though, even if it works. i bet it'd
    break under
    > stress...
    >
    > good call..
    >
    > "Murray *ACE*" <[email protected]>
    wrote in message
    > news:[email protected]...
    >> Cellspacing is one....
    >>
    >> --
    >> Murray --- ICQ 71997575
    >> Adobe Community Expert
    >> (If you *MUST* email me, don't LAUGH when you do
    so!)
    >> ==================
    >>
    http://www.dreamweavermx-templates.com
    - Template Triage!
    >>
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >>
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >>
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    >> ==================
    >>
    >>
    >> "crash" <[email protected]> wrote in
    message
    >> news:[email protected]...
    >>> IMO, it sure is.
    >>>
    >>> I don't think there's an attribute you can set
    in a table in HTML that
    >>> you can't set via CSS, and in several cases
    there's more.
    >>>
    >>> I did a quick workup not long ago as an example
    for somebody at work. I
    >>> had no problem controlling the tables with CSS,
    and by doing that I
    >>> allowed myself to develop new looks for the site
    by just editing one
    >>> file and changing the CSS link. (or re-naming my
    other files).
    >>>
    >>>
    http://cdcdigital.com/two/index-table.php
    >>>
    >>> HTH,
    >>>
    >>> Jon
    >>>
    >>> BTW - I *did* see a wdith=100 in there when I
    was just checking, so
    >>> please forgive any other mistakes.
    >>> "Alan Smithee Jr." <[email protected]>
    wrote in message
    >>> news:[email protected]...
    >>>>> yup, CSS. ;o)
    >>>>
    >>>>
    >>>> Thanks for that informative reply. :.)
    >>>>
    >>>> But seriously...Yes, CSS is ANOTHER way but
    why is it a SUPERIOR way?
    >>>>
    >>>
    >>>
    >>
    >>
    >
    >

  • [AS] Applescript - Duplicate paragraph from one text frame to end of second text frame?

    Working in InDesign CS5
    Still banging my head against the wall over this last bit of code I need to figure out to finish a much larger script. What I'm looking to do is take a paragraph ('contents' from looping in larger script) from one text frame and duplicate it to the END of a second text frame (represented by 'Ad_Box'). The only thing I've gotten to semi-work is this:
    set insertion point -1 of Ad_Box to contents
    The problems with the above script are:
    1. Minor problem (can be worked around in InDesign CS5) - The script does not keep the formatting from the original paragraph that I want duplicated. The paragraph style of all "inserted" paragraphs is set to default
    2. The big problem - When the second text frame is too small for a particular word in original paragraph, the paragraph is moved to the wrong position in the text frame when the script completes, which is moving 4 paragraphs in total (this one baffles me). In other words, if I'm running script to be p1, p2, p3, p4 and p2 had a word too long to fit in text frame, on completion it will look like p1, p3, p4, p2.
    This is why I'm hoping to use the DUPLICATE command in some capacity, but I'm stumped. I set up a dialogue prompt to help me debug, and whenever I use the DUPLICATE command my script skips right over the dialogue, so I know it's not reading properly. This is what I've tried with no luck. Any help would be greatly appreciated.
      duplicate contents to insertion point -1 of Ad_Box

    Mary, you were absolutely correct!! This fixes the problem of placing the contents into the wrong spot, AND it runs the script much faster too! Thank you.
    However it is still not carrying over my "applied paragraph style" that is on "contents". Does 'insertion point' not work this way?
    What looks like is happening is that in the InDesign app, whatever my default selected paragraph style is is what the insertion point type is placing as.
    I might try to set my applied paragraph style after the "last insertion point" call and see if that works. I'll update this reporting results

  • Panel doesn't display properly until I resize the frame

    Hiya folks,
    I'm currently trying to write a simple piece of music notation software. This is my first time using swing beyond a relatively simple JApplet and some dialog stuff. Anywho, I ran into a pretty discouraging issue early on. So far I've got a frame with a menu bar and a toolbar on the bottom border. The toolbar contains a button which should draw a new staff panel containing 11 panels (potentially more) within it, alternating between lines and spaces. Sort of like this:
    import javax.swing.*;
    import java.awt.*;
    public class Staff extends JPanel {
       private static JPanel nsp1,nsp3,nsp5,nsp7,nsp9,nsp11;
       private static JPanel nsp2,nsp4,nsp6,nsp8,nsp10;
       private ImageIcon image= new ImageIcon(this.getClass().getResource( "icons/treble clef.gif"));
        public Staff(){
        setLayout(new GridLayout(11,1));
        add(nsp1= new NoteSpace());
        add(nsp2= new LineSpace());
        add(nsp3= new NoteSpace());
        add(nsp4= new LineSpace());
        add(nsp5= new NoteSpace());
        add(nsp6= new LineSpace());
        add(nsp7= new NoteSpace());
        add(nsp8= new LineSpace());
        add(nsp9= new NoteSpace());
        add(nsp10= new LineSpace());
        add(nsp11= new NoteSpace());
    static class NoteSpace extends JPanel{
        public NoteSpace(){
        setPreferredSize(new Dimension(this.getWidth(),2));
    static class LineSpace extends JPanel{
          public LineSpace(){
          setPreferredSize(new Dimension(this.getWidth(),1));
          public void paint(Graphics g) {
              super.paint(g);
              g.drawLine(0, (int) super.getHeight()/2, (int)super.getWidth(), (int)super.getHeight()/2);
    }Anyway, this panel displays as a tiny box wherein nothing is visible until I resize the frame. Really frustrating. And I have have no idea what the problem might be. Here's the actionlistener:
    jbtcleff.addActionListener(new ActionListener (){
            public void actionPerformed (ActionEvent e){
                staff.setBounds(50,panel.getHeight()/2,panel.getWidth()-50,panel.getHeight()/2);
                panel.add(staff);
                staff.repaint();
            });...which is located in a custom jtoolbar class within the Main class, an extension of JFrame:
    public class Main extends JFrame{
       JMenuBar jmb=new CustomMenuBar();
       JToolBar jtb= new CustomToolBars("ToolBar");
       static boolean isStaff=false;
       static boolean isNote=false;
       static JPanel panel = new JPanel();
       private static Staff staff= new Staff();
        private static Toolkit toolkit= Toolkit.getDefaultToolkit();
       private static Image image=toolkit.getImage("C:/Users/tim/Documents/NetBeansProjects/ISP/src/MusicGUI/icons/treble clef.jpg");
        private static Cursor noteCursor = toolkit.createCustomCursor(image,new Point(0,0),"Image"); 
       public Main (String m) {   
            super(m);
            setJMenuBar(jmb);    
            getContentPane().add(jtb,BorderLayout.SOUTH);       
            panel.setLayout(new CardLayout(60,60));
            getContentPane().add(panel);
    public static void main (String[]args){
            JFrame frame= new Main("Music");
            frame.setSize(800,400);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
            frame.setIconImage(image);
           Sorry for all the code. I'm desperate.
    Thanks!

    Oh my... have you been through the Swing tutorial?
    Let's look at some of your code,
    static class NoteSpace extends JPanel{
        public NoteSpace(){
        setPreferredSize(new Dimension(this.getWidth(),2));
    static class LineSpace extends JPanel{
          public LineSpace(){
          setPreferredSize(new Dimension(this.getWidth(),1));
          public void paint(Graphics g) {
              super.paint(g);
              g.drawLine(0, (int) super.getHeight()/2, (int)super.getWidth(), (int)super.getHeight()/2);
    }Here, NoteSpace and LineSpace are being set to a preferred size of 0x2 pixels, and 0x1 pixels respectfully. If you want them at 0 width, how do you expect them to show? In particular, NoteSpace isn't doing anything special. It's just a panel. Why an inner class? Lastly you should not override paint() for SWING. That's AWT stuff. For Swing, you override paintComponent(Graphics g) .
    Then we have this
    jbtcleff.addActionListener(new ActionListener (){
            public void actionPerformed (ActionEvent e){
                staff.setBounds(50,panel.getHeight()/2,panel.getWidth()-50,panel.getHeight()/2);
                panel.add(staff);
                staff.repaint();
            });I'm not sure what the variable jbtcleff is, but it seems you are adding your Staff panel to "panel" every time a button is pressed.... why? Why not just add it once (outside the action listener) and be done with it. Your panel object has a CardLayout, so I assume you meant to create a new+ staff panel everytime a button is pressed, and then add it to the card layout panel. Even so, setBounds(...) does not seem pertinant to this goal. (In fact, in most situtations the use of setBounds(...) is the antithesis of using layout managers).
    The problem you mentioned though seems to be related to the use of a JPanel (your Staff class) that adds zero-width compontents to a grid array.

Maybe you are looking for

  • Intermittent 400 Bad Request - Invalid Verb SharePont 2010

    Hey, This is a long shot that someone has seen this or maybe can give some hints on finding the problem. We are getting a rare (once per day) 400 Bad Request - Invalid Verb error in SharePoint 2010 during a POST - this has happened when adding a List

  • Multiple channels in.......multiple channels out

    Hello All I have attached a zip file which containe some vi's. The vi's are downloadable from a manufacturers webiste to aid in the use of their products. see here:  http://www.phidgets.com/products.php?category=0&product_id=1018_2 The vi(s) are used

  • Upgrading my Safari vers 5.1.10

    I'm currently using MAC OS X 10.6.8 on my 4-year-old MB Pro. I need to upgrade.  Should I upgrade to Yosemite?  If I can go with Yosemite, are there known problems with older systems??  Also, I thought my op system was automatically upgrading, but it

  • Itunes window too large after upgrade!

    After upgrading to itunes 8.2, the the itunes window opens so that the bottom of it is below the bottom of my display. I can't get to the "handle" on the bottom corner to make it smaller, and I can't get to any commands on the bottom of the screen (c

  • Network Connection Timed Out When Buying Something From iTunes

    I've been on iTunes 10 for a while, not sure how long but before October I'm sure, and had no problems with it until last night. I tried to download an album and got the message "We Could Not Complete Your iTunes Store Request. The network connection