Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » JPanel background color as a resource property(JPanel background color as a resource property)
JPanel background color as a resource property [message #884190] Sun, 10 June 2012 11:15 Go to next message
Eclipse UserFriend
I was wondering if there was a way where I can set up the background color for my jpanel to a property defined in my properties file. I can do this by directly modifying the code, but the problem is that when viewing the frame in design mode the panel is black. And if i do the same for all components in the frame the entire screen is black and I really can't see how the design is coming along unless I actually run the application.

I hope my issue is clear enough, and that there is a easy solution for this. Netbeans allows you to set up the properties like colors, fonts as a resource.

Thanks
Re: JPanel background color as a resource property [message #884265 is a reply to message #884190] Sun, 10 June 2012 16:56 Go to previous messageGo to next message
Eclipse UserFriend
I would suggest posting some sample code showing what you want to do. Code generated by NetBeans would be fine.
Re: JPanel background color as a resource property [message #884288 is a reply to message #884265] Sun, 10 June 2012 18:27 Go to previous messageGo to next message
Eclipse UserFriend
This the code that is generated by netbeans when I select "Define as resource" for the background color.


org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(appView.class);
mainPanel.setBackground(resourceMap.getColor("mainPanel.background"));


The entry in the properties file for this resource is
mainPanel.background=204, 0, 0

In eclipse my code for the background that I have manually added
mainPanel.setBackground(new Color(Integer.parseInt(viewProperties.getProperty("global.color"), 16)));

Here the entry in the properties file is
global.color=577996


I hope this makes the issue a little clearer.

Thanks
Re: JPanel background color as a resource property [message #884974 is a reply to message #884288] Tue, 12 June 2012 07:52 Go to previous message
Eclipse UserFriend
Hi, any ideas on how I can get around this problem?

For now i have created a class that has all the properties defined as static strings. This way i can see the changes to the interface at design time. Although, I'd much rather have these in the properties file.

Thanks.
Previous Topic:XWT XML Schema
Next Topic:native method
Goto Forum:
  


Current Time: Tue Feb 18 13:13:24 GMT 2025

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

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

Back to the top