Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

java programming

User_I0BUFOct 31 2021

Hi everyone I started to learn java about a year ago and I dont know its just my abilities or doing something wrong
but seems to me I getting nowhere ... I doing the Udemy Java Masterclass and about finishing arrays at section 8 (if someone familiar)
but my progress just slow even I practicing every day . After all this time is possible that I should just give up?
Dont know if you guys are struggeling as well or just me or maybe I just dont use the right tool...
If anyone has an idea where can i find begginer level exercices or where can i contribute to easy java projects that would be helpful..
Best wishes
Peter

Comments

aterai
Not sure, but I think [Windows Desktop Property Support|http://java.sun.com/javase/6/docs/technotes/guides/swing/1.4/w2k_props.html] is what you are looking for.
import java.awt.*;
import javax.swing.*;
import java.beans.*;
public class Test {
  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
      public void run() { createAndShowGUI(); }
    });
  }
  public static void createAndShowGUI() {
    try{
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }catch(Exception e) {
      e.printStackTrace();
    }
    Toolkit.getDefaultToolkit().addPropertyChangeListener(
        "win.frame.activeCaptionColor", new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
        System.out.println(evt.getPropertyName());
      }
    });
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.setSize(320,240);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
  }
}
843807
That looks like it will work, although registering for individual "win.frame.xxx" property change events is a bit tedious and disappointing.
843807
I once created LookAndFeels that adapted to Windows XP theme changes. Listening for these two properties seemed to be sufficient, neither of which seems to be in the link posted previously. . I don't recall why I needed to listen for both, just one or the other may be sufficient, but that code's so old I'm not going back :)
protected static final String STYLE_DESKTOP_PROPERTY = "win.xpstyle.colorName";
protected static final String THEMEACTIVE_DESKTOP_PROPERTY = "win.xpstyle.themeActive";
These are listened for on the Toolkit.

Edited by: BoBear2681 on Feb 10, 2010 3:41 PM

Looking a little further, it appears that winxp.xpstyle.themeActive is fired when XP theming support is toggled (e.g. from the XP look to the Windows Classic look and vice versa), whereas win.xpstyle.colorName is fired when the XP style's color scheme is changed.
843807
Try the following code
try {
            UIManager.setLookAndFeel("LookAndFeelClass");   // or any change made in UI
            SwingUtilities.updateComponentTreeUI(this);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(MailClientFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(MailClientFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(MailClientFrame.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(MailClientFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
darrylburke
Subhadip. wrote:
Try the following code
which has nothing to do with the question asked here.

db
1 - 5

Post Details

Added on Oct 31 2021
2 comments
140 views