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

Similar Messages

  • 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 jframe transparent?

    Hi
      some software's uses the monitor as a whiteboard to draw or to type text. How is this possible? I mean i thought that by making a  jframe (full screen) transparent we should be able to do this?   Is my understanding right? if so how to make the jframe transparent? when jframe is transparent will we be able to draw on it?

    Try this:
    public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
      @Override public void run() {
      JFrame f = new JFrame();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setUndecorated(true);
      f.setBackground(new Color(0,0,0,0));
      f.setExtendedState(JFrame.MAXIMIZED_BOTH);
      f.add(new JComponent() {
      @Override protected void paintComponent(Graphics g) {
      g.setColor(Color.BLUE);
      ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      g.fillOval(0, 0, getWidth(), getHeight());
      f.setVisible(true);
    Message was edited by: 946128 in respose to PhHein's comment

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

  • How to make JFrame become the topmost window?

    I have server that is supposed to show a TOPMOST JFrame window each time it gets a "Show Window" command from client. I use JFrame to create and show the window in the server code:               
    JFrame mainWin = new JFrame();
    mainWin.setResizable( false );
    Container mainContainer = mainWin.getContentPane();
    mainContainer.setLayout( null );
    // add components to mainContainer
    mainWin.setVisible( true );
    mainWin.show();
    mainWin.toFront();
    If I run the server under windows platform, the first created JFrame window is always hiding behind under other application windows. However, the JFrame windows other than the 1st one are always at top.
    The BAD thing is, if I run the server under Macintosh platform, the JFrame windows are always hiding behind the other application windows.
    Does anyone know how to fix the problem? i.e., making the JFrame window appear on top of other windows under any platforms?
    Thanks.
    ZZ
    p.s. I am using JDK version is 1.3.0.

    there is some weirdness with java I've noticed under windows during development. When you start the app from a console window or script, if you change focus to another window before the first java window shows up, it will show up behind the window you changed focus to. If you leave it alone until the window shows, it will be on top. A work around is after you call show(), call toFront().

  • How to make JFrame default Maximum size state?

    Hi all,
    Is there any one know how to construct a JFrame that setMaximum when screen show?
    another word mean the JFrame in Maximum state byb default.
    regards,
    elvis
    scjp

    Pheeeewww...
    Don't people ever search the forum and read older posts?
    Both the question and the partly wrong answer have appeared many, many times before.
    In pre-1.4 Java you simply cannot maximize a frame.
    The 'solution' is probably the best you can do, but it does not really maximize the frame:
    * The user can still move/resize it.
    * It does not take into account the size/position of the windows task bar or any other window manager palette windows.
    There also has been a solution that uses the Robot class to simulate a click on the maximize button, but that's a real dirty trick, that won't work in applets and strongly depends on the exact layout of the window's decorations.
    In Merlin you can programatically maximize a frame as well as find out the screen's insets (resulting from the task bar...)
    Stephen

  • How to make JFrame positioned to lower right corner of user's desktop

    I'm a new java user, and I'm working on building a small
    application. When the application is launched, I would
    like the application (JFrame) window to be positioned
    in the lower right corner of the user's desktop. Does
    anyone know how to get the user's desktop size so
    I can position the application.
    Here is a code snippet where I lauch the app.
    public static void main(String args[]) {
    ArchiveRestore mainFrame = new ArchiveRestore();
    mainFrame.setSize(500, 500);
    mainFrame.setTitle("Master Model Automation");
    mainFrame.setVisible(true);
    Thanks
    -cliff

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Will get the screen size. The Toolkit class is in the java.awt package.

  • How to make JFrame window un-resizable?

    I create a window using JFrame. I don't want user to re-size the window. How can I do that? Thanks!

    JFrame f = new JFrame();
    f.setResizable(false);
    Jframe entends frame
    setResizable() is a method in frame
    http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Frame.html#setResizable(boolean)

  • How to make JFrame Always on Top?

    is it possible to make a JFrame always stay on top???
    anyway article or tutorial on this??
    thx

    Why not use the search facility before posting a question?????
    I used "always on top" (keywords taken from your topic) and found plenty of advice.

  • 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 JFrame ToFront to all applications

    HI
    My problem is i have a JFrame where in i have a JCheckBock and when i check it my frame should be top from all applications opened(like MS Word,notepad or any window) and when it is dechecked it should be back when any application is opened . I tried in solaris by using toFront() but no result is found any suggestions please...

    You should use JLayeredPane as container of your objects. It has a method called "setLayer", or similar, through which you can assign Z-Order to the objects contained in it.
    See the JDK Documentation on "JLayeredPane" topic.

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

Maybe you are looking for

  • Error while upgrading Patch SAPKB70014- Error R3trans received signal 11

    Dear All while updating my basis patch level to sapkb70014 I m facing the error at DDIC import phase related to R3trans recived signal 11.My tp version is accurate as required . Kernel versin is 238 Can you guys help me to solve the same Regards Shil

  • How to get Service instance host name(s)

    I have a a list of Cloud Service host names that are connected to our azure DB host_name RD00133D57C3B2 RD00133D80CF2E RD00133D52C765 RD00133D52CE41 RD00133D52C926 But i have no idea how to tell which cloud services those are. Get-AzureService, Get-A

  • Username and password For Base station Disk

    I have a AEBS and i have a Lacie 500Gb Disk, i am trying to use the Backup feature on Windows Ultimate and it asks for a Username and password. dose any body have any ideas. I have tryed it using the Accounts and it doesn't work i want to use the dis

  • I dont know how to set a site setup and edit some ready html files

    how to set up a site in dreamweaver when using a WAMP SERVER and edit some html files

  • Are time machine backups bootable?

    My hard disc is making weird noises and im expecting it to blow anytime soon, so I need to make sure I have regular backups that will be able to restore another drive to exactly as my current drive. I used to use super duper on OSX4.11 which was perf