How to make a scrollable applet

How do I make an applet scroallable? Not a scrollpane within an applet but instead make the whole contentpane for the applet as a scrollable pane if the content within the applet�s contentpane is too small to view all the added content. Or if the applet is added to a frame to be run as an application and the frame size is decreased.
That is, how do I make a scrollpane that fills the whole contentpane for the applet and is resized together with the applet�s contentpane? What do I for example have to add to this little applet to make it�s contentpane scrollable?
public class Applet extends javax.swing.JApplet
    public void init()
        // Initialization of the applet pane
        getContentPane().setBackground(java.awt.Color.WHITE);
        getContentPane().setLayout(null);
        // Adds some content
        JLabel label = new JLabel("Applet application");
        label.setSize(100, 20);
        label.setLocation(10, 10);
        getContentPane().add(label);
}It is probably very easy but I can�t figure it out myself yet, I am still too new to Swing : )

Thank you for your answer, but I am not quite happy yet ...
What is it so bad with use of null-layout? I have found that I can use exact positioning using setLocation if I set use null-layout which I can�t with for example BorderLayout. It is even worse, the BorderLayout makes the UI ugly by size of the content to fill one out of five "cells". But I know I am wrong when I say nul-layout is fine because many other also complains on null-layout, I just don�t know why I am wrong?
But any way, with null-layout, something like this ...
       JPanel contentPane = new JPanel(new java.awt.BorderLayout());
       getContentPane().add(new JScrollPane(contentPane));
       JScrollPane scrollpane = new JScrollPane();
       scrollpane.getViewport().add(getContentPane());
       // Initialization of the applet pane
       contentPane.setBackground(java.awt.Color.WHITE);
       contentPane.setLayout(null);
       contentPane.add(table);do I just get a white empty area. If I instead use a BorderLayout like in your example do the table fill the whole space, and that does not look too beautiful. Couldn�t I instead get a pane with some absolute positioned elements that has some space around them scrollable?
I guess I am on the wrong direction now : ) but I then need someone to teach me why?

Similar Messages

  • Simple introduction/tutorial on how to make Cocoa-Applescript Applets?

    I'm looking for a simple tutorial on how to make Cocoa-Applescript Applets.  I'm pretty new to Applescript, but fairly good at it, and I was wondering how Cocoa-Applescript Applets worked.  I was curious as I've been wondering if it was possible to somehow display images in Applescript, and it apparently is the only/easiest way.  My problem is that I haven't been able to find any tutorials on using it, so I was wondering if you guys could point me in the right direction, that'd be great!
    thanks in advance

    The main difference is with how the Cocoa APIs are used - in addition to the AppleScript and AppleScriptObjC release notes, there are some examples and resources at Mac OS X Automation.  Note that in Yosemite, AppleScriptObjC is available to all scripts, not just applets and libraries.

  • How to make HtmlSelectManyCheckBox scrollable

    Hi,
    I have a requirement like , have to create the checkbox list dynamically.
    I am doing it through the binding. But i want to make the HtmlSelectManyCheckBox should be scrollable.
    I am doing as belwo
    HtmlPanelGrid innerGrid = new HtmlPanelGrid();
                   innerGrid.setWidth("150%");     
                   innerGrid.setStyle("height:150px; border:2px; overflow-x: scroll; overflow-y: scroll;");
    HtmlSelectManyCheckbox selectBox = new HtmlSelectManyCheckbox();
                   selectBox.setBorder(3);
                   selectBox.setLayout("pageDirection");
                   selectBox.setStyleClass("selectManyCheckbox");
                   selectBox.setTitle(catVO.getCatName());
                   // adding the selectitems to select many list box
                   UISelectItems items = new UISelectItems();
                   items.setValue(catVO.getInterestItems());               
                   selectBox.getChildren().add(items);
    innerGrid.getChildren.add(selectBox);Though i set the style of the grid to be scrollable , but its not working properly.
    Plz help me , how to make it scrollable.

    hari_honey wrote:
    Thank u , ok how to apply the styles or style class to the HtmlPanelGroup.Uh, just the same way.
    And i have to create the lists dynamically , and i dont have the count of the number of panelGroups.You already have the count of checkboxes.
    How can i put them in table.The same way.

  • How to make JList scrollable left right?

    Hi,
    How to make JList scrollable left right?
    Ty.

    jList MyList = new JList();
    JScrollPane  sp = new JScrollPane(MyJList,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);then the horizontal (and vertical if its the case) scrollbar will show up
    hope this helps

  • How to make chart scrollable?

    Hi everybody,
    I want to ask how to make a chart become scrollable (just like a chart with a scroll bar that help us see all content in this chart when this content become to large).
    Because my line chart adding series data based on real time, so the content change dynamically. And when the content change, I don't want the axis change its size to fit the chart size, because it make the line chart smaller and narrow.
    I have seen in JavaFx Ensemble the example *"Advanced Stock Line Chart Sample"*, it seem like what I looking for. But this chart clear the old data after a period. I want chart to keep the old data and when I want to review, just scroll back
    Can anyone give me suggestion?

    Have you looked at ScrollPane.... http://docs.oracle.com/javafx/2/api/javafx/scene/control/ScrollPane.html
    You can just throw your chart in there. Then if your chart gets bigger then the screens dimensions the ScrollPane will become scrollable.

  • How to make sure an applet runs with Java 5?

    Hi all,
    First let me say thanks for all the help in the past. You've help me go from noob to intermediate noob. I've just about finished my first applet game which can be checked out here .
    Now I've been reading about problems with mac and 1.6. (note it works on Linux). I want to make sure that it runs fine and of course I don't own a mac. So I downloaded the 5 JDK. Selected it as the java platform in Netbeans, compiled and it ran fine.
    Questions:
    Do I have to always use 1.5 to compile and perhaps set it as default?
    Since it works in 1.5, do I compile it with 1.6 and just upload?
    I'm worried I'm not testing it correctly. I mean if I have both 1.5 and 1.6 installed on my machine, how to I make sure the applet is only using 1.5 to run?
    Thanks
    Darrin

    corlettk wrote:
    I haven't got a clue RE your problem other than for max-portability you should compile with [-target 1.5|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html].
    I must say I'm impressed, except I suspect my PC must be substantially faster than any of your test platforms... can you throttle it to CPU performance somehow? Or maybe it's just that my reflexes aren't what they once where.Thanks.
    There seem to be two issues. The first is what people are using. This web stats shows pretty poor penetration of 1.6.
    [http://www.statowl.com/java.php|http://www.statowl.com/java.php] Penetration: 54% with JRE1.6 + 19% with JRE 1.5. Total 73%.
    The second is I've read that mac and 1.6 do not get along except on a 64bit platform.
    So for applets there is not much choice but to compile on 1.5 for the broadest user base. I guess the good news is 1.4 and earlier are almost non-existent.
    Edited by: Darrin.A on Apr 27, 2009 8:11 AM

  • How to make JEditorPane support applet?

    hi hi,
    i would like to know how to make the JEditorPane support applet coming from internet source. i will be using JEditorPane to view web page but if it contains applet, how can i make JEditor support it? what should i need to do so. pls give me some guide lines. thanks

    That's an interesting question. The short answer is, you can't. For one, the APPLET tag is ignored by the Swing HTML parser. Then, I'm not sure, what happens if you embedd heavy-weight components like applets into an editor pane.
    However, you can use  JEditorPane e = new JEditorPane();
      e.setText("Hallo, Welt");
      e.setCaret(5);
      e.insertComponent(new JButton("Click me"));to add swing components to your text. So you might be able to create a working solution based on this foundation.
    I can imagine two approaches. You could either create your own applet-like JEditorPanelets which would be basically JPanels with some glue code to allow the the panelet to access its editorPane.
    Or you could explore the approach to add a heavy weight applet and write a compatiblily stub. Here's an outline  class AppletAwareEditorPane extends JEditorPane {
        List applets;
        MyAppletStub stub;
        public void insertApplet(Applet a) {
          applets.add(a);
          a.setStub(stub);
          a.init();
        public void startApplets() {
          Iterator i = applets.iterator();
          while(i.hasNext()) ((Applet)i.next()).start();
        }However, each applet would require to run in its own tread and I'm pretty sure this would break swing as it is not thread save.
    bye

  • How to make graphics in Applet not to repaint after I click "refresh"

    Hi, pals
    I have some interactive graphics inside an Applet. User can drag and
    move the graphic objects. The problem is when user click "Refresh"
    button of the web browser, those objects return to their original
    positions. What I hope is to make those objects still lie on the new
    position that user has moved them to after they click "refresh" or
    "back" and "forward" button to return to the applet page.
    do I need to write some thread control?
    Think when you type new URL in the browser showing the applet and go to the new web page. The system will call
    Applet.stop() and destory() to destroy the applet resource used by the
    Applet webpage. When you go back to the applet page, the system will
    call Applet.init() and start() to recreate it. All previous object
    positions and states manipulated by user will return to original.
    For example, there's a circle centered at (50,50), you move it to
    center (100,100). Then you go to another webpage in the same web
    browser frame. When you use "Back" button to return to the Applet, the
    circle will be redraw at center (50,50). (why? because the browser call applet.init() and do all process as first time the applet download to your computer) What I hope is the circle still keeps
    at its last center (100,100) . This seems impossible to me
    since the applet has lost its memory about the center position
    (100,100) last time when you go to another page and the system call
    destory() to delete the applet.
    Any suggestion?

    I think you can disable page refreshing with javascript, but how, I do not know.
    I wish this is helpfull.
    Ahmad Elsafty

  • How to make a Java Applet work beyond proxy?

    Hi All,
    I have problems with my applet working through proxy.I am using a client applet which makes a socket connection to a Java application running on the same pc as the web server.
    Everything works fine when I am directly connected.However it does't work when connected through a proxy? I am using object o/p & i/p streams for the exchange of data b/w client applet & the server java application.How do I overcome this problem.
    Currently I am using WinGate 3.0.2 as my proxy(I did't see any firewaal setting there) but I intend to make applet work through any proxy for that matter.Using a higher level protocol such as UDP would help in this regard?
    This is urgent.PLease reply ASAP...
    best rgds,
    prithvi

    Try to use http, i don't thing direct open the socket can pass throught the socket if your proxy haven't forward those ports~
    Hi All,
    I have problems with my applet working through
    gh proxy.I am using a client applet which makes a
    socket connection to a Java application running on the
    same pc as the web server.
    Everything works fine when I am directly
    ly connected.However it does't work when connected
    through a proxy? I am using object o/p & i/p streams
    for the exchange of data b/w client applet & the
    server java application.How do I overcome this
    problem.
    Currently I am using WinGate 3.0.2 as my proxy(I
    (I did't see any firewaal setting there) but I intend
    to make applet work through any proxy for that
    matter.Using a higher level protocol such as UDP would
    help in this regard?i think UDP/TCP is not the matter for that!
    This is urgent.PLease reply ASAP...
    best rgds,
    prithvi

  • How to make JFrame scrollable?

    How can I make a JFrame scrollable? So that when I resize the JFrame to a smaller size the contents remain accessible? The way it is now is that when I resize a JFrame I can't access the components that fall out of the window (I'm using absolute component positioning within the JFrame). I thought adding two scrollbars to take care of this would be easy, but so far I haven't been able to get it right. Any suggestions would be appreciated.

    Why dont you put all your components in a JPanel, add a scrollpane to it and then add that JPanel to
    ur JFrame.
    += KRR

  • How to make a SCROLLABLE Table in ADF Faces ?

    Hi All,
    I want to make my ADF Table Scrollable (both Horizontally & vertically). It means when I have 30 rows on the table, I can make it only display 10 rows visible, then scroll it vertically.
    Also If I have wide tables(many columns) I can scroll it horizontally.
    Is it possible with ADF Faces ?
    (I look at FrameBorderLayout, but it seems not be able to do that )
    Thank you,
    xtanto

    Hi,
    What about the Horizontal scrolling ?
    for exampe :
    I have about 15 columns, the full page width can only shows 10, so I need to scroll horizontally, But I don't want to scroll the page, only the table.
    Is there any ADF Faces components for this ?
    or any commercial JSF components ?
    Thank you,
    xtanto

  • How to make JScrollPane scrollable only in the y- direction

    Hai,
    can some one help me fix this one. I need to create a JScrollPane which is scrollable only in the y direction.

    Hi everyone,
    Create the JScrollPane in this way
    JScrollPane ScrollPane1 = new ScrollPane(JComponent,
    VERTICAL_SCROLLBAR_ALWAYS,
    HORIZONTAL_SCROLLBAR_NEVER);Richard West

  • How to make JMenu scrollable

    What to do if I have too many items in my Menu?
    Can I implement somthing similar scrolling and how?

    see http://forum.java.sun.com/thread.jsp?forum=57&thread=483165
    ;o)
    V.V.

  • How to make packages for applets

    hi all...
    i tried the following code for applets
    package imp;
    import java.awt.*;
    import java.applet.*
    <applet code="Ex1" widt=400 height=400>
    </applet>
    public class Ex1 extends java.applet.Applet
    ---------code------
    and then i complied and used applet viewer to start the applet...but it gave the error access denied
    without the packaging, this worked fine
    regards,
    kalyan

    and then i complied and used applet viewer to start
    the applet...but it gave the error access denied If I remember correctly, when you have a package to the class, the class file should be placed in a subfolder called imp and the applet tag should use the fully qualified classname imp.Ex1

  • How to make the editable col. in alv grid scrollable?

    friends,
        i have made the last col. in my alv grid editable..even though i have declared it as char of length 255, it's showing only 50 characters in the grid..but when i try to type beyond 50 characters, it's not allowing...how to make it scrollable so that it extends beyond 50 char. and capture all the characters typed in that col.? pl suggest..thanks all..
    Sathish. R

    Hi, u can extend the length of your last field.
    LOOP AT t_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN text-001.
            ls_fcat-outputlen = c_10.                    "10
          WHEN text-002.
            ls_fcat-outputlen = c_20.                    "20
          WHEN text-003.                                  "your lastfield
            ls_fcat-outputlen = c_255.                  "255
                "do nothing
        ENDCASE.
    *fixed column
        ls_fcat-fix_column = c_x.
    *changes to take effect
        MODIFY t_fieldcat FROM ls_fcat.
        IF sy-subrc = 0.
          "do nothing
        ENDIF.
        CLEAR ls_fcat.
      ENDLOOP.

Maybe you are looking for

  • Training and Event Management - Sales Organization

    In <b>Create Billing / Allocation Info (IT1037</b>), Billing Section, there is a field for <b>Sales Organization</b>. Is this Sales Organization to be defined (by Sales Team) in S & D and to be assigned in this Infotype for billing purpose? I presume

  • Error while installing SAP IDES ECC6.0 on windows server 2003.

    Hi gurus,   I am getting error in installing SAP IDES ECC 6.0. In import ABAP step i am not able to execute all 19 services only 1 services is getting fail that is related to sapview.So,can anyone suggest me that how to solve this error and complete

  • How can I turn off find my iPhone to restore when it won't let me into my phone settings.

    I went to use my phone last night and suddenly it says activation is required (which I'm not sure I understand alone) but I began to go through the steps and it says it can not activate because the beta has expired and I need to do a system restore.

  • Why is my macbook pro running so slow and so slow to reboot?

    Hello, I edit using Lightroom and Photoshop and I'm having an issue while editing. After editing around 8-10 photos in Photoshop the computer starts running unbelievably slow. After each 8-10 photos I have to close down everything and reboot. Even th

  • Duplicate rows in Oracle

    What would cause Oracle to insert duplicate rows into a table? Could a join of two tables in the initial query assigned to an application page cause ORacle to insert an extra row into a table when an update to data value occurs? I have no insert trig