From: Lew on 15 Feb 2010 12:52 RedGrittyBrick wrote: > If I remember correctly, Look & Feel has to be applied before any GUI > code runs. Not true, according to <http://java.sun.com/javase/6/docs/api/javax/swing/UIManager.html> > Once the look and feel has been changed it is imperative > to invoke updateUI on all JComponents. The method > SwingUtilities.updateComponentTreeUI(java.awt.Component) > makes it easy to apply updateUI to a containment hierarchy. > Refer to it for details. The exact behavior of not invoking > updateUI after changing the look and feel is unspecified. > It is very possible to receive unexpected exceptions, > painting problems, or worse. See <http://java.sun.com/javase/6/docs/api/javax/swing/SwingUtilities.html#updateComponentTreeUI(java.awt.Component)> -- Lew
From: RedGrittyBrick on 15 Feb 2010 12:54 On 15/02/2010 17:52, Lew wrote: > RedGrittyBrick wrote: >> If I remember correctly, Look & Feel has to be applied before any GUI >> code runs. > > Not true, according to > <http://java.sun.com/javase/6/docs/api/javax/swing/UIManager.html> >> Once the look and feel has been changed it is imperative to invoke >> updateUI on all JComponents. The method >> SwingUtilities.updateComponentTreeUI(java.awt.Component) makes it easy >> to apply updateUI to a containment hierarchy. Refer to it for details. >> The exact behavior of not invoking updateUI after changing the look >> and feel is unspecified. It is very possible to receive unexpected >> exceptions, painting problems, or worse. > > See > <http://java.sun.com/javase/6/docs/api/javax/swing/SwingUtilities.html#updateComponentTreeUI(java.awt.Component)> > > Thanks for the correction. -- RGB
From: Amr on 15 Feb 2010 13:00 On Feb 15, 10:43 pm, RedGrittyBrick <RedGrittyBr...(a)spamweary.invalid> wrote: > > > Have a look at my simple example in an earlier reply. hi, if you don't mind can you please give me the link for the thread you are referring to. i couldn't find which thread you are referring. thanks a lot.
From: Amr on 15 Feb 2010 13:08 thank you all, the program somewhat working now after making some changes from the given suggestion. i have to go through the suggestions again to see how can i optimize. thank you very much. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import java.awt.*; import net.miginfocom.swing.MigLayout; /** * * @author arshad */ public class AL2 extends JFrame implements ActionListener{ JTextField countText=new JTextField(20); JButton button=new JButton("Click to increment"); private int numClicks=0; public AL2(){ super(); themes(); // Dimension d=java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // setSize(d); JPanel pane=new JPanel(new MigLayout("Wrap 1")); button.addActionListener(this); pane.add(countText); pane.add(button); add(pane); setVisible(true); pack(); } public void themes(){ try{UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(this);}catch (Exception e) { System.out.println("errror in applying the theme"); } } public void actionPerformed(ActionEvent e){ numClicks++; countText.setText("Button CLicked"+numClicks+"Times"); } public static void main(String arg[]){ AL2 a=new AL2(); } } PS: is there any way in this group that each and every mail lands in my email box, so that i can reply from there itself without coming to the webpage? (i don't like the one or two emails per day. i can't wait untill the end of the day to recieve the mail) thank you :)
From: markspace on 15 Feb 2010 15:02 Amr wrote: > PS: is there any way in this group that each and every mail lands in > my email box, so that i can reply from there itself without coming to > the webpage? Thunderbird (from Mozilla.com) will read newsgroups, as will most other email readers. I use www.eternal-september.org as the new feed since ATT recently discontinued support for newsgroups.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: ANN: GR8 in the US 2010 Conference Registration Now Open! Next: Simple BorderLayout problem |