Putting scrollbar on frame

Dear All
How can we put a scrollbar on frame so that all the coponents may visible on frame.
Thanks

import javax.swing.*;
public class Main{
public static void Main(String[args]){
   new Main().start();//to get out of static context
  public void start(){
    JFrame frame = new JFrame("How to put a scrollbar in a frame");// initiates the frame and gives it the so title
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// when you click the X button the program stops and you don't accidentally have 54 applications running...
    frame.setSize(700,700); // makes it big, units in pixels
    frame.add(new JScrollBar());// adds the scrollbar to the frame
    frame.setVisible(true);//self evident
  }This should get you started.
From here, I suggest you get the book "Swing Hacks" by O'reilly media... then get the book "Graphic Java 2: Swing" and do as much research on swing and AWT as possible.
You are able to find them online at www.scribd.com for free, though I bought them myself.

Similar Messages

  • I had completed my iDVD project and burned a disc. It worked great! Then someone messed with the project and put a red frame around the opening screen. Now when I burn the project, it no longer has the opening frame. How can I fix?

    I had completed my iDVD project, a Wedding Slideshow with pictures and music, and burned it on a disc. It worked great! Then someone messed with the original project on my computer and clicked around and put a red frame around the opening screen that has the Wedding theme with music. Now when I burn the project to make more DVDs, it burns but no longer has the opening frame. It immediately opens to the iMovie slideshow. How can I fix so I can burn the entire project with opening frames?

    As Bengt suggested make a disk image of the successfully burned DVD using Disk Utility. Then you can burn copies any time you need one.
    In the future once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image menu option.  This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image and launch DVD Player and play it.  If it plays OK with DVD Player the encoding was good.
    You can then burn it to disk with Disk Utility at the slowest speed available to assure the best burn quality.  Always use top quality media:  Verbatium, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    OT

  • Scrollbar in Frame

    I have designed a frame. Now how can i add a scrollbar on this frame. I mean something like enabling scrollbar in frame. Is there any method or variable which has to be set to enable scrollbar?

    Did you know we have a Swing forum too?Yeah, sorry for that. I will post this kind of post in swing forum here after.
    And why do you want to add just a Scrollbar? Wouldn't
    you need a JScrollPane? If so, there are online
    tutorials for that.I have many fields where fields are crossing the whole frame of window size. If i can have a scrollbar then i can able to see all fields.

  • Putting a "picture frame" around an entire video

    Hey there! thanks in advance for the help.
    I'm attempting to put a "picture-frame" around a video that will be visible throughout the duration of the movie. Is there any way to do this in FinalCut Pro?
    Thanks!

    There are some great Frames in the Motion Content. Open Motion using same settings as your FCP project and find the one you like in the Motion Library and drag it to your new Motion project.
    Size it to your tastes.
    Then open Layers (cmd-4) twirl the disclosure triangle and delete the drop zone.
    Now export it. When you bring it into FCP you will have a frame you can place over any video and the video will show inside the frame.
    Good luck

  • Putting Components on Frame Title Bar

    Is there a way to write over the title bar on an awt Frame? That is, to actually put components where the frame title is ordinarily found. I have a small PDA I have to write an awt-based app for, and I'm trying to find ways to maximize real estate. Thanks.

    if you want the frame to be vis. too use swing and call setDefaultLookAndFeelDecorated(true), this will cause 100% java frames that you can put stuff on to be used

  • Putting images into frames

    I'm making diamnond shaped frames to put images in and I need some help. I'm making a square and rotating it but the image rotates as well. How do I do this? I have indesign CS5. Thanks!

    Thanks! I'm attaching a screen shot. I'm trying to duplicate the pdf that's on the right. Thanks again!

  • Putting Content in frame

    I have created a simple web page with three tables.
    The top one has a logo; the second a set of menus generated
    using PopMenu Magic by PVII. The third contains the content, and
    with incredible brilliance, has the id "content."
    I would like to make the web pages selected by the menu items
    open in the third table/frame so that the top two remain visible
    (and the menus accessible) all the time.
    However adding target-frame="content" to the href tag still
    makes the page open in a new window.
    What am I missing here?

    > What am I missing here?
    Alot. This is a commonly sought goal by new developers since
    it *would*
    simplify their lives consderably if it could be done easily.
    It's not so
    easy.
    You can use an IFrame, but then you marry the 900 pound
    gorilla of frames.
    You can use a server-side include there, but then you a) have
    to understand
    how includes work, and b) have to figure out how to write the
    server
    scripting to make the includes get written based on which
    button was
    clicked, and c) have to know how to do server scripting in
    the first place.
    For now just make one page link to another page, each with
    different
    content, and take it one step at a time.
    And by the way, get a good book (or even a bad one) on HTML.
    The more you
    know about this the easier your learning curve will be.....
    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
    ==================
    "Ralph Allan" <[email protected]> wrote in
    message
    news:e3du1o$biv$[email protected]..
    >I have created a simple web page with three tables.
    >
    > The top one has a logo; the second a set of menus
    generated using PopMenu
    > Magic by PVII. The third contains the content, and with
    incredible
    > brilliance,
    > has the id "content."
    >
    > I would like to make the web pages selected by the menu
    items open in the
    > third table/frame so that the top two remain visible
    (and the menus
    > accessible)
    > all the time.
    >
    > However adding target-frame="content" to the href tag
    still makes the page
    > open in a new window.
    >
    > What am I missing here?
    >

  • Putting image on Frame in netbeans

    Dear All
    How can we add an image on frame in netbeans IDE.
    From
    Rajeev Sarawat

    you have to create one class in the same project for the main panel(name it as MyPanel) then go to "customize code" of main panel and instead of default creation do custom creation of the main panel.
    here is the code for MyPanel----
    import java.awt.Color;
    import java.awt.Dimension;
    import javax.swing.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import java.awt.Graphics;
    import java.io.IOException;
    import java.io.File;
    * @author Administrator
    class MyPanel extends JPanel {
    BufferedImage image;
    String file;
    public MyPanel(String s) {
    setBorder(BorderFactory.createLineBorder(Color.black));
    file = s;
    public Dimension getPreferredSize() {
    return new Dimension(711,360);
    protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    try
    image = ImageIO.read(new File(file));
    }catch(IOException e)
    System.out.println(e);
    int w = image.getWidth(null);
    int h = image.getHeight(null);
    BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    g.drawImage(image, 10, 20, null);
    i think it would be helpful

  • How can I put a photo frame around my photo using PSE 9?

    I can't find a way to do this. V8 seemed to have it.

    If you don't find a frame to suit, you can make your own:
    Open picture file in full edit and enhance as usual, and merge layers.
    Go to Select>all
    Open a blank layer at the top
    Go to Edit>stroke outline selection, make stroke wide (25-35px), position inside, color does not matter
    Open the effects palette, go to Layer style>Patterns>Wood>apply
    In effects palette go to Bevels>scalloped edge bevel, or simple inner>apply
    Double click the "f" in the layer with the stroke to bring up the style settings dialog, adjust as necessary

  • Would like to try putting scrollbars to the LEFT!

    I'm experimenting with some ergonomics and would like to change my vertical scrollbars within windows over to the left side rather than the right. Does anyone have an idea how to do this in the simplest way possible? Have done various searches but the GTK details are pretty overwhelming and I can't see the wood for the trees, I'm afraid.
    I'm using Openbox with a modified Crux type GTK2 theme.
    PS: Managed to get the close/minimise/etc buttons in the Openbox window titles moved to the left by specifiying 'CMSILN' in rc.xml.

    Is that the same Moscow Biker that used to be in an apartment block with an strange shared internet connection ?
    I seem to remember someone I suggested to that they contact James at that time.
    1:46 PM Friday; November 17, 2006

  • How to put image in Frame?

    How do I paint images (gif/jpg) in Frames?
    getCodeBase(), "... command doesn't work in Frame
    the getToolkit stuff to get images compiles, but my image doesn't show up. What can I do now?
    This is a part of a larger class.
    class Win extends Frame{
    Image helpD = Toolkit.getDefaultToolkit().getImage("icon.gif");
         Image img;
         Graphics helpG;
    Win(String name)
    setSize(455,455);
    setTitle("Instructions:");
    setResizable(false);
    addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent evt)
    dispose();}
    public void update(Graphics g) {
         paint(g);
    public void paint(Graphics g){
              img=createImage(455,455);
              helpG=img.getGraphics();
    helpG.drawImage(helpD,0,0,this);
    g.drawImage(img,0,0,this);
    Does the getTookit stuff has some image restrictions?
    Thanks,
    Gant

    Is this what you're after? JFrame jf = new
    JFrame("Title");
    jf.add(new JLabel(new ImageIcon(img)));
    No, that's addin a ImageIcon. I want to place a gif/jpg background image in the window frame.

  • HT4061 my iphone5 went beserk ..The voice wont shut up, the scroll function wont work, when I push an icon it tells me what the icon is.  In order to minimally use it I have to push the button a gazillion times, or Not.  It puts a dotted frame around any

    I think I pushed assistance touch and now the phone tells me what each button does but I cant get it to do anything without pounding my finger on an icon or letter innumerable times, it wont scroll back and forth and won't quit talking... help

    That's the Voice Over Feature.
    Tap the Settings icon once to select it and then Double Tap on the Settings icon to activate it.
    Use 3 fingers to scroll down to General, tap it once again to select it, and then twice to activate it.
    Again use 3 fingers to scroll down to Accessibility,  again tap once to select, then twice to activate.
    Tap on Voice Over once to select it,  and twice to actvate it and then tap once on Voice Over, and then tap twice to turn it off.

  • How to put the current timer in the frame

    I am doing one application and i am using frame. I want to show the current time( hour and minute). But i don't know how to implement it. Please help me to solve my problem. Below is the sample code of my program. How to put the timer in the bottom part.
    //AdminMenu.java
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class AdminMenu extends JFrame{
    private JLabel lblmenu;
    private JLabel lblvideo;
    private JLabel lbladmin;
    private JButton cmdaddvideo, cmddeletevideo, cmdeditvideo;
    private JButton cmdaddadmin, cmddeleteadmin, cmdchangepass;
    private Container c;
    private GridBagLayout gdlayout;
    private GridBagConstraints gdconstraints;
    private Color colorValues[] =
    { Color.black, Color.blue, Color.red, Color.green };
    public AdminMenu()
    super("Administration Menu");
    JMenu fileMenu = new JMenu( "File" );
    fileMenu.setMnemonic( 'F' );
    JMenu openMenu = new JMenu ("Open");
    openMenu.setMnemonic('O');
    fileMenu.add( openMenu );
    JMenuItem exitItem = new JMenuItem( "Exit" );
    exitItem.setMnemonic( 'x' );
    exitItem.addActionListener(
    new ActionListener() {
    public void actionPerformed( ActionEvent event )
    System.exit( 0 );
    } // end anonymous inner class
    ); // end call to addActionListener
    fileMenu.add( exitItem );
    // create menu bar and attach it to MenuTest window
    JMenuBar bar = new JMenuBar();
    setJMenuBar( bar );
    bar.add( fileMenu );
    setSize(300,250);
    setLocation(350,200);
    this.setResizable(true);
    show();
    //---------------------- Main -------------------------------
    public static void main(String args[])
    AdminMenu app = new AdminMenu();
    app.setDefaultCloseOperation(
         JFrame.EXIT_ON_CLOSE );
    Thanks for helping me

    e.g. use a thread that invokes new Date() (every minute), format the Date with SimpleDateFormat and print the result String on a Label that you can put on your frame ...

  • CS3 put black frame onto images on saving end freezing in full screen mode

    HI, I've got 2 problems with CS3, the first on my macPro 2x2.66 xeon - 4 Go - MAC 10.5.2
    CS3 put, randomly, black frames on pictures when I'm saving as TIFF, CMJN, 8bits, a few month ago I have had same problems but with white frames ....
    Another problem with CS3, on a MacBook pro 2.4 - 3Go with LaCie LCD 21" screen, when I enter full screen mode and I moving picture with the hand, the Mac is freezing, and I have to reboot;
    3 days ago after a crash, I've had to reinstal the system because the Lacie was seen as a "LCD screen" (not Lacie) and with 1440 pixels max display (1600 usualy).
    I do really NEED help please

    lepixel,
    What specifically do you mean by "network"? Are you working and saving files directly across a network? If so, and that is the problem, it is a known issue that does not necessarily mean you have a problem with your computer.
    If a network is properly configured and maintained by a knowledgeable IT specialist, you can work this way. But as there's a very high number of possible network configurations and chances for fatal file errors (such as what you're experiencing), Adobe specifically warns that you should first drag-copy your files off the network server to your desktop, work locally, save locally, and then drag-copy the completed work back to the network server.
    Does this describe your network and workflow?
    Neil

  • JScrollPane in a JFrame scrollbars visible but not functional no thumbtabs

    Here is the code that I compiled and run on J2SE v. 1.4.2 (runtime b28). I looked through the various related articles and nothing seems to help with this issue. The scrollbars appear along with the panel but the thumbtabs are not present. Any help would be appreciated.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test {
      public static void main(String[] args){
        Test rce = new Test();
        JFrame frame = new JFrame("Test Scroll");
        JScrollPane scrollBar = new JScrollPane();
        scrollBar.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        scrollBar.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        Component  rcePage = rce.createComponents();
        scrollBar.getViewport().add(rcePage, null);
        frame.getContentPane().add(scrollBar, null);
        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        frame.pack();
        frame.setSize(400, 400);
        frame.setVisible(true);
      public Component createComponents() {
        JPanel pan = new JPanel();
        JLabel label = new JLabel("This is a Test!");
        pan.setBorder(BorderFactory.createEmptyBorder(
            0, //top
            0, //left
            0, //bottom
            0) //right
        pan.setLayout(null);
        label.setBounds(100, 100, 80, 20);
        pan.add(label);
        return pan;
    }

    This is a very common mistake. When you put a JPanel in a scrollpane, the scrollpane will use the panel's preferred size to determine if scrolling is needed or not. If the panel is using a LayoutManager this is generally done for you automatically. But in your case you set the layout to null, and then it is your responsibility to make sure that the getPreferredSize() method of the panel returns the correct size.
    One way to fix this in the code you posted would be to override the getPreferredSize() of the panel, like so:
        public Component createComponents() {
            JPanel pan = new JPanel() {
                public Dimension getPreferredSize() {
                    return getSize();
        }Then the scrollbars will appear if you make the frame smaller.
    But what I really suggest is that you use a LayoutManager.

Maybe you are looking for