Forums Register Login

Swing - Problem in LookAndFeel

+Pie Number of slices to send: Send
The below is not compiling. I copied this prgoram from Sun's tutorial.
The Error due to this line: JFrame.setDefaultLookAndFeelDecorated(true);



Error Message:


1. What is event-dispatching thread.

2. If we want to use thread, we have extend Thread or implement Runnable. But in this program nothing is used. Why?

3. What is the meaning of the below coding:
javax.swing.SwingUtilities.invokeLater(new Runnable()

4. I heard that swing is platform independent. That is it's look and feel will be same across all the platform. Is it true? If so, I am getting the maximize amd minimize button(Windows Look and Feel) is differ from the one I seen in the Sun's tutorial output(Java Look and Feel). Why?

[ September 09, 2005: Message edited by: Niyas Ahmed Sheikh ]
[ September 09, 2005: Message edited by: Niyas Ahmed Sheikh ]
+Pie Number of slices to send: Send
About the compile problem - this method is since JDK 1.4, do you use an older version?

1 and 3 are better answered by Sun in Threads and Swing

I don't understand your question (2), you have a Runnable implementation that is queued on the vent thread.

4 is probably because default LAF differs on different platforms.
+Pie Number of slices to send: Send
This works fine for me

public static void main(String[] args) {
/*
* The following "try" sets the look and feel of the system the
* application is running on
*/
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (NoClassDefFoundError e) {
System.out.println("UIManager error:" + e.getMessage());
} catch (Exception e) {
System.out.println("MESSAGE:" + e.getMessage());
}

RunConversionLoad gui = new RunConversionLoad();
gui.go();
}
I promise I will be the best, most loyal friend ever! All for this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1225 times.
Similar Threads
threads for GUI and command-line
Swing not working ...
HelloWorldSwing
App does not work when on thread-safe in JBuilder
Big problem with Sun online tutorial: Swing
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:26:42.