Netbeans GUI zu Eclipse (schon gegooglet und einiges ausprobiert).

Binary.Coder

Aktives Mitglied
Hallo zusammen,

ich habe in Netbeans eine GUI erstellt.
Diese wollte ich gerne in Eclipse nutzen.

Copy und paste ging natürlich nicht.

Dann habe ich das Projekt als Eclipse Projekt über den importer in Netbeans importiert und gespeichert.
In Eclipse refresht und dies brachte leider auch keinen Erfolg.

Der nächste Versuch ging nach dieser Anleitung:
Programmieren mit Harald R. Haberstroh: GUI mit Netbeans erstellen und mit Eclipse weiterbearbeiten
Also die Dateien in einen Lib Ordner kopiert und versucht zu aktivieren (wurden dann nach Referenced Libaries kopiert). Dies brachte nichts.
Auch das kopieren der beiden Dateien appframework-1.0.3.jar und swing-worker-1.1.jar brachte in einen lib Ordner und dem gleichen Ordner in dem die Java-Datei mit dem GUI drin ist brachte kein Erfolg.

Der Quelltext lautet:

Java:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Input.java
 *
 * Created on 17.06.2011, 03:06:15
 */
package gui;

public class Input extends javax.swing.JFrame {

    /** Creates new form Input */
    public Input() {
        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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        label1 = new java.awt.Label();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        openMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        saveAsMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        editMenu = new javax.swing.JMenu();
        cutMenuItem = new javax.swing.JMenuItem();
        copyMenuItem = new javax.swing.JMenuItem();
        pasteMenuItem = new javax.swing.JMenuItem();
        deleteMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        contentsMenuItem = new javax.swing.JMenuItem();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("jLabel1");

        jTextField1.setText("jTextField1");

        label1.setText("label1");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

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

        jLabel2.setText("jLabel2");

        fileMenu.setMnemonic('f');
        fileMenu.setText("File");

        openMenuItem.setMnemonic('o');
        openMenuItem.setText("Open");
        fileMenu.add(openMenuItem);

        saveMenuItem.setMnemonic('s');
        saveMenuItem.setText("Save");
        fileMenu.add(saveMenuItem);

        saveAsMenuItem.setMnemonic('a');
        saveAsMenuItem.setText("Save As ...");
        saveAsMenuItem.setDisplayedMnemonicIndex(5);
        fileMenu.add(saveAsMenuItem);

        exitMenuItem.setMnemonic('x');
        exitMenuItem.setText("Exit");
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        editMenu.setMnemonic('e');
        editMenu.setText("Edit");

        cutMenuItem.setMnemonic('t');
        cutMenuItem.setText("Cut");
        editMenu.add(cutMenuItem);

        copyMenuItem.setMnemonic('y');
        copyMenuItem.setText("Copy");
        editMenu.add(copyMenuItem);

        pasteMenuItem.setMnemonic('p');
        pasteMenuItem.setText("Paste");
        editMenu.add(pasteMenuItem);

        deleteMenuItem.setMnemonic('d');
        deleteMenuItem.setText("Delete");
        editMenu.add(deleteMenuItem);

        menuBar.add(editMenu);

        helpMenu.setMnemonic('h');
        helpMenu.setText("Help");

        contentsMenuItem.setMnemonic('c');
        contentsMenuItem.setText("Contents");
        helpMenu.add(contentsMenuItem);

        aboutMenuItem.setMnemonic('a');
        aboutMenuItem.setText("About");
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setJMenuBar(menuBar);

        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.LEADING)
                    .add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel1))
                .add(108, 108, 108)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel2)
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(20, 20, 20)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel1)
                    .add(jLabel2))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE)
                    .add(layout.createSequentialGroup()
                        .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Input().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JMenuItem contentsMenuItem;
    private javax.swing.JMenuItem copyMenuItem;
    private javax.swing.JMenuItem cutMenuItem;
    private javax.swing.JMenuItem deleteMenuItem;
    private javax.swing.JMenu editMenu;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextField jTextField1;
    private java.awt.Label label1;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem openMenuItem;
    private javax.swing.JMenuItem pasteMenuItem;
    private javax.swing.JMenuItem saveAsMenuItem;
    private javax.swing.JMenuItem saveMenuItem;
    // End of variables declaration//GEN-END:variables
}

Die Fehlermeldung lautet:

Code:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: 
	org.jdesktop.layout cannot be resolved to a type
	org.jdesktop.layout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.LayoutStyle cannot be resolved to a variable
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.LayoutStyle cannot be resolved to a variable
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.LayoutStyle cannot be resolved to a variable
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type

	at gui.Input.initComponents(Input.java:137)
	at gui.Input.<init>(Input.java:21)
	at gui.Input$1.run(Input.java:187)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:678)
	at java.awt.EventQueue.access$000(EventQueue.java:86)
	at java.awt.EventQueue$1.run(EventQueue.java:639)
	at java.awt.EventQueue$1.run(EventQueue.java:637)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:648)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Jemand eine Idee?

Vielen Dank und besten Gruß

Binary
 
dir fehlt die org.jdesktop.layout.X.jar

die findest du unter in dem Installationsordner von Netbeans unter:
Netbeans6.xx\PlatformX\modules.

einfach im explorer kopieren, deinem neuen Projekt einfügen und mit rechtsklick "addToBuilPath" auswählen.
 
org-jdesktop-layout.jar habe ich gefunden

org-jdesktop-layout.X.jar existiert nicht.

Fehlermeldung lautet leider immer noch:


Code:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: 
	org.jdesktop.layout cannot be resolved to a type
	org.jdesktop.layout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type
	org.jdesktop.layout.GroupLayout cannot be resolved to a type

	at gui.Input.initComponents(Input.java:139)
	at gui.Input.<init>(Input.java:21)
	at gui.Input$1.run(Input.java:170)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:678)
	at java.awt.EventQueue.access$000(EventQueue.java:86)
	at java.awt.EventQueue$1.run(EventQueue.java:639)
	at java.awt.EventQueue$1.run(EventQueue.java:637)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:648)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
 

Neue Themen


Zurück
Oben