8 Replies - 11021 Views - Last Post: 06 December 2010 - 02:24 PM Rate Topic: -----

#1 theProgrammer^^  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-December 10

Creating an Internal Frame in Netbeans (Java)

Posted 04 December 2010 - 04:32 AM

Hi,

I have been working with java for quite some time now. I am working on a system which basically consists of several Jframes. However, I need to make them all in one Internal frame. Does anyone know how I can do this using netbeans?Can an internal frame be generate automatically by Netbeans? Cheers
Is This A Good Question/Topic? 0
  • +

Replies To: Creating an Internal Frame in Netbeans (Java)

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: Creating an Internal Frame in Netbeans (Java)

Posted 04 December 2010 - 08:36 AM

Have a look at How to Use Internal Frames

The demo source link has a NetBeans project.
Was This Post Helpful? 2
  • +
  • -

#3 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10777
  • View blog
  • Posts: 40,123
  • Joined: 27-December 08

Re: Creating an Internal Frame in Netbeans (Java)

Posted 04 December 2010 - 09:54 AM

If you're referring to the NetBeans GUI Builder, stay away from it. It produces horrid code that humans cannot read nor maintain. Swing is so easy that you should write all your GUI code by hand.
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Creating an Internal Frame in Netbeans (Java)

Posted 04 December 2010 - 08:54 PM

As nothing to do with Netbeans. Netbeans is just just a fancy editor that knows Java. That is all !.
Take n8wxs advice
Was This Post Helpful? 0
  • +
  • -

#5 theProgrammer^^  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-December 10

Re: Creating an Internal Frame in Netbeans (Java)

Posted 05 December 2010 - 05:26 AM

Thanks for your suggestions. Generally I do build GUI code manually, but for general designs I opt to use generated code. In that case, do you have any suggestions on how I can do this manually?(the Internal Frame)
Was This Post Helpful? 0
  • +
  • -

#6 Dogstopper  Icon User is online

  • The Ninjaducky
  • member icon



Reputation: 2876
  • View blog
  • Posts: 11,050
  • Joined: 15-July 08

Re: Creating an Internal Frame in Netbeans (Java)

Posted 05 December 2010 - 09:53 AM

Just do it the same way that you would do any other Swing code. Override the necessary classes, add components, set layouts and such..,

Here's a good tutorial:
http://download.orac...ernalframe.html
Was This Post Helpful? 1
  • +
  • -

#7 theProgrammer^^  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-December 10

Re: Creating an Internal Frame in Netbeans (Java)

Posted 06 December 2010 - 10:07 AM

Thanks for the tutorial. So here is what I am doing...I create a JInternalFrame (simplply putting a title in it) and a JFrame. In the JFrame, I am creating a JDesktopPane and within the JButton listener, I am trying to add the JInternalFrame to the JFrame. But still not working...Any suggestions?
import javax.swing.JDesktopPane;
public class MyDesktop extends javax.swing.JFrame {

    public MyDesktop() {
        initComponents();
    }

    private void initComponents() {

        jButtonclick = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButtonclick.setText("CLICK");
        jButtonclick.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonclickActionPerformed(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()
                .add(jButtonclick)
                .addContainerGap(339, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(jButtonclick)
                .addContainerGap(277, Short.MAX_VALUE))
        );

        pack();
    }

    private void jButtonclickActionPerformed(java.awt.event.ActionEvent evt) {

        JDesktopPane dt = new JDesktopPane();
        MyInternalFrame mif = new MyInternalFrame();
        dt.add(mif);
        mif.setVisible(true);
    }

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MyDesktop().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify
    private javax.swing.JButton jButtonclick;
    // End of variables declaration
}


This post has been edited by macosxnerd101: 06 December 2010 - 10:09 AM
Reason for edit:: Please use code tags

Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10777
  • View blog
  • Posts: 40,123
  • Joined: 27-December 08

Re: Creating an Internal Frame in Netbeans (Java)

Posted 06 December 2010 - 10:11 AM

Don't use the NetBeans GUI Builder. We are happy to help you with code you wrote, but GUI Builder code isn't readable for humans.

Also, "it doesn't work" doesn't help us. Please remember to specifically describe your problems or errors.
Was This Post Helpful? 0
  • +
  • -

#9 theProgrammer^^  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-December 10

Re: Creating an Internal Frame in Netbeans (Java)

Posted 06 December 2010 - 02:24 PM

Sorry, I will keep that in mind in the future (I'm a newbie to programming forums). I managed to resolve the problem with a little more effort however. Thanks everyone for your time and help!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1