Swing look and feel [message #10957] |
Mon, 15 December 2003 07:54  |
Eclipse User |
|
|
|
Originally posted by: iida001.cello.ocn.ne.jp
Hi,
I was developing by setting Swing look and feel of VE to Windows.
Although it checked on the editor when expression of Windows was corrected,
it has been noticed that drawing of why and Swing is carried out at the time
of execution.
Is this a bug? Or is it a setup?
The component currently used is the following.
eclipse-SDK-2.1.2-win32
GEF-runtime-I20031015
emf_1.1.1_20031020_1612WL
Thanks
Iida
|
|
|
|
|
Re: Swing look and feel [message #11007 is a reply to message #10957] |
Mon, 15 December 2003 18:00   |
Eclipse User |
|
|
|
Hi Iida
At design time you can change the Swing look and feel you want the Visual Editor
to adopt. This is done by opening Window=>Preferences and selecting
Java=>Visual Editor. Then select the desired look and feel in the list. What
occurs is that each time the VE opens this is the L&F used by the Swing
components. If you have a custom look and feel you want to use that isn't in
the list you can use the New button on the preferences to add this to the list
of known look and feel classes and as long as it has a default constructor the
VE will be able to use it.
There is also a plugin extension point to contribute your own L&F classes to the
list if you want to do this your plugin neds the following
<extension point="org.eclipse.ve.internal.java.core.vce.lookandfeel">
<lookandfeel name="Funky L&F" class="com.mylookandfeel.MyLFClass"/>
</extension>
This means the the entry "Funky L&F" will appear in the preference page and be
selected so it becomes the new choice used by the Visual Editor.
Now ... this L&F setting is design time only. It has no affect on runtime,
because the Visual Editor does not create runnable classes. We don't create a
static main(String[] args) method and the panels and windows created with the VE
are generally going to be part of a larger application. This application would
be responsible for starting itself (with a main(String[] args) method and doing
global initialization such as connecting to a back end perhaps, and also setting
the L&F.
One thing we could do is put code in each VE classes' initialize() method to set
the L&F, but the problem here is that every application window would set the L&F
and the app wouldn't have a central place to do this. Therefore we could maybe
provide a way, or a way of helping a developer, knowing the syntax of setting
the look and feel class. There's Gili's idea of having code assist enhanced, so
maybe code assist could have entres called "Set Swing Windows look and feel" or
"Set Motif look and feel" and this would prompt the correct code, e.g.
try{
javax.swing.UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
} catch (Exception exc){
"Unable to see Windows look and feel";
exc.printStackTrace();
}
Another option is that when the New=>Visual Class wizard is taken if the user
selects the "Generate main method" checkbox we'd generate the set L&F code into
this method right there. We could also have an option on the Visual Editor
preferences to copy the correct code into the clipboard perhaps, or maybe write
it to the console during Run As=>Java Bean (the Visual Editor) launcher so it
could be easily pasted into someone's class where they wanted it.
Let us know which, if any, of these options would be most helpful.
Best regards,
Joe Winchester
|
|
|
Re: Swing look and feel [message #11078 is a reply to message #11007] |
Tue, 16 December 2003 06:52   |
Eclipse User |
|
|
|
Originally posted by: iida001.cello.ocn.ne.jp
Thanks Joe Winchester.
> try{
> javax.swing.UIManager.setLookAndFeel(new
> com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
> } catch (Exception exc){
> "Unable to see Windows look and feel";
> exc.printStackTrace();
> }
It was able to do, when trying on the upper code!
Is it useless even if it imitates the demonstration of VE as it is?
He studies Swing to a slight degree! Thank you.
iida
Joe Winchester wrote:
> Hi Iida
>
> At design time you can change the Swing look and feel you want the Visual Editor
> to adopt. This is done by opening Window=>Preferences and selecting
> Java=>Visual Editor. Then select the desired look and feel in the list. What
> occurs is that each time the VE opens this is the L&F used by the Swing
> components. If you have a custom look and feel you want to use that isn't in
> the list you can use the New button on the preferences to add this to the list
> of known look and feel classes and as long as it has a default constructor the
> VE will be able to use it.
>
> There is also a plugin extension point to contribute your own L&F classes to the
> list if you want to do this your plugin neds the following
> <extension point="org.eclipse.ve.internal.java.core.vce.lookandfeel">
> <lookandfeel name="Funky L&F" class="com.mylookandfeel.MyLFClass"/>
> </extension>
>
> This means the the entry "Funky L&F" will appear in the preference page and be
> selected so it becomes the new choice used by the Visual Editor.
>
> Now ... this L&F setting is design time only. It has no affect on runtime,
> because the Visual Editor does not create runnable classes. We don't create a
> static main(String[] args) method and the panels and windows created with the VE
> are generally going to be part of a larger application. This application would
> be responsible for starting itself (with a main(String[] args) method and doing
> global initialization such as connecting to a back end perhaps, and also setting
> the L&F.
>
> One thing we could do is put code in each VE classes' initialize() method to set
> the L&F, but the problem here is that every application window would set the L&F
> and the app wouldn't have a central place to do this. Therefore we could maybe
> provide a way, or a way of helping a developer, knowing the syntax of setting
> the look and feel class. There's Gili's idea of having code assist enhanced, so
> maybe code assist could have entres called "Set Swing Windows look and feel" or
> "Set Motif look and feel" and this would prompt the correct code, e.g.
>
> try{
> javax.swing.UIManager.setLookAndFeel(new
> com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
> } catch (Exception exc){
> "Unable to see Windows look and feel";
> exc.printStackTrace();
> }
>
> Another option is that when the New=>Visual Class wizard is taken if the user
> selects the "Generate main method" checkbox we'd generate the set L&F code into
> this method right there. We could also have an option on the Visual Editor
> preferences to copy the correct code into the clipboard perhaps, or maybe write
> it to the console during Run As=>Java Bean (the Visual Editor) launcher so it
> could be easily pasted into someone's class where they wanted it.
>
> Let us know which, if any, of these options would be most helpful.
>
> Best regards,
>
> Joe Winchester
>
|
|
|
|
|
Re: Swing look and feel [message #574356 is a reply to message #10957] |
Mon, 15 December 2003 09:26  |
Eclipse User |
|
|
|
iida001 wrote:
> Hi,
>
> I was developing by setting Swing look and feel of VE to Windows.
> Although it checked on the editor when expression of Windows was corrected,
> it has been noticed that drawing of why and Swing is carried out at the time
> of execution.
> Is this a bug? Or is it a setup?
>
> The component currently used is the following.
> eclipse-SDK-2.1.2-win32
> GEF-runtime-I20031015
> emf_1.1.1_20031020_1612WL
>
> Thanks
> Iida
>
The Swing look and feel would be set once by an application (usually as
part of its initialization). Typically a user will use the VE builder
to build components that are going to be embedded in an application. A
component (e.g., a customed JPanel) will not have code in it to
explicitly set the look and feel.
The look and feel preference (Editor/JavaBean launcher) comes to enable
one to render a particular look and feel so that the WYSIWYG rendering
will look as it would eventually in your application. It does not
generate a look and feel code, though.
Would adding a JavaSource template (to be used with code assist) to
generate a look/feel stub be helpful?
|
|
|
Re: Swing look and feel [message #574385 is a reply to message #10968] |
Mon, 15 December 2003 10:38  |
Eclipse User |
|
|
|
Originally posted by: iida001.cello.ocn.ne.jp
Thanks.
The Swing look and feel code :
public static void main(String[] arge) {
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFe elClassName());
<--This
} catch (Exception e) {
e.printStackTrace();
}
MainWindow app = new MainWindow();
}
Is it different although I understood in upper code?
Even if it uses the upper code, it does not become suitable Windows drawing.
If an insufficient thing is in the upper code, please let me know some.
Thanks
iida
Gili Mendel wrote:
> The Swing look and feel would be set once by an application (usually as
> part of its initialization). Typically a user will use the VE builder
> to build components that are going to be embedded in an application. A
> component (e.g., a customed JPanel) will not have code in it to
> explicitly set the look and feel.
>
> The look and feel preference (Editor/JavaBean launcher) comes to enable
> one to render a particular look and feel so that the WYSIWYG rendering
> will look as it would eventually in your application. It does not
> generate a look and feel code, though.
>
> Would adding a JavaSource template (to be used with code assist) to
> generate a look/feel stub be helpful?
>
|
|
|
Re: Swing look and feel [message #574444 is a reply to message #10957] |
Mon, 15 December 2003 18:00  |
Eclipse User |
|
|
|
Hi Iida
At design time you can change the Swing look and feel you want the Visual Editor
to adopt. This is done by opening Window=>Preferences and selecting
Java=>Visual Editor. Then select the desired look and feel in the list. What
occurs is that each time the VE opens this is the L&F used by the Swing
components. If you have a custom look and feel you want to use that isn't in
the list you can use the New button on the preferences to add this to the list
of known look and feel classes and as long as it has a default constructor the
VE will be able to use it.
There is also a plugin extension point to contribute your own L&F classes to the
list if you want to do this your plugin neds the following
<extension point="org.eclipse.ve.internal.java.core.vce.lookandfeel">
<lookandfeel name="Funky L&F" class="com.mylookandfeel.MyLFClass"/>
</extension>
This means the the entry "Funky L&F" will appear in the preference page and be
selected so it becomes the new choice used by the Visual Editor.
Now ... this L&F setting is design time only. It has no affect on runtime,
because the Visual Editor does not create runnable classes. We don't create a
static main(String[] args) method and the panels and windows created with the VE
are generally going to be part of a larger application. This application would
be responsible for starting itself (with a main(String[] args) method and doing
global initialization such as connecting to a back end perhaps, and also setting
the L&F.
One thing we could do is put code in each VE classes' initialize() method to set
the L&F, but the problem here is that every application window would set the L&F
and the app wouldn't have a central place to do this. Therefore we could maybe
provide a way, or a way of helping a developer, knowing the syntax of setting
the look and feel class. There's Gili's idea of having code assist enhanced, so
maybe code assist could have entres called "Set Swing Windows look and feel" or
"Set Motif look and feel" and this would prompt the correct code, e.g.
try{
javax.swing.UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
} catch (Exception exc){
"Unable to see Windows look and feel";
exc.printStackTrace();
}
Another option is that when the New=>Visual Class wizard is taken if the user
selects the "Generate main method" checkbox we'd generate the set L&F code into
this method right there. We could also have an option on the Visual Editor
preferences to copy the correct code into the clipboard perhaps, or maybe write
it to the console during Run As=>Java Bean (the Visual Editor) launcher so it
could be easily pasted into someone's class where they wanted it.
Let us know which, if any, of these options would be most helpful.
Best regards,
Joe Winchester
|
|
|
Re: Swing look and feel [message #574691 is a reply to message #11007] |
Tue, 16 December 2003 06:52  |
Eclipse User |
|
|
|
Originally posted by: iida001.cello.ocn.ne.jp
Thanks Joe Winchester.
> try{
> javax.swing.UIManager.setLookAndFeel(new
> com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
> } catch (Exception exc){
> "Unable to see Windows look and feel";
> exc.printStackTrace();
> }
It was able to do, when trying on the upper code!
Is it useless even if it imitates the demonstration of VE as it is?
He studies Swing to a slight degree! Thank you.
iida
Joe Winchester wrote:
> Hi Iida
>
> At design time you can change the Swing look and feel you want the Visual Editor
> to adopt. This is done by opening Window=>Preferences and selecting
> Java=>Visual Editor. Then select the desired look and feel in the list. What
> occurs is that each time the VE opens this is the L&F used by the Swing
> components. If you have a custom look and feel you want to use that isn't in
> the list you can use the New button on the preferences to add this to the list
> of known look and feel classes and as long as it has a default constructor the
> VE will be able to use it.
>
> There is also a plugin extension point to contribute your own L&F classes to the
> list if you want to do this your plugin neds the following
> <extension point="org.eclipse.ve.internal.java.core.vce.lookandfeel">
> <lookandfeel name="Funky L&F" class="com.mylookandfeel.MyLFClass"/>
> </extension>
>
> This means the the entry "Funky L&F" will appear in the preference page and be
> selected so it becomes the new choice used by the Visual Editor.
>
> Now ... this L&F setting is design time only. It has no affect on runtime,
> because the Visual Editor does not create runnable classes. We don't create a
> static main(String[] args) method and the panels and windows created with the VE
> are generally going to be part of a larger application. This application would
> be responsible for starting itself (with a main(String[] args) method and doing
> global initialization such as connecting to a back end perhaps, and also setting
> the L&F.
>
> One thing we could do is put code in each VE classes' initialize() method to set
> the L&F, but the problem here is that every application window would set the L&F
> and the app wouldn't have a central place to do this. Therefore we could maybe
> provide a way, or a way of helping a developer, knowing the syntax of setting
> the look and feel class. There's Gili's idea of having code assist enhanced, so
> maybe code assist could have entres called "Set Swing Windows look and feel" or
> "Set Motif look and feel" and this would prompt the correct code, e.g.
>
> try{
> javax.swing.UIManager.setLookAndFeel(new
> com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
> } catch (Exception exc){
> "Unable to see Windows look and feel";
> exc.printStackTrace();
> }
>
> Another option is that when the New=>Visual Class wizard is taken if the user
> selects the "Generate main method" checkbox we'd generate the set L&F code into
> this method right there. We could also have an option on the Visual Editor
> preferences to copy the correct code into the clipboard perhaps, or maybe write
> it to the console during Run As=>Java Bean (the Visual Editor) launcher so it
> could be easily pasted into someone's class where they wanted it.
>
> Let us know which, if any, of these options would be most helpful.
>
> Best regards,
>
> Joe Winchester
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04753 seconds