473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Changing JFrame Color

8
Hello ........

I Have an Application(JFrame) With several panels in its content pane at different times. I changes the background colors of all the panels say (blue).

I have also used frame.setbackground(Color.blue);

But that doesnt change that color.
What can I do cause its kind of visible and doesnt look so nice when everything else is in another color.
Jul 26 '07 #1
5 3555
blazedaces
284 100+
Hello ........

I Have an Application(JFrame) With several panels in its content pane at different times. I changes the background colors of all the panels say (blue).

I have also used frame.setbackground(Color.blue);

But that doesnt change that color.
What can I do cause its kind of visible and doesnt look so nice when everything else is in another color.
How much code is this? I don't like asking, but perhaps you should post the code? It might help to answer questions, but here are some:

Are you absolutely sure you're setting all the backgrounds of all the jpanels AND components (tables, buttons, textfields, etc.)?

What is the background color? Do you see blue anywhere at all?

Good luck,

-blazed
Jul 27 '07 #2
r035198x
13,262 8TB
Hello ........

I Have an Application(JFrame) With several panels in its content pane at different times. I changes the background colors of all the panels say (blue).

I have also used frame.setbackground(Color.blue);

But that doesnt change that color.
What can I do cause its kind of visible and doesnt look so nice when everything else is in another color.
After updating the interface, you need to repaint the whole thing so that the changes are visible.
Jul 27 '07 #3
Primo
8
After updating the interface, you need to repaint the whole thing so that the changes are visible.
how do i repaint everything?

@ blazedaces

this is the whole code:

public void showTaems(Taems t) {
JFrame frame;

taemsFrame = new JFrame("Taems");

taemsFrame.setSize(INITIAL_WIDTH, INITIAL_HEIGHT);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
taemsFrame.setSize(screenSize.width, (int)(screenSize.height * .95));
taemsFrame.setLocation(screenSize.width/2 - INITIAL_WIDTH/2,
screenSize.height/2 - INITIAL_HEIGHT/2);
taemsFrame.setLocation(0, 0);
taemsFrame.setDefaultCloseOperation(JFrame.DISPOSE _ON_CLOSE);
taemsFrame.getContentPane().add(t, BorderLayout.CENTER);

//AR taemsFrame.setBackground(Color.white);
taemsFrame.setBackground(Color.green);
taemsFrame.setVisible(true);
taemsFrame.setFont(new Font("Palatino", Font.BOLD, 16));
//Jayasri 06/15
taemsFrame.setResizable(true);

Container c = taemsFrame.getContentPane();
c.setBackground(Color.white);
c.setFont(new Font("Palatino", Font.BOLD, 16));
t.setBackground(Color.black);
t.setForeground(Color.red);
taemsFrame.show();
}
Aug 3 '07 #4
Primo
8
i still need help people
Aug 6 '07 #5
r035198x
13,262 8TB
i still need help people
getContentPane().validate()
Look it up in the docs.

Sometimes you may need to call the repaint method as well.
Aug 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tuno | last post by:
I'm relatively new to Java Swing programming. I have a console application that processes text files and while doing so I want to suspend the execution when an error is encountered that requires...
7
blazedaces
by: blazedaces | last post by:
Hi guys, what I'm I have is a jtable with boolean variables in the first column and text in the next two (checkboxes). I want my tableChanged method to make it so when I check one of the checkboxes...
2
by: zahit | last post by:
hi guys, my line doesn't appear on the frame. what's the problem? import java.util.*; import java.io.*; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.*; public class...
6
by: gaya3 | last post by:
Hi, I need to make the frame invisible on action event in swings. I have the following code: public class sample_pgm extends JFrame{ public void sample() { JFrame jf =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.