|
-
Feb 24th, 2001, 01:20 AM
#1
Thread Starter
Fanatic Member
Using somePanel.setBackground(); what goes in the parentheses? Thanks in advance anyone.
Alcohol & calculus don't mix.
Never drink & derive.
-
Feb 24th, 2001, 02:20 AM
#2
PowerPoster
try importing java.awt.systemColor
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Feb 24th, 2001, 02:23 AM
#3
PowerPoster
from JDK documentation:
setBackground
public void setBackground(Color c)
Sets the background color of this component.
Parameters:
c - The color to become this component's color. If this parameter is null then this component will inherit the
background color of its parent. background color.
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Feb 24th, 2001, 02:25 AM
#4
Thread Starter
Fanatic Member
I did, i imported java.awt.* and javax.swing.*
Alcohol & calculus don't mix.
Never drink & derive.
-
Feb 24th, 2001, 01:55 PM
#5
I wonder if you were really having a "background" problem. Consider the following:
It is a JPanel, not a jPanel.
You may need to place this in a type of frame (Frame or JFrame).
Sun has guidelines as to mixing awt and swing.
//filename BG.java
import java.awt.Color; // or java.awt.*; but I only need the Color class
import javax.swing.*;
public class BG extends JFrame{
JPanel jp;
public BG(){
jp = new JPanel();
jp.setBackground(Color.black);//Preset black; Can also define custom color
getContentPane().add(jp);
setSize(100,100);
setVisible(true);
System.out.println("Finished Constructor");
}
public static void main(String[] args){
System.out.println("Running");
new BG();
System.out.println("Finished main. Hit Ctrl+C in dos shell to exit app.");
}
}
-
Mar 12th, 2001, 08:09 PM
#6
Thread Starter
Fanatic Member
I got it, I wasn't putting "Color." in front of the color name.
Alcohol & calculus don't mix.
Never drink & derive.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|