Canvas and JScrollPane

Hi,
I have a GUI which has textboxes and buttons on one side and a canvas on the other. I have implemented a scrollpane onto the canvas, so I can scroll graphics. I have added the canvas to the scrollpane but when I compile, the screen only shows the scrolling canvas, the buttons etc have disappeared. The canvas is set in an XYLayout, is their a setpreferredlocation so the canvas is drawn in the write place once added to the scrollpane.
can anyone help.
thanks

One question, you're posting in Project swing, but reading your post, it seems your not using swing at all. Did you use swing? if no, well you should have a look at classes such as javax.swing.JScrollPane. If yes, well, why do you make your own JScrollPane-like class since it already exist. If your using awt, you should have posted this message in another forum, but then again, you could have used java.awt.ScrollPane.
So I will rather answer by another question: Why do you implement your own scrollpane?
Note: maybe I should have read "I use a scrollpane" instead of "I have implemented a scrollpane".

Similar Messages

  • Very basic problem with a Canvas and JScrollPane

    Ok, I'm making this software, with a lot of graphics, and as usual I start all classes alone to see them work and then I put them together in one nice JFrame with MenuBar and so on... but something strange (to me) happened when I made a JScrollPane with some of the Canvas because I couldn't make them for 1024x768 because of its contents.... so I add this JScrollPane to the TabbedPane as a new tab, so I have in my JFrame: the menubar, the tabbedpane and the canvas with a vertical scrollbar in the right, BUT, when I scroll down, the Canvas starts to scroll over the tabbedpane and the menubar!
    very wierd to me, I know one must try to not use scrollbars, but I really need this to work this way!
    thanks!!
    help!!
    Message was edited by:
    Reinaldo_Matte

    Ok, I'm making this software, with a lot of graphics,
    and as usual I start all classes alone to see them
    work and then I put them together in one nice JFrame
    with MenuBar and so on... but something strange (to
    me) happened when I made a JScrollPane with some of
    the Canvas because I couldn't make them for 1024x768
    because of its contents.... so I add this JScrollPane
    to the TabbedPane as a new tab, so I have in my
    JFrame: the menubar, the tabbedpane and the canvas
    with a vertical scrollbar in the right, BUT, when I
    scroll down, the Canvas starts to scroll over the
    tabbedpane and the menubar!
    very wierd to me, I know one must try to not use
    scrollbars, but I really need this to work this way!
    thanks!!
    help!!Don't mix heavyweight(AWT) components such as Canvas, with lightweight (Swing) components.
    See:
    http://java.sun.com/products/jfc/tsc/articles/mixing/
    and
    http://java.sun.com/products/jfc/tsc/articles/painting/index.html

  • MouseDragged on canvas, and JScrollPane

    Hi,
    I have created a canvas which appear transparent in front of the JScrollPane.
    How to make the ScrollBar in JScrollPane scrolling down while the mouse is drag on the canvas?
    Here is my code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.geom.*;
    public class Try extends JFrame{
         JPanel all = new JPanel(new BorderLayout());
         JPanel main = new JPanel(new BorderLayout());
         DisplayCanvas canvas;
         JScrollPane scroll;
         JButton btn1;
         public Try(){
              super("Trying");
              setResizable(false);
              canvas = new DisplayCanvas();
              scroll = new JScrollPane(new JLabel(new ImageIcon("contain.jpg")));
              scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
              scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
              main.add(scroll);
              canvas.setOpaque(false);
              all.add(main,BorderLayout.CENTER);
              all.setBounds(55,82,240,319);
              setContentPane(new JLabel(new ImageIcon("myBorder.gif")));
              getContentPane().add(canvas);
              getContentPane().add(all);
              addWindowListener(new WindowEventHandler());
              pack();
              setVisible(true);
              class WindowEventHandler extends WindowAdapter{
                   public void windowClosing(WindowEvent e){
                        System.exit(0);
              public static void main(String args[]){
                   new Try();
    class DisplayCanvas extends JPanel{
         BufferedImage bi;
         AffineTransform at;
         double x;
         DisplayCanvas(){
              setBounds(55,105,239,295);
              addMouseMotionListener(new MouseMotionHandler());
              Image image = getToolkit().getImage("line.gif");
              MediaTracker mt = new MediaTracker(this);
              mt.addImage(image,1);
              try{
                   mt.waitForAll();
              }catch (Exception e){
                   System.out.println("Exception while loading image.");
              if(image.getWidth(this)==-1){
                   System.out.println("Make sure image line.jpg is in the same directory");
                   System.exit(0);
              bi = new BufferedImage(image.getWidth(this),image.getHeight(this),BufferedImage.TYPE_INT_ARGB);
              Graphics2D big = bi.createGraphics();
              big.drawImage(image,0,0,this);
              at = new AffineTransform();
              at.translate(getWidth()/2, getHeight()/2);
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              Graphics2D g2D = (Graphics2D)g;
              AffineTransform saveXform = g2D.getTransform();
              at.rotate(Math.toRadians(x));
              AffineTransform toCenterAt = new AffineTransform();
              toCenterAt.concatenate(at);
              toCenterAt.translate(-(getWidth()/2),-(getHeight()/2));
              g2D.transform(toCenterAt);
              g2D.drawImage(bi,150,200,this);
              g2D.setTransform(saveXform);
         class MouseMotionHandler extends MouseMotionAdapter{
              public void mouseDragged(MouseEvent e){
                   x = 5;
                   repaint();
    }

    Already answered here:
    http://forum.java.sun.com/thread.jspa?threadID=5148607

  • Adding Canvas to JScrollPane

    I'm trying to add a Canvas to a JScrollPane, but it always seems to show the ENTIRE canvas instead of just a scrollable portion of it.
    I've read about and tried examples using methods such as 'setPreferredSize' for both the scroll pane and it's container (I'm using a JPanel), but neither of these seem to stop the canvas from showing at full size.
    I've also tried 'scrollPane.setViewportView(myCanvas)', but this doesn't work either.
    Any ideas anyone?? I'm really stuck on this.

    Canvas is a heavy component and JScrollPane is a light component. A heavy component always paint on top a light component.
    The better is using only Swing's components or only AWT's components. Mixing have some problems
    Hope this help.

  • Canvas and viewer won't display video correctly

    I have just reinstalled and then reinstalled 5.1.4. Picture plays on external video monitor but will not play in either canvas or viewer. RGB is set. Mirror on playback is set. Audio will play. Viewer will play on external monitor. Usually a still will be on viewer of canvas screen or just a jumbled mess. Sometimes with parts of display frame included in mess. Thanks for any help.

    Thanks for posting helpful info re my problem. Issue finally resolved. FYI in case you should encounter a similar problem. I failed to mention in my post I was running two video displays. The video card I was running on when I developed the problem had been my auxilary display and was too underpowered to run the canvas and viewer. I inadvertaintly switched final cut pro to that card and monitor when my previous main monitor quit. I simultaneously had a drive boot problem. All is well that ends well, I suppose. Only took 4 days to sort it out and could find no info in tech manual that would have led me to this.

  • FCP 7, viewer clear, but canvas and export blurry

    Started with screen recordings provided to me that made using quicktime 10
    took quicktime 10 screen recordings and converted them to prores422 HQ in compressor (settings from compressor below)
    imported into FCP 7.
    They look great in viewer, reasonably sharp and crisp, but them very blurry in canvas and when I export to quicktime movie (not using quicktime conversion). Been using FCP 7 a couple years but my knowledge in many aspects is sub professional.
    Tried creating a new sequence to get the sequence to match the settings of the quicktime prores422 screen capture movies but to no avail. The settings of the sequence are not the same as the screen capture movies...I even tried to change the sequence settings but no luck (then exited FCP without saving so as not to screw anything up).
    Im probably breaking basic rules here...any help is greatly appreciated.
    Thank you!!!
    Compressor settings for file conversion above:
    Name: Apple ProRes 422 for Interlaced material (High Quality)
    Description: Apple ProRes 422 10-bit video with audio pass-through. Settings based off the source resolution and frame-rate.
    File Extension: mov
    Estimated size: 412.09 MB
    Audio: multi-track passthrough
    Video Encoder
    Format: QT
    Width: (100% of source)
    Height: (100% of source)
    Selected: 1440 x 900
    Pixel aspect ratio: Square
    Crop: None
    Padding: None
    Frame rate: (100% of source)
    Selected: 15.002
    Frame Controls: Automatically selected: Off
    Codec Type: Apple ProRes 422 (HQ)
    Multi-pass: Off, frame reorder: Off
    Automatic gamma correction
    Progressive
    Pixel depth: 24
    Spatial quality: 50
    Min. Spatial quality: 0
    Temporal quality: 0
    Min. temporal quality: 0

    Here is additional information on the problem.
    My sequence includes mostly screen captures, but also some other video (settings below) and some JPEGs.  The other video and the JPEGs look fine...both in canvas and when I export sequence to quicktime.  The screen captures look terrible...text is very blurry.  Same screen captures look fine in my viewer, just goes awry when in canvas and export.
    Format of screen capture clips (quicktime 10 screen capture > compressor prores 422 HQ):
    1440x900, apprle prores 422 HQ, data rate 5.6 MB/S, pixel aspect square, field dominance none, composite normal.  Started with 4 files of the screen capture from compressor, then edited them into many little pieces in FCP...the size of those files post compressor are around 2GB each.
    The sequence (by default) had settings of:
    frame size: 720x480 NTSC DV 3:2
    pixel aspect ratio: NTSC - CCIR 601 / DV 720x480
    field dominance lower(even)
    quicktime compressor settings: apple prores 422 LT
    Vast majority of clips are the same as screen capture clips.  But just in case its part of the problem, I have also have a couple video clips of that have settings:
    frame size:  720x480
    compressor:  DV/DVCPRO - NTSC
    data rate 3.6mb/s
    pixel aspect: NTSC - CCIR 601
    field dominance: Lower/even
    also have a couple JPEGs, their settings are:
    frame size 2500x2084
    compressor: photo-jpeg
    field dominance: none
    Thank you!!!  I've been using final cut a while, but don't think I would have gotten anywhere without the help and generosity of people that are way beyond my knowledge and skills.  I am happy to provide any more info.  I really appreciate it.

  • Contrast / Gamma Different in Canvas and Desktop Preview

    *The Confusion:*
    The contrast of my video differs between the Canvas Window and Desktop Preview.
    I assume the two are using different gamma settings. But I can't figure out what's going on, to know what those settings are and how to assess the final display picture.
    *Screen Grabs:*
    Here's a screen grab of the canvas, with the image at 100%. The screen grab does not show the full frame.
    - - - http://epokhecutmedia.com/images/gamma-ts-canvas.png
    Here's a full screen grab of image in Desktop Preview.
    - - - http://epokhecutmedia.com/images/gamma-ts-preview.png
    *What I've done:*
    I've gone through every gamma setting I know of and can't match the Canvas and Desktop Preview or make sense of the difference.
    Also, If I toggle between Display calibrations of 1.8 and 2.2 using the Display preferences in System Preferences, values in both the Canvas and Desktop Preview shift and still do not match.
    *Another seemingly related thing:*
    My Canvas window display jumps between different contrasts (possibly gamma values) automatically while I'm working.
    For example,
    - - - I'll have video frozen. I'll play it and the image with brighten across the mids with playback. However, after freezing it again it keeps the brighter value.
    - - - When I'm using filter, such as the 3-Way Color Corrector, when I click to drag a slider, the image with darken across the mids. Sometimes, as I drag, the canvas will erratically jump back and forth between the two values.
    *Why this is a problem:*
    I can't do basic exposure correction, because I don't know which is the accurate value to work with.
    edit by: FordPrefectRevisited, Screen Grabs added

    If I may re-open this thread, let me ask the question FordPrefect only alluded to:
    Given that I should be using a pro-level HD broadcast monitor to view everything, given that every piece of footage is different in the particulars, and given that the Canvas Window image is almost always different than any other playback system (Finder, QT, VLC Players, etc.), are there general exposure/gamma changes y'all make to account for the visual difference between the Canvas Window and other playback systems? If you're anything like me, you don't start from SCRATCH on every single edit... You have a few go-to filters with a few go-to settings, and then make minor adjustments according to the needs of the footage.
    For instance, in order to get the exported image close in exposure to the ideal Canvas Window image, I usually go: Effects - Video Filters - Quicktime - Brightness and Contrast - and then adjust the Brightness to 0.85 and it seems to get close.
    You guys have anything like that? Thanks for any help!

  • How to get back my Canvas and Timeline?

    I closed the canvas and timeline and then saved the project. Now i don't know how to get them back.

    Double click on the sequence icon in the Browser to open a project.
    Unless you have a project open, they will not be displayed.
    x

  • Hi, I've just downloaded the latest release 10.1.1 and now I do not see any more correctly my clips either in the canvas and in the timeline. Playing clips, they now appears with garbled images, completely unstables: I can not editing in these conditions!

    Hi, I've just downloaded the latest release 10.1.1 and now I do not see any more correctly my clips either in the canvas and in the timeline. Playing clips, they now appears with garbled images, completely unstables: I can not editing in these conditions!
    Anyone can help me?
    Thank you, Claudio

    Hi Russ, Thank you for your reply!
    System Spec:
    2x2.26 Ghz QUAD-CORE
    12 GB RAM 1066 MHz DDR3
    I've stored the library in HARD DISK which is installed inside my computer (1 TB capacity) and different from my hard disk in which I've installed all my applications (600 GB capacity).
    I've installed FCP since 2001, bought FCP X in 2012: never had a problem. Yesterday I was editing my video of my last vacations (in California!) and I have updated FCP X, downloading FCP X 10.1.1: then the problem!
    Strange is the fact that I've just tried to export a short project, I can see the final product quite well.
    What is impossible is playing the clips within Final Cut: they are jumpimg, moving, presenting some frame in green or red ...
    Everything all right in iMovie.
    I've just checked the RAM: 9GB out of 12 GB is busy, could this be the problem?
    Motion is very slow: for 20 sec of project, it takes minutes to play. And once again, if you finalize the projet and export it in Quicktime, you can see it correctly.
    I do hope you may suggest something, I'm getting crazy!
    Thank you in adavance
    Claudio

  • Can't get Canvas and Timeline Windows to Show

    Not sure what happened but Canvas and Timeline windows won't show. Pls help!

    I'm completely new to Final Cut Pro (I just got Studio), and I've been having the same exact problem: I open up Final Cut Pro, open a new project, and I only get the Browser and Viewer windows. I go to Window/Arrange, and I still can't open up the Timeline or the Canvas. I would just double click on a Sequence, but I don't know what the difference is between a sequence and a clip.
    Just to help you guys out, I'm working on the "Into the Blue" thing from the Training DVD; I had started working on it, but quit Final cut, and when I double clicked on the Project (I Saved it to Mac HD) to open it, I only get the Browser and Viewer. Please forgive my ignorance, but help! I'm panicking because I don't know what to do!
    17-inch Powerbook G4   Mac OS X (10.4.5)  

  • Is there video capture software which will capture only the canvas and not my cursor or the way I move the canvas?

    Hi,
    Does anybody know of a video capture software which only captures the canvas and not my cursor or the way I move the canvas?
    I want to simulate a painting being created brush stroke by brush stroke. It would also be good if I could select the layer that it is meant to be recording.
    I guess this would have to be a plugin of some sort.
    If not - do you have any good suggestions of the best workflow of creating this from Photoshop to After Effects (I don't want to use revealing paths etc...)
    Thanks for any help,
    Luke

    It would also be good if I could select the layer that it is meant to be recording.
    That won't work. Screen cap tools by their nature always capture the display buffer of the whole active window. At best, they respect GDI "drawing layers" and regions like Camtasia does, meaning they differntiate between mouse cursors, window frames and the actual content to get more efficient compression. For the rest - see the previous answer.
    Mylenium

  • Canvas and time line on final cut express disappearing

    hi,
    i was sorting recently captured video into clips when my canvas and timeline mysteriously disappeared. i think i might have pressed something but i can't remember what. now they are gray on my options window, witch is where the timeline, canvas, viewer, and browser options are.
    can any body help?
    thanks

    http://www.fcpbook.com/Misc7.html

  • How to crop canvas and change aspect ratio?

    I'm working on a project shot with an old camera from the 70s. I used that camera but recorded the signal on my mini dv camera. Now I have a black border on the right side of the image.
    This project is going on the Web, not TV. How can I crop the canvas (and change the aspect ratio) without a black border? I know there's a crop feature in the motion tab, but that results in same aspect ratio with black border. Is this possible?
    (I don't care if the aspect ratio is non-standard, and I don't want to letterbox.)

    If you are going to the web (what means you'll downscale at the end) and you shoot using an old camera, the loss of quality of the upscaling probably means nothing in your final web encoding.
    You can make a test upscaling just some seconds of your movie an encoding it for the web to check the final quality.
    Hope that helps !
      Alberto

  • My Canvas and Timeline are gone and I can't get them back

    Hey everyone.
    I've been using a new HD camera and i have had to change a billion settings on FCP. Now that I am no longer using HD it was time to go back to the way they were, but I must have done something wrong. My canvas and timeline are gone and I can't get them back. I tried going to window and just pulling them up but I can't click on the canvas and timeline buttons...
    Please help!!! I am fairly new at final cut pro and I need help. I have a film festival deadline approaching and only hope that some kind person out there can help!!

    Trash your FCP preferences. This will reset FCP to it's defaults.
    Close Final Cut Pro and open a Finder window.
    Click on your user name in the side bar.
    Open the following sub folders Library, Preferences, Final Cut Pro User Data.
    Place the following files in the Trash:
    Final Cut Pro 6.0 Prefs, Final Cut Pro Obj Cache, Final Cut Pro Prof Cache.
    Empty the Trash.
    Open Final Cut Pro. You will be asked to choose your working format (Easy Setup) and designate your scatch disks.

  • Can't Access Canvas and Timeline

    I logged all the video I need a couple of days ago, but when I tried to edit it, the canvas and timeline will not appear. Under the Window tab, they are both faded, and nothing I tried would make them reappear. I have no idea what to do to make it work. I tried to save it in an email and open it from another computer, but whenever I try, it makes the timeline and canvas not work on that computer as well. I've tried opening FCP first and then my project, but the timeline and canvas disappear as soon as it opens the video files. Help!

    Tiffany,
    Just a note to let you know I was having the same problem with Final Cut Pro 7. This Topic got me going.
    Been a couple of years since I used Final Cut Pro 5, but this new iMac was begging for a Final Cut Studio upgrade.

Maybe you are looking for

  • Ssrs report from ssas cube , driving me nuts now...

    hi folks:  This is driving me nuts and I know it's gonna be some small stupid settings.  The question is pretty simple, I want to users to be able to pick up a week from date hierarchy. If I specify a static week, mdx query will run and report shows

  • Unable To Open Crystal Report

    Hi I want to open Crystal report through Java 1.5 Using JAVA Beans class. Data Base: My SQL, JDBC connectivity Class Names: CrystalRepoty(For Viewing The Report) Bean Class(WorkinfoDataSourceBean): For Data Base Connectivity When i open the perticula

  • Actions  for  flv event cue point

    I have an flv playing back from component in a nested timeline (an actionscript 2 proj) and I want at the end of the video to gotoAndPlay the label"vidend" in the this timeline. I embedded the the event cue point called "end" on the last frame of vid

  • My Adobe Premiere Elements was working a little while ago -- nothing has changed on my PC -- now I get error 150:30

    My Adobe Premiere Elements was working a little while ago -- nothing has changed on my PC -- now I get error 150:30

  • Check Entry in Action Matrix

    Sap documentation about this field is very poor, does anybody know what it is for? Definition Controls whether the status of an entry in the Action Matrix is to be checked or not. Use If you select this field, the system checks whether a required sta