System default background color to JFrame on MAC OSX & Ubuntu
I want to set JFrame backgroud color to System Default color of MAC OSX and UBuntu OS. Can anyone plz help me in this regard.
Thanks
Just an addition: If you want to give your application the typical 'brushed metal' look on Mac OS, try starting the application with "-Dapple.awt.brushMetalLook=true"
Similar Messages
-
Change background color for JFrame
hi,
i want to change background color of JFrame. In my application i didn't create any panels.
my code like this,
Frame myFrame = new JFrame ( " Grid Layout Frame ");
myFrame.setSize(500,500);
myFrame.getContentPane().setBackground(Color.white);
myFrame.setVisible(true);thanks,
BalajiYou don't get a white frame when you run this program?import java.awt.*;
import javax.swing.*;
public class junk
public static void main(String[] args) throws Exception
JFrame f = new JFrame("Hello");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(500,500);
f.getContentPane().setBackground(Color.white);
f.setVisible(true);
} -
Flex 4.5.1 SDK & default-background-color Compiler Argument
Hey guys,
I was scanning the available compiler arguments list (http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a92.html) for Flex 4.5 SDK and noticed that the -default-background-color argument is gone (I realize it's been gone since 4 just haven't used the SDK much lately). My background shows up as black when I run my app (it's an AS3 app with the new Away3D 4.0 Broomstick library) and there is no Flex code in my app so I was depending on this compiler argument to set my background color to white.
How can I achieve this now that the argument is no longer available? I just simply want to have a white background without physically having to create a white sprite in the back of my scene. Is this possible anymore?
MattSimeon,
Thanks for that, I had a brainfart and forgot you can have the properties defined in that manner. I changed it but it still wasn't working which made me realize I had to change the backgroundColor property on the view in Away3D. I realized this after trying the params for the class and then not adding the view (which had a white bg) and then i looked at the docs and bam, there it was. Thanks!
Matt -
Print outs have thin border when -default-background-color is set
Hey everyone. In my application the print out have this very thin border. The -default-background-color is set to #333333 (dark grey) and this is the problem. When I set the color to #FFFFFF (white), the thin borders go away.
When I set the default-backgroun-color to #FFFFFF, my loading screen is white. I don't want that.
Does anyone know how I can have my loading screen with a #333333, but not have the thin border lines around my print outs? Setting the border properties on the printed component doesn't work. The problem is with the background color.
Thanks for reading.
TomStill hacking away at this problem.
I thought I had the fix until I deployed the AIR application. Setting the -default-background-color to white worked fine when running from flex builder, but when I installed the application. The "borders" are still showing.
Has anyone had any experience with this? I'm printing Point of Sale receipts and they look like crap with these lines around them. On top of this, some printers print differently. The HPs print a border around the whole component. The Brother printers just print the left and right. One of my customer's printers just prints the bottom and right borders. -
Default background color and Focuslistener disapair on table?
When I imp. TableCellRenderer on my table the default background color and Focuslistener disapair. What can I do to get it back and still keep TableCellRenderer on my table? This is how my TableCellRenderer looks:
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
JFormattedTextField beloeb = new JFormattedTextField();
beloeb.setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter()));
beloeb.setBorder(null);
beloeb.setHorizontalAlignment(JTextField.RIGHT);
if (value != null) {
if (value instanceof Double) {
Double val = (Double) value;
beloeb.setValue(val);
if (val.doubleValue() < 0) {
beloeb.setForeground(Color.RED);
beloeb.setFont(new Font("Verdana",Font.PLAIN, 11));
beloeb.setOpaque(true);
return beloeb;
}I'm sorry to say this is a terrible example of a renderer. The point of using a renderer is to reuse the same object over and over. You don't keep creating Objects every time a cell is renderered. In your example your are creating:
a) JFormattedTextField
b) NumberFormatter
c) DefaultFormatterFactory
d) Font.
So you start by extending the DefaultTableCellRenderer. A JLabel is used to display the text. There is no need to use a JFormattedTextField. All you want to do is format the data. So in your constructor for the class you would create a NumberFormatter that can be reused to format your data. Then your code in the renderer would look something like:
if (value instanceof Double)
Double val = (Double)value;
setText( formatter.format(val) );
if (negative)
setForeground(Color.RED)
else
setForeground(table.getForeground());
}Here is a really simple [url http://forum.java.sun.com/thread.jsp?forum=57&thread=419688]example to get you started -
Default background color issue
Hi,
I am trying to change themes at run-time using
StyleManager.loadStyleDeclarations(). Whenever I switch to a theme,
the default theme's background color shows up for a fraction of a
second. I tried using the "StyleEvent.COMPLETE" event handler but
it doesn't seem to work. Is there a way to remove this? I want the
transition from my current theme to the next theme to be smooth
without the default background color appearing. If anybody can
please provide a solution for this, It would be a great help.
Thanks,
Jaiquote:
Originally posted by:
LuigiL
Project -> Properties -> Flex Compiler -> add the
default color:
-default-background-color 0xFFFFFF
That's not what he's talking about... He's saying if you load
a CSS file with loadStyleDeclarations(), it will momentarily flash
the default, green Halo theme before switching to the new style...
If I load up my white theme (White.swf -- compiled to swf from css)
and then I want to change to my red theme (Red.swf) like:
StyleManager.unloadStyleDeclarations("White.swf");
StyleManager.loadStyleDeclarations("Red.swf");
At the * point in the execution, it will flash the green Halo
theme instead of just making a smooth transition from white to
red... It doesn't look so professional...
I have the same problem when switching themes, and it's very
annoying... Guess I'll keep an eye on this thread... -
Change default background color in Dynamic pages
Anyone knows how to change the default background color of a
dynamic content page in WEBDB 2.2?.
I want to display some information with a query in a Dynamic
Content Page but the background color is, by default, beige.
I try to force the the background color placing the html tag
<td bgcolor=#FFFFFF> but there is still a beige strip at the
left side of the table.
ThanksHi Richard,
For about how to inspect page element, you can use IE Developer Tools:
https://msdn.microsoft.com/en-us/library/ie/bg182326%28v=vs.85%29?f=255&MSPPError=-2147217396
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Setting a default background color
Hi All,
I would like to set a default background color for all the
components that I'm going to draw. What is the best
way to achieve this?
Thanks.
SyedYou can set using UIManager of the Look and Feel.
UIManger.put("Button.background", Color.blue);
will set the color of all the JButtons to blue. Like that you can change for all the components you need.
Mohan -
Flex 4 lacks the default-background-color compiler option?
Hello,
started converting my Flex 3 applications to Flex 4 and noticed that Flex 4 lacks the default-background-color compiler option.
Flex 3 has it: http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html
Flex 4 doesn't: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a92.html
This raises a question: how am I supposed to keep my background from flashing from grey to white when the RIA is loaded? Is it possible to use preloader with background set to whatever color I like to see? Any easier solutions?
Best regards,
JukkaThis works for me:
@namespace mx "library://ns.adobe.com/flex/mx";
mx|Application{
background-color:#ffffff;
Of course if you have changed the Application element to spark equivalent, you have to change the namespace.
Regards,
Jukka -
How to retrieve default background color for JPanels or other containers?
Hi everybody, I've written a small class extending the default JTextArea, intended to provide the functionality of a small, descriptive item in JPanels.
import java.awt.*;
import javax.swing.*;
public class JInfoTextArea extends JTextArea{
public JInfoTextArea(String text){
super(text);
setEditable(false);
setFont(Font.decode("SansSerif"));
setFocusable(false);
setLineWrap(true);
setWrapStyleWord(true);
// setBackground(contentPane.getBackground());
setAlignmentX(Component.LEFT_ALIGNMENT);
setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
}As you can see, there formerly used to be a third parameter, namely contentPane, which contained a reference to the parent Container in order to set the TextArea's background color appropriately for transparency.
Now, is there ANY way to retrieve the background color without either passing a dedicated parameter or doing something like
setBackground((new JPanel()).getBackground());Any help is greatly appreciated!
Yours, StefanieTo answer your original question the UIManager contains properties of the various components. In case your interested the following program has a fancy GUI display of all the components:
http://www.discoverteenergy.com/files/ShowUIDefaults.java -
How to add background color in JFrame
I have three classes, Car, CarComponent, and CarViewer. I don't know how to code background color. Do I add it to CarViewer where the JFrame is or CarComponent?
CarViewer:
import javax.swing.JFrame;
public class CarViewer
public static void main(String[] args)
JFrame frame = new JFrame();
frame.setSize(300, 400);
frame.setTitle("Two cars");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
CarComponent component = new CarComponent();
frame.add(component);
frame.setVisible(true);
}CarComponent
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JComponent;
This component draws two car shapes.
public class CarComponent extends JComponent
public void paintComponent(Graphics g)
Graphics2D g2 = (Graphics2D) g;
Car car1 = new Car(0, 0);
int x = getWidth() - 60;
int y = getHeight() - 30;
Car car2 = new Car(x, y);
car1.draw(g2);
car2.draw(g2);
}What JSG said, plus I really don't think it's a good idea to instantiate new Car objects in a paintComponent override. Painting methods should be restricted to painting activities, as a matter of principle.
One alternative is to construct your Car instances in a separate method and call repaint() when done; another is to provide a Car method say moveTo(int x, int y) OR refactor the draw(Graphics g) method of Car to draw(Graphics g, int x, int y). Both these suggest that you maintain the Car references as instance fields of CarViewer.
In future (not this time), Swing related questions should be posted in the [Swing forum|http://forums.sun.com/forum.jspa?forumID=57]
db -
Background Color change JFrame
I have to change the background color when the result is either too high or low. Program runs great except the background color doesn't change. And before you complain about my code, I hit the "CODE" button before and after my code in here and it does nothing. The videos wouldn't play. So I don't know how to add code correctly.
import java.awt.*;
import java.util.Random;
import javax.swing.*;
public class NumberGuess extends JFrame {
Random rand = new Random ( ) ;
int randomNumber = 1 + rand.nextInt(1000);
int count = 0;
private JFrame panel = new JFrame();
private JFrame panelButtons = new JFrame();
private JFrame panelBottom = new JFrame();
private void compareResult() {
int userInput = Integer.parseInt(tempTextField.getText().trim());
if ( userInput > randomNumber )
resultLabel.setText( "Too High. Try a lower number." );
setBackgroundColor(Color.blue);
private void setBackgroundColor(Color color)
panel.setBackground(color);
panelBottom.setBackground(color);
panelButtons.setBackground(color);Goofy_1969 wrote:
And before you complain about my code, I hit the "CODE" button before and after my code in here and it does nothing.Well, you did manage to create 2 empty code blocks though.
I know this is New To Java, so I need to be nicer and most of you people don't probably have the intrinsic knowledge of "start tag" and "end tag".
But still. All you need is to put your code between tags and everything will work great.
AND HEY, There's the preview button too! So you can actually try and try and try until it works. It's just that programming is a difficult hobby and if you can't work the code tags, you really need to rethink whether you're ready for something that's actually complicated.
(Also if you're not using the code tags, your code will totally get screwed up and people can't help you even if they wanted to.)
As for your code, try using SwingUtilities.invokeLater(). That's the only way you can modify the GUI when you're not running in the event thread. -
Change picture package default background color
How do I change the background color for a picture package? It keeps defaulting to white. I need it to be black.
Thanks,
SPIn Photoshop 11.0.1? Bridge 3.x? Or…?
Try this older tech note:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=323172 -
Sending email using system default mail client on linux and Mac
Want to send e-mail using defalut mail client of Linux, Mac OSX, others.
Your question may be about mail, and your question may be about Java,
but the JavaMail library can't do what you're asking.
I know of no platform-independent way to do what you're asking.
You can write lots of platform-dependent code - to do it with Outlook
on Windows, to do it with AppleMail on MacOS, to do it with Thunderbird
on Linux - but I know of no way to do it with whatever mail client the
user has configured on any system.
Sorry. -
Can't print directly from PS Elements 2 on my Mac: G5 single 1.8GHz processor; 1.5Meg RAM; over 220 gig free space on hard drive; Mac OSX 10.4.3; Epson Photo R800 printer and paper with Epson ICC profiles installed and working.
PSE 2 slaughters the color on printout (this shows up in preview, too). I've downloaded and installed the "Ignore EXIF Color Space" plug-in, it loads during PSE 2 startup, but the sRGB color space is still indicated in the PSE 2 print dialogues.
A second problem: iPhoto indicates that files written by PSE 2 (.psd or .jpeg) are unreadable and will not open them.
However, I can open these PSE 2 files and print them with the Mac Preview application and everything seems to work ok. This all feels like an incompatibility issue between PSE 2 and Mac OSX 10.4.3. Will I have to buy PSE 3? (Although the Adobe web site only says PSE 3 is compatible with Mac OS X v.10.2.8 or v.10.3; there is no mention of "or higher" or of Mac OSX 10.4.3 in particular.)Thank you for your helpful and quick advice.
Unfortunately, I did not have the latest version of Disk Warrior. Your probably right that zeroing the drive was overkill, but what a great feeling to start over! I feel like I just took a shower, broke up with my girlfriend, and moved to Italy to start a new life.
I went ahead and installed a retail version of OSX 10.4.3 and I am back up and running. I am going to stay a away from the latest OSX software updates for now to see how things play out.
--Franz
Zeroing is not necessary in most cases. A bad node
can frequently be repaired by Alsoft Disk Warrior
(assuming your data is backed up). If your data
isn't backed up, a bad node can often be read through
by Prosoft Data Rescue.
If I didn't catch you in time to stop your zeroing,
if installing the operating system you have
difficulty with zeroing, then perhaps the drive has
failed or its connector has failed. Be sure when you
go to install to only install the operating system
that came with the computer or a newer retail
operating system.
Maybe you are looking for
-
Hi! I am working on File(source.csv)->Xi->File(Target.csv) Scenario. In my Source File i have 4 fields which are mapped to the target file which contains 2 additional fields with constant values mapped. So, I should get 6 fields at receiver end. <b
-
Install CF8.01 on Windows Server 2008 64bits
Hello, I have a new machine whith Windows server 2008 x64 and i installed on it CF8.01. For installing, no problems and the service work fine. But, when i launch one page on the web server, a .cfm or a classic html the IIS 7 return a error 500.21 : H
-
OBIEE 11.1.1.6 Production Environment on AIX
Hi Friends Consultant from Oracle installed OBIEE on three AIX machines.One is database server,web logic and OBIEE server installed on one machine, Informatica and DAC server installed on one machine.Ii is our Dev environment,My boss is planning for
-
Issue getting Facebook notifications
I just got the new BlackBerry Q10 and am not getting any push notications from Facebook on the HUB. I have updated the BlackBerry OS to 10.2.1.2112. I uninstalled and reinstalled the newest version of Facebook and when installed, set the notification
-
Receive Rosettanet Message to SAP 4.6c
Dear all , My customer will send the PO details by rosettanet message , Is it possible to receive the rosettanet message directly to sap from the partner ? I am using SAP 4.6C version. If possible how to do ? Please explain me . Best Regar