Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: calling SingleFrameApplication

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default calling SingleFrameApplication

    ive a basic login that works from a database that says if member is there open another window...

    try {
    Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
    con = DriverManager.getConnection("jdbc:sybase:Tds:BFSCI TWA162652:5000/tradeblotter", "sa", "");

    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("SELECT COUNT (UserName) UN FROM users WHERE PWord = '" + Password + "' AND UserName = '" + UName + "'");
    while (rs.next()){
    exists = rs.getInt("UN");
    }
    if( exists == 0){
    JOptionPane.showMessageDialog(frame, "No such user.");
    }else {
    //JOptionPane.showMessageDialog(frame, "Yippee, I exist!!!.");
    JFrame mygui = TradeBlotterApp.getApplication().getMainFrame();
    mygui.show();
    }


    when that runs, it opens the window that appears with TradeBlotterApp, but its empty and doesnt have anything in that is there when u run it seperately!

    any ideas?

    cheers


  2. #2
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: calling SingleFrameApplication

    TradeBlotterApp.getApplication().getMainFrame();

    What exact does this return? It is obviously a Frame, but what components have been added to it?

    Also, please fix your post according to my signature.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  3. #3
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: calling SingleFrameApplication

    'tradeblotterapp', is a window with other GUI objects in it, obviously! But when its opened from this it doesn’t contain the rest of the GUI objects. This was made in NetBeans.

    As for your signature, I am so so sorry. However I do not appreciate being told how to ask for help. I have never, ever come across anywhere that has a specific way to ask for help, and nor have I come across anywhere that makes such a fuss about it, maybe putting newer members off posting.

    Now if you are going to be pedantic about my post, please ignore my plea for help and bother someone else about their etiquette.
    Last edited by petem86; October 8th, 2010 at 07:17 AM.

  4. #4
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: calling SingleFrameApplication

    That is what i want to see when i call this GUI to open.

     
    private void initComponents() {
     
            mainPanel = new javax.swing.JPanel();
            jbtnSend = new javax.swing.JButton();
            jlabUser = new javax.swing.JLabel();
            jlabUserName = new javax.swing.JLabel();
            jbtnRefresh = new javax.swing.JButton();
            jlabLogo = new javax.swing.JLabel();
            messagePane = new javax.swing.JSplitPane();
            jpanXMLFeed = new javax.swing.JPanel();
            menuBar = new javax.swing.JMenuBar();
            javax.swing.JMenu fileMenu = new javax.swing.JMenu();
            javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
            javax.swing.JMenu helpMenu = new javax.swing.JMenu();
            javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
            statusPanel = new javax.swing.JPanel();
            javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
            statusMessageLabel = new javax.swing.JLabel();
            statusAnimationLabel = new javax.swing.JLabel();
            progressBar = new javax.swing.JProgressBar();
            jSplitPane1 = new javax.swing.JSplitPane();
     
            mainPanel.setName("mainPanel"); // NOI18N
     
            javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(tradeblotter.TradeBlotterApp.class).getContext().getActionMap(TradeBlotterView.class, this);
            jbtnSend.setAction(actionMap.get("sendTextMessage")); // NOI18N
            org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(tradeblotter.TradeBlotterApp.class).getContext().getResourceMap(TradeBlotterView.class);
            jbtnSend.setText(resourceMap.getString("jbtnSend.text")); // NOI18N
            jbtnSend.setName("jbtnSend"); // NOI18N
     
            jlabUser.setName("jlabUser"); // NOI18N
     
            jlabUserName.setName("jlabUserName"); // NOI18N
     
            jbtnRefresh.setAction(actionMap.get("refreshXML")); // NOI18N
            jbtnRefresh.setName("jbtnRefresh"); // NOI18N
     
            jlabLogo.setName("jlabLogo"); // NOI18N
     
            messagePane.setBorder(javax.swing.BorderFactory.createTitledBorder("Messages"));
            messagePane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
            messagePane.setName("messagePane"); // NOI18N
     
            jpanXMLFeed.setBorder(javax.swing.BorderFactory.createTitledBorder("XML Prices"));
            jpanXMLFeed.setName("jpanXMLFeed"); // NOI18N
            jpanXMLFeed.setLayout(new java.awt.GridLayout(1, 0));
     
            jpanXMLFeed.add(new JScrollPane(new XmlClass()));
     
            javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
            mainPanel.setLayout(mainPanelLayout);
            mainPanelLayout.setHorizontalGroup(
                mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(mainPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                            .addComponent(jlabLogo)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 912, Short.MAX_VALUE)
                            .addComponent(jlabUser)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jlabUserName)
                            .addGap(17, 17, 17))
                        .addGroup(mainPanelLayout.createSequentialGroup()
                            .addGap(5, 5, 5)
                            .addComponent(jpanXMLFeed, javax.swing.GroupLayout.PREFERRED_SIZE, 481, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jbtnSend, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(messagePane, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)))
                        .addComponent(jbtnRefresh))
                    .addContainerGap())
            );
            mainPanelLayout.setVerticalGroup(
                mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(mainPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jlabLogo)
                        .addComponent(jlabUserName)
                        .addComponent(jlabUser))
                    .addGap(58, 58, 58)
                    .addComponent(jbtnSend, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jpanXMLFeed, javax.swing.GroupLayout.DEFAULT_SIZE, 521, Short.MAX_VALUE)
                        .addComponent(messagePane, javax.swing.GroupLayout.DEFAULT_SIZE, 521, Short.MAX_VALUE))
                    .addGap(56, 56, 56)
                    .addComponent(jbtnRefresh)
                    .addContainerGap())
            );
     
            messagePane.setTopComponent(new JScrollPane(content));
            messagePane.setBottomComponent(new JScrollPane(message));
     
            menuBar.setName("menuBar"); // NOI18N
     
            fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
            fileMenu.setName("fileMenu"); // NOI18N
     
            exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
            exitMenuItem.setName("exitMenuItem"); // NOI18N
            fileMenu.add(exitMenuItem);
     
            menuBar.add(fileMenu);
     
            helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
            helpMenu.setName("helpMenu"); // NOI18N
     
            aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
            aboutMenuItem.setName("aboutMenuItem"); // NOI18N
            helpMenu.add(aboutMenuItem);
     
            menuBar.add(helpMenu);
     
            statusPanel.setName("statusPanel"); // NOI18N
     
            statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N
     
            statusMessageLabel.setName("statusMessageLabel"); // NOI18N
     
            statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
            statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N
     
            progressBar.setName("progressBar"); // NOI18N
     
            javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
            statusPanel.setLayout(statusPanelLayout);
            statusPanelLayout.setHorizontalGroup(
                statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 959, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(statusMessageLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 789, Short.MAX_VALUE)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(statusAnimationLabel)
                    .addContainerGap())
            );
            statusPanelLayout.setVerticalGroup(
                statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(statusPanelLayout.createSequentialGroup()
                    .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(statusMessageLabel)
                        .addComponent(statusAnimationLabel)
                        .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(3, 3, 3))
            );
     
            jSplitPane1.setDividerLocation(200);
            jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
            jSplitPane1.setName("jSplitPane1"); // NOI18N
     
            setComponent(mainPanel);
            setMenuBar(menuBar);
            setStatusBar(statusPanel);

  5. #5
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: calling SingleFrameApplication

    public static void main(String[] args) throws Exception{
            launch(TradeBlotterApp.class, args);

    this line launches the TradeBlotterApp.class so i need to call this class from an if statement.

    can someone tell me how?

Similar Threads

  1. Calling Crystal Report
    By goutamdaphtari in forum Java Theory & Questions
    Replies: 0
    Last Post: July 15th, 2010, 12:02 AM
  2. Calling exe files from Java
    By linuxrockers in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 26th, 2010, 04:20 AM
  3. calling a constructor
    By turnwellm in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 3rd, 2010, 08:46 PM
  4. Calling for methods
    By soccer_kid_6 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 1st, 2010, 12:13 AM
  5. [SOLVED] How to call string in another class in java?
    By tazjaime in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 23rd, 2009, 09:31 AM