Results 1 to 4 of 4
  1. #1
    manu001 is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default Scrollbar to mainframe want imeediate response

    i am creating a net beans project...
    i wants to set scrollbar to main frame..
    creating an instance and giving that instance to main frame is ok but i am not getting with that.

    can any one help me that how to set scrollbar for mainframe in netbeans project?

    another one is how to close a particular inner frame when we click a button on that frame....

    thanks in advance

    manoj

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You're not giving us much information that will allow us to help you, such as your critical code. Have you gone through the scrollbar tutorials in the Swing tutorials? If not, I suggest that you start there. If you're still stuck, then show us your code and give us a lot more information on your problem, and then perhaps we can help.

    Oh, also, it's not looked kindly here when folks demand an "immediate response", and you would do well to delete that line from your topic heading. It suggests that the poster is pushy and feels that his post is more important than anyone else's. Sorry to burst your bubble, but, it's not.

    Best of luck.
    Last edited by Fubarable; 03-11-2011 at 12:35 PM.

  3. #3
    manu001 is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default Scrollbar for Frame

    Java Code:
    public NewProjectView(SingleFrameApplication app) {
            super(app);
    
            initComponents();
    
            // status bar initialization - message timeout, idle icon and busy animation, etc
            ResourceMap resourceMap = getResourceMap();
            int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
            messageTimer = new Timer(messageTimeout, new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    statusMessageLabel.setText("");
                }
            });
            messageTimer.setRepeats(false);
            int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
            for (int i = 0; i < busyIcons.length; i++) {
                busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
            }
            busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                    statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
                }
            });
            idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
            statusAnimationLabel.setIcon(idleIcon);
            progressBar.setVisible(false);
    
            // connecting action tasks to status bar via TaskMonitor
            TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
            taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    String propertyName = evt.getPropertyName();
                    if ("started".equals(propertyName)) {
                        if (!busyIconTimer.isRunning()) {
                            statusAnimationLabel.setIcon(busyIcons[0]);
                            busyIconIndex = 0;
                            busyIconTimer.start();
                        }
                        progressBar.setVisible(true);
                        progressBar.setIndeterminate(true);
                    } else if ("done".equals(propertyName)) {
                        busyIconTimer.stop();
                        statusAnimationLabel.setIcon(idleIcon);
                        progressBar.setVisible(false);
                        progressBar.setValue(0);
                    } else if ("message".equals(propertyName)) {
                        String text = (String)(evt.getNewValue());
                        statusMessageLabel.setText((text == null) ? "" : text);
                        messageTimer.restart();
                    } else if ("progress".equals(propertyName)) {
                        int value = (Integer)(evt.getNewValue());
                        progressBar.setVisible(true);
                        progressBar.setIndeterminate(false);
                        progressBar.setValue(value);
                    }
                }
            });
        }
    
    
    
    public void showAboutBox() {
            if (aboutBox == null) {
                JFrame mainFrame = NewProjectApp.getApplication().getMainFrame();
                aboutBox = new NewProjectAboutBox(mainFrame);
                aboutBox.setLocationRelativeTo(mainFrame);
            }
            NewProjectApp.getApplication().show(aboutBox);
    is the constructor(NewProjectView) and component box(showAboutBox()) for my project which is automatically generated by netbeans...

    i am writing as

    JScrollPane pain=new JScrollPane(jPanel5,JScrollPane.HORIZONTAL_SCROLLB AR_ALWAYS,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    and i wants to add it to mainframe

    as """mainframe.add(pain);"""

    but i am not getting how can i get it help me please....
    Last edited by Fubarable; 03-11-2011 at 02:14 PM. Reason: Moderator Edit: Code tags added

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Often the key to adding a component to a container is to know which layout manager(s) to use. If you want to alter the components of a container in code and not in the NetBeans drag-and-drop designer, then you're going to want the component to use a layout other than the NetBeans default GroupLayout. Check out the tutorial on layout managers to learn more about this: Laying Out Components Within a Container

Similar Threads

  1. Java for mainframe professionals
    By tomehta in forum New To Java
    Replies: 6
    Last Post: 06-09-2010, 03:07 PM
  2. ScrollBar in a JList
    By lupo in forum AWT / Swing
    Replies: 2
    Last Post: 05-20-2010, 11:42 PM
  3. Looking for Java, Mainframe and QA Leads
    By ITrecruiter in forum Jobs Wanted
    Replies: 0
    Last Post: 04-20-2010, 07:53 AM
  4. scrollbar issue
    By kumar_gemi in forum NetBeans
    Replies: 1
    Last Post: 05-03-2009, 11:23 PM
  5. Calling mainframe IMS program from Java
    By babu95 in forum New To Java
    Replies: 2
    Last Post: 12-21-2007, 02:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •