Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » What is nedded för VE to display a visual class?
What is nedded för VE to display a visual class? [message #94114] Thu, 16 June 2005 12:10 Go to next message
Eclipse UserFriend
Originally posted by: lars.bergholm.sifu.se

I have a project that I have moved from Jbuilder.
I would very much want to use the VE, but the visual classes don't show up
in the design pane. I suspect thera are som rules that I have to follow.
For instance the code below doesn't work.

I would be very happy if someone could help me with this.


-------------------------------------
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Diaom extends JDialog {

JPanel panel1 = new JPanel();
JButton Ok = new JButton();
JLabel text1 = new JLabel();
JLabel text2 = new JLabel();
JLabel text3 = new JLabel();
JLabel text4 = new JLabel();

public Diaom(JDialog frame, String title, boolean modal) {
//public Diaom(Frame frame, String title, boolean modal) {
super(frame, title, modal);
try {
jbInit();
}
catch(Exception ex) {
Diafel diafel = new Diafel(this, "Varning...", true,
"Dialogruta kunde ej öppnas!");
diafel.setLocationRelativeTo(this);
diafel.setVisible(true);
}
}

void jbInit() throws Exception {
this.setBounds(new Rectangle(290, 200));
this.setResizable(false);

panel1.setLayout(null);
panel1.setBackground(Color.white);
Ok.setMargin(new Insets(2, 2, 2, 2));
Ok.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(ActionEvent e) {
Ok_actionPerformed(e);
}
});
text2.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().add(panel1);
Ok.setBounds(new Rectangle(104, 132, 80, 25));
Ok.setText("OK");

text1.setForeground(Color.blue);
text1.setFont(new Font("TimesRoman", 3, 24));
text1.setBounds(new Rectangle(20, 5, 250, 40));
text1.setText("Riskbehandlingssystem");

text2.setFont(new Font("TimesRoman", 1, 14));
text2.setBounds(new Rectangle(106, 43, 83, 40));
text2.setText("(c) SIFU AB");

text3.setFont(new Font("TimesRoman", 0, 10));
text3.setBounds(new Rectangle(123, 70, 200, 40));
text3.setText("2003");

text4.setFont(new Font("TimesRoman", 1, 16));
text4.setBounds(new Rectangle(108, 90, 200, 40));
text4.setText("Version 4.01");

panel1.add(Ok, null);
panel1.add(text1, null);
panel1.add(text3, null);
panel1.add(text4, null);
panel1.add(text2, null);

}

void Ok_actionPerformed(ActionEvent e) {
this.setVisible(false);
}
}
Re: What is nedded för VE to display a visual class? [message #94128 is a reply to message #94114] Thu, 16 June 2005 12:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lars.bergholm.sifu.se

I found the information I needed in the help.(..Ok don't hit me,I know...)
search for 'Source code generated and parsed by the visual editor'
or just 'visual'
Regards
Lars
Re: What is nedded för VE to display a visual class? [message #95398 is a reply to message #94128] Thu, 30 June 2005 17:57 Go to previous message
Gili Mendel is currently offline Gili MendelFriend
Messages: 338
Registered: July 2009
Senior Member
Lars wrote:
> I found the information I needed in the help.(..Ok don't hit me,I know...)
> search for 'Source code generated and parsed by the visual editor'
> or just 'visual'
> Regards
> Lars
>

For this particular problem, it is the fact that VE will not understan implicit contentPane in V1.1.
You will have to create an explicit content pane
JPanel contentPane = new JPanel();

Add the following to jbInit

setContentPane(contentPane);
contentPane.setLayout(new BorderLayout());

And change
getContentPane().add(panel1);
to
contentPane.add(panel1);
Re: What is nedded för VE to display a visual class? [message #607965 is a reply to message #94114] Thu, 16 June 2005 12:53 Go to previous message
Lars is currently offline LarsFriend
Messages: 32
Registered: July 2009
Member
I found the information I needed in the help.(..Ok don't hit me,I know...)
search for 'Source code generated and parsed by the visual editor'
or just 'visual'
Regards
Lars
Re: What is nedded för VE to display a visual class? [message #608126 is a reply to message #94128] Thu, 30 June 2005 17:57 Go to previous message
Gili Mendel is currently offline Gili MendelFriend
Messages: 338
Registered: July 2009
Senior Member
Lars wrote:
> I found the information I needed in the help.(..Ok don't hit me,I know...)
> search for 'Source code generated and parsed by the visual editor'
> or just 'visual'
> Regards
> Lars
>

For this particular problem, it is the fact that VE will not understan implicit contentPane in V1.1.
You will have to create an explicit content pane
JPanel contentPane = new JPanel();

Add the following to jbInit

setContentPane(contentPane);
contentPane.setLayout(new BorderLayout());

And change
getContentPane().add(panel1);
to
contentPane.add(panel1);
Previous Topic:From JBuilder to Eclipse VE
Next Topic:Create Remote VM for Visual Editor for Java
Goto Forum:
  


Current Time: Fri Apr 26 06:10:56 GMT 2024

Powered by FUDForum. Page generated in 0.03426 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top