Howto open Dialogs or Frames build using other IDEs in VE? 2nd [message #120405] |
Fri, 10 March 2006 17:43  |
Eclipse User |
|
|
|
Originally posted by: lars.kappenberg.de
Hi *,
we are trying to reanimate a java project which has been build using various
(JBuilder, Oracle ... etc.) java development environments in the past.
We are using Eclipse 3.1.2 and all exept the visual editing of existing
dialogs and frames works fine. Dialogs or frames will not be displayed
in VE as they would at runtime.
Sorry for this beginner question:
How do we have to modify our code that VE will display the dialogs
correctly and visual editing is possible? We have around 20 dialogs
and would like visual editing using VE.
Here is a exerpt from the source code of a login dialog:
----->
package de.test.view;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class LogInDialogView extends JDialog
{
JPanel jPanelLogIn = new JPanel();
GridBagLayout gridBagLayoutLogInPanel = new GridBagLayout();
GridBagConstraints gridBagConstraintsLogInPanel = new GridBagConstraints();
JLabel jLabelBenutzerkennung = new JLabel();
JTextField jTextFieldBenutzerkennung = new JTextField();
JLabel jLabelKennwort = new JLabel();
JPasswordField jPasswordFieldKennwort = new JPasswordField();
JPanel jPanelFussLeisten = new JPanel();
GridBagLayout gridBagLayoutFussLeistenPanel = new GridBagLayout();
GridBagConstraints gridBagConstraintsFussLeistenPanel = new
GridBagConstraints();
JPanel jPanelFussButton = new JPanel();
GridBagLayout gridBagLayoutFussButtonPanel = new GridBagLayout();
GridBagConstraints gridBagConstraintsFussButtonPanel = new
GridBagConstraints();
JButton jButtonOK = new JButton();
JButton jButtonAbbrechen = new JButton();
JPanel jPanelFussStatusBarLeiste = new JPanel();
GridBagLayout gridBagLayoutFussStatusBarLeistePanel = new GridBagLayout();
GridBagConstraints gridBagConstraintsFussStatusBarLeistePanel = new
GridBagConstraints();
JLabel statusBar = new JLabel();
public LogInDialogView (JFrame pJFrameParent) {
this.setLocation ((int) pJFrameParent.getLocation().getX() +
((pJFrameParent.getSize().width - this.getSize().width)/2), (int)
pJFrameParent.getLocation().getY() + ((pJFrameParent.getSize().height -
this.getSize().height)/2));
initialize();
}
private void initialize()
{
this.setTitle ("Administrative Login");
this.setSize (new Dimension(300, 230));
this.setModal (true);
this.getContentPane().setLayout (new BorderLayout());
// LogIn Border
jPanelLogIn.setBorder (new TitledBorder
(BorderFactory.createEtchedBorder(), "LogIn"));
jPanelLogIn.setLayout (gridBagLayoutLogInPanel);
gridBagConstraintsLogInPanel.anchor = GridBagConstraints.WEST;
gridBagConstraintsLogInPanel.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraintsLogInPanel.insets = new Insets (10, 10, 10, 10);
jLabelBenutzerkennung.setText ("User ID");
gridBagConstraintsLogInPanel.gridx = 0;
gridBagConstraintsLogInPanel.gridy = 0;
gridBagConstraintsLogInPanel.weightx = 0;
gridBagLayoutLogInPanel.setConstraints (jLabelBenutzerkennung,
gridBagConstraintsLogInPanel);
jPanelLogIn.add (jLabelBenutzerkennung);
gridBagConstraintsLogInPanel.gridx = 1;
gridBagConstraintsLogInPanel.gridy = 0;
gridBagConstraintsLogInPanel.weightx = 1;
gridBagLayoutLogInPanel.setConstraints (jTextFieldBenutzerkennung,
gridBagConstraintsLogInPanel);
jPanelLogIn.add (jTextFieldBenutzerkennung);
jLabelKennwort.setText ("Password");
gridBagConstraintsLogInPanel.gridx = 0;
gridBagConstraintsLogInPanel.gridy = 1;
gridBagConstraintsLogInPanel.weightx = 0;
gridBagLayoutLogInPanel.setConstraints (jLabelKennwort,
gridBagConstraintsLogInPanel);
jPanelLogIn.add (jLabelKennwort);
gridBagConstraintsLogInPanel.gridx = 1;
gridBagConstraintsLogInPanel.gridy = 1;
gridBagConstraintsLogInPanel.weightx = 1;
gridBagLayoutLogInPanel.setConstraints (jPasswordFieldKennwort,
gridBagConstraintsLogInPanel);
jPanelLogIn.add (jPasswordFieldKennwort);
this.getContentPane().add (jPanelLogIn, BorderLayout.CENTER);
// Fuss-Leisten-Panel
jPanelFussLeisten.setLayout (gridBagLayoutFussLeistenPanel);
gridBagConstraintsFussLeistenPanel.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraintsFussLeistenPanel.weightx = 1;
// Fuss-Button-Leiste
jPanelFussButton.setLayout (gridBagLayoutFussButtonPanel);
// generelle GridBagConstraints-Bedingungen
gridBagConstraintsFussButtonPanel.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraintsFussButtonPanel.weightx = 1;
jButtonOK.setText ("OK");
jButtonOK.setMnemonic ('O');
jButtonOK.setPreferredSize (new Dimension (10,25));
gridBagConstraintsFussButtonPanel.gridx = 0;
gridBagConstraintsFussButtonPanel.gridy = 0;
gridBagConstraintsFussButtonPanel.insets = new Insets( 10, 10, 10, 6);
gridBagLayoutFussButtonPanel.setConstraints (jButtonOK,
gridBagConstraintsFussButtonPanel);
jPanelFussButton.add (jButtonOK);
jButtonAbbrechen.setText ("Cancel");
jButtonAbbrechen.setMnemonic ('A');
jButtonAbbrechen.setPreferredSize (new Dimension (10,25));
gridBagConstraintsFussButtonPanel.gridx = 1;
gridBagConstraintsFussButtonPanel.gridy = 0;
gridBagConstraintsFussButtonPanel.insets = new Insets (10, 6, 10, 10);
gridBagLayoutFussButtonPanel.setConstraints (jButtonAbbrechen,
gridBagConstraintsFussButtonPanel);
jPanelFussButton.add (jButtonAbbrechen);
gridBagConstraintsFussLeistenPanel.gridx = 0;
gridBagConstraintsFussLeistenPanel.gridy = 0;
gridBagLayoutFussLeistenPanel.setConstraints (jPanelFussButton,
gridBagConstraintsFussLeistenPanel);
jPanelFussLeisten.add (jPanelFussButton);
// Fuss-StatusBar-Leiste
jPanelFussStatusBarLeiste.setLayout
(gridBagLayoutFussStatusBarLeistePanel);
statusBar.setBorder (BorderFactory.createEtchedBorder());
statusBar.setText (" ");
gridBagConstraintsFussStatusBarLeistePanel.gridx = 0;
gridBagConstraintsFussStatusBarLeistePanel.gridy = 0;
gridBagConstraintsFussStatusBarLeistePanel.fill =
GridBagConstraints.HORIZONTAL;
gridBagConstraintsFussStatusBarLeistePanel.weightx = 1;
gridBagLayoutFussStatusBarLeistePanel.setConstraints (statusBar,
gridBagConstraintsFussStatusBarLeistePanel);
jPanelFussStatusBarLeiste.add (statusBar);
gridBagConstraintsFussLeistenPanel.gridx = 0;
gridBagConstraintsFussLeistenPanel.gridy = 1;
gridBagLayoutFussLeistenPanel.setConstraints (jPanelFussStatusBarLeiste,
gridBagConstraintsFussLeistenPanel);
jPanelFussLeisten.add (jPanelFussStatusBarLeiste);
this.getContentPane().add (jPanelFussLeisten, BorderLayout.SOUTH);
}
}
<-----
Thanks very much for any advice
Kind regards,
Lars
--
eclipse-SDK-3.1.2-win32 M20060118-1600
emf-sdo-runtime-2.1.1
GEF-runtime-3.1.1
VE-runtime-1.1.0.1
|
|
|
|
Re: Howto open Dialogs or Frames build using other IDEs in VE? 2nd [message #120444 is a reply to message #120431] |
Mon, 13 March 2006 02:27  |
Eclipse User |
|
|
|
Jeff Myers wrote:
> Lars,
> The main problem is that the VE does not currently support the call
> "this.getContentPane()"
> What you should do is at the start of your initialize() method, add:
> JPanel contentPane = new JPanel();
> this.setContentPane(contentPane);
> Then replace all calls to this.getContentPane() within your code with
> simply contentPane. For example change
> this.getContentPane().setLayout(new BorderLayout()); to
> contentPane.setLayout(new BorderLayout());
> That should help the display quite a lot.
> - JeffHi Jeff,
In JDK 5.0 getContentPane().add() is no more mandatory.
Have you plans to support JDK 5.0?
Regards,
Francesc Rosés
|
|
|
Re: Howto open Dialogs or Frames build using other IDEs in VE? 2nd [message #612301 is a reply to message #120405] |
Sat, 11 March 2006 11:54  |
Eclipse User |
|
|
|
Lars,
The main problem is that the VE does not currently support the call
"this.getContentPane()"
What you should do is at the start of your initialize() method, add:
JPanel contentPane = new JPanel();
this.setContentPane(contentPane);
Then replace all calls to this.getContentPane() within your code with
simply contentPane. For example change
this.getContentPane().setLayout(new BorderLayout()); to
contentPane.setLayout(new BorderLayout());
That should help the display quite a lot.
- Jeff
|
|
|
Re: Howto open Dialogs or Frames build using other IDEs in VE? 2nd [message #612302 is a reply to message #120431] |
Mon, 13 March 2006 02:27  |
Eclipse User |
|
|
|
Jeff Myers wrote:
> Lars,
> The main problem is that the VE does not currently support the call
> "this.getContentPane()"
> What you should do is at the start of your initialize() method, add:
> JPanel contentPane = new JPanel();
> this.setContentPane(contentPane);
> Then replace all calls to this.getContentPane() within your code with
> simply contentPane. For example change
> this.getContentPane().setLayout(new BorderLayout()); to
> contentPane.setLayout(new BorderLayout());
> That should help the display quite a lot.
> - JeffHi Jeff,
In JDK 5.0 getContentPane().add() is no more mandatory.
Have you plans to support JDK 5.0?
Regards,
Francesc Rosés
|
|
|
Powered by
FUDForum. Page generated in 0.07534 seconds