Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help with BrowserLauncher2 and NetBeans

807600Jun 28 2007 — edited Jun 29 2007
Hey guys, I'm new to Java and am having a lot of fun writing my own programs.

Right now I'm trying to incorporate the BrowserLauncher2 (http://browserlaunch2.sourceforge.net/) library into my Netbeans 5.5.1 project running on Mac OSX 10.4.10.

I have included the BrowserLauncher2 library using Tools --> Library Manager and placed it in my "compile-time libraries" by right-clicking on the Libraries-->Properties in the Project screen but I still get an error when I try to call a URL.

I call it using: BrowserLauncher().openURLinBrowser("http://www.google.com"); and I receive the error

/Users/Krish/Programming/NetBeans/MusicFestivals_Revamped/src/$2007/learn.java:179: cannot find symbol
symbol : method BrowserLauncher()
location: class $2007.learn
BrowserLauncher().openURLinBrowser("http://www.google.com");


I'm sure I'm just not instantiating/importing the library properly but am really lost as to how to do it.
I've tried googling but there doesn't seem to be any Netbeans and BrowserLauncher2 guide/how-to yet so maybe we could help create one.


Thanks in advance!

Here's my code:
/*
 * learn.java
 *
 * Created on June 28, 2007, 8:40 PM
 */

package $2007;

    
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import java.net.URL;
//import BrowserLauncher2;




    
/**
 *
 * @author  Krish
 */
public class learn extends javax.swing.JFrame {
    
    
    
    
    final String[] columnNames = {"Festival Name",
    "URL",
    "Begins",
    "Ends",
     "Hide me!"};
     
    
    final Object[][] data = {
        {"National Orchestral Institute","http://www.music.umd.edu/special_programs/national_orchestral_institute/","6-1-07","6-30-07"},
                {"Tafelmusik; Baroque Summer Music Institute","http://tafelmusik.org/training/tbsi/bsi.htm","6-1-07","6-14-07"},
                {"Texas Music Festival","http://www.uh.edu/tmf/","6-1-07","6-30-07"},
                {"Hot Springs Music Festival","http://www.hotmusic.org/apprentices.htm","6-2-07","6-16-07"},
                {"Domaine Forget: Brass Session","http://www.domaineforget.com/en/academie/cor.shtml","6-3-07","6-17-07"},
                {"Round Top, The International Music Festival at","http://festivalhill.org/Summerprogram.html","6-3-07","7-15-07"},
                {"Sarasota Music Festival","https://tickets.fwcs.org/public/load_screen.asp?screen=Sarasota_Music_Festival","6-4-07","6-23-07"},
                {"Sunflower Music Festival","http://www.sunflowermusicfestival.org/","6-5-07","6-12-07 (6-16-07 faculty concerts)"},
                {"Colorado College Summer Music Festival","http://www.coloradocollege.edu/SummerPrograms/SummerFestivaloftheArts/musicfestival/","6-9-07","7-4-07"},
                {"Kendall Betts Horn Camp","http://horncamp.org/","6-9-07","6-24-07"},
                {"Wintergreen Summer Music Academy","http://wintergreenperformingarts.org/index.php?pageId=45","6-9-07","6-29-07"},
                {"National Repertory Orchestra","http://www.nationalrepertoryorchestra.com/","6-10-07","8-5-07"},
                {"Rocky Ridge Music Center; Young Artists Seminar","http://www.rockyridge.org/index.htm","6-11-07","7-15-07"},
                {"Aspen Music Festival; Instrumental Program, American Academy of Conducting, Courses","http://www.aspenmusicfestival.com/","6-13-07","8-19-07"},
                {"Music Academy of the West; Instrumental Program","http://www.musicacademy.org/","6-15-07","8-12-07"},
                {"Sewanee Music Festival","http://www2.sewanee.edu/ssmf","6-16-07","7-22-07"},
                {"Boston University Tanglewood Institute; French Horn Workshop","http://www.bu.edu/cfa/music/tanglewood/","6-17-07","6-30-07"},
                {"ARIA International Music Festival","http://www.bsu.edu/web/cfa/music/aria/","6-18-07","7-14-07"},
                {"Pierre Monteux School","http://www.monteuxschool.org/","6-18-07","7-29-07"},
                {"Brevard Music Center","http://www.brevardmusic.org/index.php","6-20-07","8-5-07"},
                {"Tanglewood Music Center; Instrumental and Orchestral Studies Fellowship","http://www.tanglewood.org/itemB/detail2columnTMC.jhtml?id=22800036&area=tgl","6-21-07","8-20-07"},
                {"Bowdoin International Music Festival","http://www.summermusic.org/","6-23-07","8-4-07"},
                {"Chautauqua Music Festival","http://music.ciweb.org/","6-23-07","8-14-07"},
                {"Eastern Music Festival","http://www.easternmusicfestival.org","6-23-07","7-29-07"},
                {"Bar Harbor Brass","http://www.barharborbrass.org./","6-24-07","7-1-07"},
                {"Mannes Theory","http://216.71.55.88/mi/","6-24-07","6-27-07"},
                {"New York Summer Music Festival","http://www.nysmf.org/","6-24-0","8-4-07"},
                {"Kent/Blossom Music","http://dept.kent.edu/blossom/index.htm","7-1-07","8-12-07"},
                {"Manchester Music Festival; Young Artists Program","http://www.mmfvt.org/index.cfm","7-1-07","8-14-07"},
                {"Norfolk Chamber Music Festival; Chamber Music Session","http://www.yale.edu/norfolk/SchoolPrograms.htm","7-1-07","8-12-07"},
                {"Yellow Barn Music School & Festival; Yellow Barn Program","http://www.yellowbarn.org/musicschool/yb.php","7-1-07","8-5-07"},
                {"Banff Center; Master Classes","http://www.banffcentre.ca/programs/program.aspx?id=575","7-2-07","7-20-07"},
                {"NSO Summer Music Institute","http://www.kennedy-center.org/nso/nsoed/smi/","7-2-07","7-29-07"},
                {"Burgos Chamber Music Festival","http://www.burgosmusicfestival.com/home.htm","7-3-07","7-15-07"},
                {"Schleswig-Holstein Music Festival","http://www.shmf.de/oa/","7-6-07","9-3-07"},
                {"California Summer Music","http://www.csmusic.org/","7-7-07","7-30-07"},
                {"Pacific Music Festival","http://www.pmf.or.jp/index_en.html","7-7-07","8-1-07"},
                {"Institut Musical de Provence-Aubagne: Orchestral Workshop","http://www.impamusic.com/","7-11-07","7-20-07"},
                {"Fairbanks Summer Music Festival","http://www.fsaf.org/","7-15-07","7-29-07"},
                {"International Brass Quintet Summer Seminar","http://www.atlanticbrassquintet.com/seminar.php","7-21-07","8-3-07"},
                {"Marrowstone Summer Music","http://marrowstone.syso.org/","7-22-07","8-5-07"},
                {"Banff Center;  Brass Residency","http://www.banffcentre.ca/programs/program.aspx?id=577","7-23-07","8-4-07"},
                {"Banff Center; Opera & Concert Orchestra Residency","http://www.banffcentre.ca/programs/program.aspx?id=579","7-23-07","8-12-07"},
                {"Rafael M?ndez Brass Institute","http://mendezbrassinstitute.com/","7-23-07","7-28-07"},
                {"Las Vegas Music Festival","http://www.lasvegasmusicfestival.org/","7-27-07","8-12-07"},
                {"Viana do Castello International Music Festival","http://www.vianamusicfest.org/index.html","8-1-07","8-15-07"},
                {"Domaine Forget: New Music","http://www.domaineforget.com/en/academie/musNouvelle.shtml","8-12-07","8-25-07"}

    };
    


    /** Creates new form learn */
    public learn() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        jScrollPane2 = new javax.swing.JScrollPane();
        myTextArea = new javax.swing.JTextArea();
        jScrollPane1 = new javax.swing.JScrollPane();
        table = new org.jdesktop.swingx.JXTable();
        giftLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        myTextArea.setColumns(20);
        myTextArea.setRows(5);
        jScrollPane2.setViewportView(myTextArea);

        jScrollPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jScrollPane1MouseEntered(evt);
            }
        });

        table.setModel(new DefaultTableModel(data, columnNames));
        table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
        table.setColumnControlVisible(true);
        table.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableMouseClicked(evt);
            }
        });

        jScrollPane1.setViewportView(table);

        giftLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/$2007/gift.gif")));
        giftLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                giftLabelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane2)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 548, Short.MAX_VALUE))
                .add(30, 30, 30)
                .add(giftLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                        .add(25, 25, 25)
                        .add(giftLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 268, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(35, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>                        

    private void giftLabelMouseClicked(java.awt.event.MouseEvent evt) {                                       
// TODO add your handling code here:
        BrowserLauncher().openURLinBrowser("http://www.google.com");
        
 
    }                                      

    private void formWindowActivated(java.awt.event.WindowEvent evt) {                                     
// TODO add your handling code here:
        //disable gift icon on startup
        giftLabel.setVisible(false);
    }                                    

    private void tableMouseClicked(java.awt.event.MouseEvent evt) {                                   
// TODO add your handling code here:
        myTextArea.setText("haha! I replace you!: \n hey! you cliked a cell! \n you deserve a gift!\n");
        int row = table.getSelectedRow();
        Object data = table.getValueAt(row, 0);
        myTextArea.append("Festival's name: " + data + "\n");
        giftLabel.setVisible(true);
        System.out.print("hi I'm the system.");
        
        
    }                                  

    private void jScrollPane1MouseEntered(java.awt.event.MouseEvent evt) {                                          
// TODO add your handling code here:
        myTextArea.append("hey! you entered my scroll pane! \n");
        //openURL(http://google.com);
        // giftLabel.setVisible(false);
    }                                         
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new learn().setVisible(true);
    
            }
        });
    }
    
    // Variables declaration - do not modify                     
    private javax.swing.JLabel giftLabel;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea myTextArea;
    private org.jdesktop.swingx.JXTable table;
    // End of variables declaration                   
    
}
Message was edited by:
krimb1
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2007
Added on Jun 28 2007
6 comments
157 views