JScrollPane (added to a JPanel, which paints) is visible but does nothing

Hi. I am writing a program that reads data from files and does paiting using the info. The top level window is a JFrame, which is divided into two parts - A Box which contains the buttons through which the user interacts and a JPanel on which the painting is done. I have added the JPanel to a JScrollPane, but have run into problems there. The JScrollPane is visible (both policies always visible) but it does nothing. I understand that when the drawing is fitting, the ScrollPane is not used. But even if I make the window small or draw something that is not visible in the normal are, the JScrollPane doesn't work. In fact, no knob is visible on either of the two scrollbars. I am pasting the relevant code below:
//import
public class MainWindow extends JFrame {
    public static void Main(String[] args) {
        new MainWindow();
    //Declare all the variables here.
    private Box buttionBox;
    private JScrollPane scroller;
    private HelloPanel drawingPanel;   
    //other variables
    //The constructor for the class MainWindow.
    public MainWindow() {
       initComponents();
        this.setLayout(new BorderLayout());
        this.setPreferredSize(new Dimension(900,670));
        //buttonBox containts the buttons - not very relevant to this problem.
        this.getContentPane().add(buttonBox, BorderLayout.WEST);
        //scroller is the JScrollPane
        this.getContentPane().add(scroller, BorderLayout.CENTER);       
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setTitle("My Title");       
        this.setVisible(true);
        this.pack();       
    public void initComponents() {
        buttonBox = Box.createVerticalBox();
        //instantiate the buttons here and add them to the ButtonBox.
        //The event listeners instantiated. Not relevant.       
        //The various components are assigned their appropriate event listeners here.
         //Not relevant.
//Now adding all the buttons to the box with proper spacing.
        buttonBox.add(Box.createVerticalStrut(20));
        //This is the drawing panel on which the drawing will be done.
        drawingPanel = new HelloPanel();
        scroller = new JScrollPane(drawingPanel);
                scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        scroller.getHorizontalScrollBar().setUnitIncrement(10);
        scroller.getVerticalScrollBar().setUnitIncrement(10);
    //This inner class is used to define and implement the event listener for handling the checkboxes.
    private class checkBoxListener implements ItemListener{
        public void itemStateChanged(ItemEvent e){
             drawingPanel.repaint();
                //Implement actions. Irrelevant
    //This private class is used to define and implement the event listener for the buttons.
    private class buttonListener implements ActionListener {
        //Do this when the button which has an instance of this class as its listener is clicked.       
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() == saveStructureButton){
              //Implement action. Irrelvant.
    //The panel on which the drawings are done.
    private class HelloPanel extends JPanel {
        //This JPanel is used for drawing the image (for the purpose of saving to disk).
        JComponent c;    //For image. Irrelevant.
        public HelloPanel(){           
            c = this;   //This is necessary for drawing the image to be saved to disk.
            this.setBackground(Color.WHITE);
        //This is the method that actually paints all the drawings whenever a.
        //The shapes theselves can be defined somewhere else, but that paint method must be invoked from here.
        public void paintComponent(Graphics g){
            super.paintComponent(g);    //First of all, clear the panel.
            Graphics2D g2 = (Graphics2D) g;
            g2.fill(new Rectangle2D.Double(40,40,100,100));    //Just for this post.
            g2.drawString("Text", 750, 750);    //To test the scrollpane.
} I hope this helps you get an idea of what I am trying to do and what the problem might be. Any help would be really appreciated. I have spent hours on this and I have no idea why it doesn't work.
The actual code is much bigger, so if you need any extra information, please tell me.

HelloPanel should provide a "public Dimension getPreferredSize()" method.
With your code you create a simple JPanel and want to draw outside of it, but you never tell the JScrollPane that your HelloPanel is actually bigger than it seems, that's why it does not feel the need to add scroll bars.
Here's the working code:
//import
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
public class MainWindow extends JFrame {
    public static void main(String[] args) {
        new MainWindow();
    //Declare all the variables here.
    private Box buttionBox;
    private JScrollPane scroller;
    private HelloPanel drawingPanel; 
    //other variables
    //The constructor for the class MainWindow.
    public MainWindow() {
       initComponents();
        this.setLayout(new BorderLayout());
        this.setPreferredSize(new Dimension(900,670));
        //buttonBox containts the buttons - not very relevant to this problem.
        //this.getContentPane().add(buttonBox, BorderLayout.WEST);
        //scroller is the JScrollPane
        this.getContentPane().add(scroller, BorderLayout.CENTER);       
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setTitle("My Title");       
        this.setVisible(true);
        this.pack();       
    public void initComponents() {
        //buttonBox = Box.createVerticalBox();
        //instantiate the buttons here and add them to the ButtonBox.
        //The event listeners instantiated. Not relevant.       
        //The various components are assigned their appropriate event listeners here.
         //Not relevant.
//Now adding all the buttons to the box with proper spacing.
        //buttonBox.add(Box.createVerticalStrut(20));
        //This is the drawing panel on which the drawing will be done.
        drawingPanel = new HelloPanel();
        scroller = new JScrollPane(drawingPanel);
                scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        scroller.getHorizontalScrollBar().setUnitIncrement(10);
        scroller.getVerticalScrollBar().setUnitIncrement(10);
    //This inner class is used to define and implement the event listener for handling the checkboxes.
    private class checkBoxListener implements ItemListener{
        public void itemStateChanged(ItemEvent e){
             drawingPanel.repaint();
                //Implement actions. Irrelevant
    //This private class is used to define and implement the event listener for the buttons.
    private class buttonListener implements ActionListener {
        //Do this when the button which has an instance of this class as its listener is clicked.       
        public void actionPerformed(ActionEvent e) {
            //if (e.getSource() == saveStructureButton){
              //Implement action. Irrelvant.
    //The panel on which the drawings are done.
    private class HelloPanel extends JPanel {
        //This JPanel is used for drawing the image (for the purpose of saving to disk).
        JComponent c;    //For image. Irrelevant.
        public HelloPanel(){           
            c = this;   //This is necessary for drawing the image to be saved to disk.
            this.setBackground(Color.WHITE);
        //This is the method that actually paints all the drawings whenever a.
        //The shapes theselves can be defined somewhere else, but that paint method must be invoked from here.
        public void paintComponent(Graphics g){
            super.paintComponent(g);    //First of all, clear the panel.
            Graphics2D g2 = (Graphics2D) g;
            g2.fill(new Rectangle2D.Double(40,40,100,100));    //Just for this post.
            g2.drawString("Text", 750, 750);    //To test the scrollpane.
     public Dimension getPreferredSize()
     return new Dimension(750,750);
}

Similar Messages

  • Photos ap on mac will not email. shows "more" for extensions which has Outlook checked but does me no good

    Why will new Photos ap on mac not email? No "email" pulldown  -shows "more" for extensions which has Outlook checked but does me no good.

    I am struggling with the same problem. I have two HP 4100dtn printers on ethernet. Each has a manually assigned IP address. I can set up the printer(s) just fine in the Print & Fax Preference and Snow Leopard finds the printer just fine when I enter the IP address and chooses the correct HP Driver.
    When I try to print, my print job appears in the queue as expected, than an error appears that something about a "bad command". Sorry, I'm home right now and don't have direct access to the printer so I can't give you the precise language of the message, but the gist of the message is that the system tried to connect to the printer to send the print data but the printer does not know how to respond to the command that was sent.
    It's as if the firmware in the 4100 just doesn't have something in it's lexicon that Snow Leopard needs. The HP web site is no help. One page I found says the printer is supported (http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?lang=en&cc=us&obje ctID=c01664444&jumpid=regR1002USEN ) and another page I found says that it is not supported (http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?lang=en&cc=us&obje ctID=c01879014&jumpid=regR1002USEN). The HP on line chat won't let me log in and hold a chat with HP unless I know the Serial Number of the printer, which I don't have here at home.
    More to follow tomorrow.
    Anyone have any ideas?

  • How do I see a book which has been downloaded, but does not show in Adobe Reader XI?

    How do a find a ePub book in Adobe Reader XI, which has been downloaded and does not show up? janf76607913

    Visit:
    Adobe Digital Editions
    Be well...

  • I need to upload file from my computer to website, when I click browse to look at which documents I want it does nothing.

    I need to upload file to quicken loans I click the blue button that says Browser on it so I can search what documents to upload it doesn't open the folders to look for the documents to select.

    Hi there. you have '''search.conduit''' set up as your '''about:newtab''' page.
    This could be add-ware. Is this what you want?
    '''[https://addons.mozilla.org/en-US/firefox/addon/searchreset/ Mozilla Search Reset]''' {web link}
    This add-on is very simple: on installation, it backs up
    and then resets your search preferences and home page
    to their default values, and then uninstalls itself. This
    affects the search bar, URL bar searches, and the home
    page.

  • Elements in JPanel not painting when positioned absolutely

    I am designing a superclass that extends JPanel which will have methods like addTextField(int x, int y, int w, int h). Basically it just creates the named component at the given coordinates, positioned absolutely on the panel.
    Here's the important snipits of my code... but nothing shows up on the window when I run the applet that uses these panels. It's just blank. Can anyone tell me why?
    public class MinionsGCPanel extends JPanel implements ActionListener, ListSelectionListener
    <snip>
         // Constructor
         public MinionsGCPanel(MinionsGC svr){
              super();
              server = svr;
              setLayout(null);
              setSize(800, 600);
              setVisible(true);
              components = new ArrayList<Component>();
         // Add a component
         protected void add(Component com, int x, int y, int w, int h){
              com.setBounds(x, y, w, h);
              components.add(com);
         // Add a label
         protected MLabel addLabel(int x, int y, int w, int h, String text){
              MLabel l = new MLabel(text);
              add(l, x, y, w, h);
              return l;
    <snip>
         // Repaint
         public void paint(Graphics g){
              super.paint(g);
              Iterator it = components.iterator();
              while(it.hasNext()){
                   Component c = (Component) it.next();
                   c.repaint();
    }Edited by: L4E_WakaMol-King on Oct 29, 2007 10:23 PM

    Here's an actual instance of a subclass of that class:
    public class LoginPanel extends MinionsGCPanel
    <snip>
         // Constructor
         public LoginPanel(MinionsGC svr){
              super(svr);
         // Draw GUI
         public void refresh(){
              super.refresh();
              username = addTextField(50, 50, 200, 20);
              password = addPasswordField(50, 80, 200, 20);
              loginButton = addButton(50, 110, 100, 20, "Login");
    <snip>
    }And the applet itself:
    public class MinionsGC extends JApplet
    <snip>
         // Prompt for login
         public void dologin(){
              switchPanels(loginPanel);
    <snip>
         // Load Panels
         public void loadPanels(){
              loginPanel = new LoginPanel(this);
              chatPanel = new ChatPanel(this);
              logoffPanel = new LogoffPanel(this);
    <snip>
         // Switch panels
         public void switchPanels(MinionsGCPanel p){
              p.refresh();
              setContentPane(p);
              currentPanel = p;
              validate();
    <snip>
    }Edited by: L4E_WakaMol-King on Oct 30, 2007 8:52 AM

  • How to Serialize a JPanel which is inside a JApplet

    Hi..
    I have a JApplet where i have a JPanel which contains some JLabels and JTextFields,now i have to Serialize that full Panel so that i can retrived it later on with the labels and textfields placed in the same order,for that i tried serializing the full panel on to a file but it is giving me NotSerializeException,i dont know how to tackel it..
    public SaveTemplate(JPanel com) {
    try {
    ObjectOutputStream os=new ObjectOutputStream(new FileOutputStream("Temp1.temp"));
    os.writeObject(com);
    catch(Exception e) {
    e.printStackTrace();
    This is the code..plz help me with that..

    Actually its forming a Template which client will generate and that has to saved on the serverside..So what i thought that once when the client has designed a template,i can save the full template which is a panel into a file and later on when he want to open the template i just have to read the file and create an object of JPanel and add to the frame,so i dont need to apply much effort for that...But now serialization in Applet is giving problem.

  • Can I upgrade to Lion with an Intel iMac with 1 GB RAM. I am getting conflicting info (from Apple advisors) whether I need 2GB -which I can do by adding 1, or 3 -which apparently I can't do. Anybody successful in upgrading to Lion with 1 or 2 GB Ram?

    I am getting conflicting info (from Apple folks) whether I can upgrade to Lion with 1 GB Ram. Some are saying I need 2 (which I can do by adding memory) - or 3 (which I'm not sure I can do). Anyone running Lion with 1 GB? 2? I am at Leopard 10.5.8 to run some recording mixer which the company (Alesis) told me they weren't going to support drivers to Lion, but I guess they changed their minds. Am I clear on this? thanks.

    The hardware requirements for Lion are an intel Core 2 Duo processor and 2GB RAM.
    I wouldn't even both trying with 1GB, and even with 2GB Lion may struggle. If you intend to upgrade to Lion, can I suggest you max out your RAM. RAM is cheap at the moment.
    Which model mac mini do you have?

  • On implementingthe paint method, the panel does not up

    Hi,
    I have a panel over which i am adding a second panel.
    the second panel appears but when i implement the paintmethod() of second panel, it does not show...
    what can be the reason???
    deepak

    hi!
    i included the statement super.paint(g); in the paint method and now i can see the panel.
    Following is the paint() method i have written, the on;y problem left is that i can't see the images i had drawn...otherwise line and rectangles are coming fine
    super.paint(g);
                        if(showImage)
                                  Point pe0 = new Point(180, 110);
                                  Point pe1 = new Point(180, 280);
                                  Point p0 = new Point(138, 182);
                                  Point ce0 = new Point(120, 75);
                                  Point ce2 = new Point(240, 75);
                                  Point ce1 = new Point(120, 380);
                                  Point ce3 = new Point(240, 380);
                                  g.drawImage(verticalCloudImage, (int)p0.getX() - 20, (int)p0.getY() - 85, this);
                                  g.drawImage(peImage, (int)pe0.getX(), (int)pe0.getY(), this);
                                  g.drawImage(peImage, (int)pe1.getX(), (int)pe1.getY()+35, this);
                                  g.drawImage(cloudImage, (int)ce0.getX()-88, (int)ce0.getY()-52, this);
                                  g.drawImage(ceImage, (int)ce0.getX(), (int)ce0.getY(), this);
                                  g.drawImage(cloudImage, (int)ce2.getX(), (int)ce2.getY()-45, this);
                                  g.drawImage(ceImage, (int)ce2.getX(), (int)ce2.getY(), this);
                                  g.drawImage(cloudImage, (int)ce1.getX()-88, (int)ce1.getY()-22, this);
                                  g.drawImage(ceImage, (int)ce1.getX(), (int)ce1.getY(), this);
                                  g.drawImage(cloudImage, (int)ce3.getX(), (int)ce3.getY()-22, this);
                                  g.drawImage(ceImage, (int)ce3.getX(), (int)ce3.getY(), this);
                                  int ceHeight = ceImage.getHeight(this);
                                  int ceWidth = ceImage.getWidth(this);
                                  int peHeight = peImage.getHeight(this);
                                  int peWidth = peImage.getWidth(this);
                                  int pHeight = pImage.getHeight(this);
                                  int pWidth = pImage.getWidth(this);
                                  g.drawLine((int)ce0.getX() + ceWidth/2, (int)ce0.getY() + ceHeight,
                                            (int)pe0.getX() + peWidth/2, (int)pe0.getY());
                                  g.drawLine((int)ce2.getX() + ceWidth/2, (int)ce2.getY() + ceHeight,
                                            (int)pe0.getX() + peWidth/2, (int)pe0.getY());
                                  g.draw3DRect((int)pe0.getX() + peWidth/2 - 3, (int)pe0.getY() + peHeight - 1,
                                                 5, (int)p0.getY() - (int)pe0.getY() - peHeight - 2+23, true);
                                  g.draw3DRect((int)p0.getX() + pWidth/2 - 10, (int)p0.getY() + peHeight - 1+20,
                                                 5, (int)pe1.getY() - (int)p0.getY() - peHeight + 2+15, true);
                                  g.fill3DRect((int)pe0.getX() + peWidth/2 - 3, (int)pe0.getY() + peHeight - 1,
                                                 5, (int)p0.getY() - (int)pe0.getY() - peHeight - 2+23, true);
                                  g.fill3DRect((int)p0.getX() + pWidth/2 - 10, (int)p0.getY() + peHeight - 1+20,
                                                 5, (int)pe1.getY() - (int)p0.getY() - peHeight + 2+15, true);
                                  g.drawLine((int)ce1.getX() + ceWidth/2, (int)ce1.getY(),
                                                 (int)pe1.getX() + peWidth/2, (int)pe1.getY() + peHeight+35);
                                  g.drawLine((int)ce3.getX() + ceWidth/2, (int)ce3.getY(),
                                                 (int)pe1.getX() + peWidth/2, (int)pe1.getY() + peHeight+35);

  • I have purchased many movies on iTunes, now they are adding closed captioning or subtitles to those movies, BUT can not reload them so I can view those subtitles.  I am mentally disabled and need the subtitles.

      Hello,  To start off, I have been a member of iTunes for awhile and have been content with them, until now.  I am legally disabled due to a head injury that happened when I was a teenager.  I am everyday functional, but I do need closed captioning(cc) or subtitles to understand the movie or TV show.  I have purchased lots of movies and TV shows from iTunes.  As any new business does, iTunes has updated itself and added features for their customers. They figure out what the consumers want and like.  I started to realize that iTunes added subtitles for the deaf and disabled, but as I was told by Apple there was nothing I could do about reloading those already purchased movies, to include the cc or subtitles.  Since then, I don't use iTunes and it's a real shame because I love electronics and it's technology.  I wish Apple would work with the consumer.  Why can't I reload the iTunes movies on my PC (Win7) with the subtitles, which they now offer, but didn't when I purchased them?  To me, that is wrong to do that to a customer.  Now that they are including cc/subtitles , everyone is able to enjoy iTunes and not be excluded.   Someone__please explain this to me.  Thank you for reading this.
    Carrie-

    Untill the movie studios agree to allow past downloads of movies outside of the US, you aill always have to have a copy of purchased movies on your computer. If not, you will have to buy them again if you delete them.

  • I need to edit out parts of a song to cut it down to two minutes for my daughter's talent show. I went to info and it will cut down one part but only one part. I need to put three parts together. I tried adding duplicates of the song to the list but if I

    I need to edit out parts of a song to cut it down to two minutes for my daughter's talent show. I went to info/start time and it will cut down one part but only one part. I need to put three parts together. I tried adding duplicates of the song to the list but if If I change the start time on one it will change it on all of them.

    In your library, right-click the song you want to edit.
    select "get info".
    go to "options" and select the start and stop times for your first section of the song.
    click "OK".
    Find the shortened version of the song in your library. It may take a minute for it to show up. right click it again and select "create (????) version". (the ???? is different for different formats).
    The library will spit out a new, second version of the song which you can rename. I suggest you use the original title and add a 1 to the end.
    Now you can go back to the other version and repeat the process with a different  start/stop time.
    Once you are done editing, you can burn all of your versions to a disk, just make sure your interval time is zero so there are no gaps between edits.
    To keep the orginal song on your library, just go back to the original and put the start/stop times back to the original settings.

  • Why is a 'globe' contact available in Global Address List (which belongs to AD), but I cannot find it on AD server?

    I have a topic at link:
    http://social.msdn.microsoft.com/Forums/en-US/7b74fd63-1d0d-449e-9f31-83b707683053/finding-microsoft-document-about-globe-contact-in-outlook-address-book?forum=outlookdev&prof=required
    Please see the post first.
    I dot not make sense about why a 'globe' contact is available in Global Address List (which belongs to AD), but I cannot find it on AD server? I think the cause relates to Exchange server.
    Could you give me an explaination!
    Thanks advance.

    And here the Documentation:
    http://technet.microsoft.com/en-us/library/bb201680.aspx
    Mail contacts
    Mail contacts typically contain information about people or organizations that exist outside your Exchange organization. Mail contacts can appear in your organization’s shared address book (also called the global address list or GAL) and other address lists,
    and can be added as members to distribution groups. Each contact has an external email address, and all email messages that are sent to a contact are automatically forwarded to that address. Contacts are ideal for representing people external to your Exchange
    organization (in the shared address book) who don't need access to any internal resources. The following are mail contact types:
    Mail contacts   These are mail-enabled Active Directory contacts that contain information about people or organizations that exist outside your Exchange organization.
    Mail forest contacts   These represent recipient objects from another forest. These contacts are typically created by directory synchronization. Mail forest contacts are read-only recipient objects that can be updated or
    removed only by means of synchronization. You can't use Exchange management interfaces to modify or remove a mail forest contact.
    Georg

  • Repaint region of scrollpane which is not visible.

    i ve a chart in a scrollpane. when i m chaging the content of the graph explicitly, the region which is not visible is not getting repainted. any suggestions on how to about this.
    Thanks

    If its not visible how do you know its not getting
    repainted?
    i ve a number of graphs(jfreecharts) in the scrollpane. I m zooming them synchronously, some of them r hence not visible.But unlessl i scroll down once to see all the graphs and then zoom, i get exceptions as the graph has not been drawn. The same applies when i make some other explicit changes without having the graph in view.
    This is done on purpose for better response time. Why
    waste CPU painting something that isn't visible.I need to paint somwthing which is invisible this time..
    Thanks

  • SAN Transfer - Virtual Machine resides on a LUN, which is not visible to any of the storage providers._

    Hi,
    i'm trying to migrate a vm from a Windows Server 2008 R2 Hyper-V host to a Windows Server 2012 R2 Hyper-V host with VMM 2012 R2 using SAN Transfer. We use a Fujitsu Eternus DX60 Storage Unit. The Fujitsu VDS HW Provider is installed on
    the VM that hosts VMM 2012 R2 and is configured to connect to the storage.
    The Migration wizard Shows the following info in the "Deployment and Transfer Explanation" and only allows LAN Transfer: 
    Virtual Machine XXX resides on a LUN, which is not visible to any of the storage providers.
    I know that i have done this successfully before i upgraded to VMM2012 R2 using VMM2008R2 on a Windows Server 2008 R2.
    I'm very thankful for any ideas on how to enable SAN Transfer.
    Thanks in advance!
    Timo

    So, I fixed it - Kinda...
    I had to remove the SMI-S provider to my SAN (Again). Ensure I put a valid and signed CA Cert for the SMI-S provider (5989 = SSL 5988 no_ssl) in a PEM format (Base 64).
    I then added this to the storage providers section along with a storage classification.
    Now, when I run the 'Store in Library' option again and now even though I get the same error - The next button isn't greyed out and the migration works!?!
    Weird, yes, workable, yes....

  • LaserJet Pro M1536dnf trouble sending fax...just says fax job added but does not send out

    LaserJet Pro M1536dnf trouble sending fax...just says fax job added but does not send out.  How do I repair?
    Thanks!

    Hi @LWest322 ,
    I see that you are having issues with the fax not sending the fax. I can help you.
    The settings would be under the Fax Menu button, Send Options, Send Fax Later.
    I don't believe there is a option though to turn it off or on, just to set the date and time.
    I can send you the reset for the printer in a private message, which resolve this issue.
    In the forum beside your handle name just click on the envelope to view it.
    Have a nice day!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • Have an airplay enabled AV Receiver - how do i set up Airplay    I have a Yamaha RX-V673 which is Airplay enabled, but i can't get Airplay to work either on my Mac book or my iphone. The receiver is connected to my network and i can control it using the

    have an airplay enabled AV Receiver - how do i set up Airplay
    I have a Yamaha RX-V673 which is Airplay enabled, but i can't get Airplay to work either on my Mac book or my iphone. The receiver is connected to my network and i can control it using the iphone App and via the web browser option.
    Do I need Apple TV or to change some settings somewhere?
    Any help would be greatly appreciated

    You are making some progress with setup of wireless network. Apparently there is reliability problem with the wireless connection. Perhaps you want to refer to following Apple support documents and start tweaking parameters in the router to improve the reliability. I used to have third-party routers such as Belkin and Netgear but switched to Apple Airport routers (Time Capsule then Airport Extreme for now) because of incompatibility issues whenever Apple upgrade Mac OS X. But since Apple develops Airplay protocol as alternative to Bluetooth for wireless audio/video streaming (with much better bandwidth) and must be deployed in any wireless network, there is no reason third-party routers not working for Airplay protocol.
    About AirPlay Mirroring in OS X Mountain Lion:
    http://support.apple.com/kb/HT5404
    iOS: Recommended settings for Wi-Fi routers and access points:
    http://support.apple.com/kb/HT4199
    Troubleshooting AirPlay and AirPlay Mirroring:
    http://support.apple.com/kb/TS4215
    Good luck in setting up 802.11 wirelesss network.

Maybe you are looking for